Identifiers and Relations Specification

Identifiers in Markdown Documents

An identifier is a location-based reference for addressing elements in markdown documents. It consists of a file path and optionally an element name (fragment).

Distinction from Element ID:

Identifiers are used for writing relations in markdown and cross-referencing between elements. The system resolves identifiers to Element IDs during parsing for internal tracking and change detection. When an element is relocated to a different file or section, its identifier changes but its Element ID remains stable.

Identifier in markdown document can be of several types

-Identifier

Identifier Path Resolution Rules

Each identifier must uniquely reference either:

Identifier Path Resolution Examples

Assuming the folder is project and a file exists at /path/to/project/documents/File1.md:

IdentifierResolves toType
File2.mdproject/documents/File2.mdInternalPath
subfolder/File3.mdproject/documents/subfolder/File3.mdInternalPath
../File4.mdproject/File4.mdInternalPath
/project/File4.mdproject/File4.mdInternalPath
https://example.comhttps://example.comExternalUrl
../Requirments#element-nameproject/Requirments#element-nameIdentifier

Identifier Form Variations and Examples

System recognises 2 kinds of identifier that may appear in documents and relations:

Both Simple identifier and link part of GitHub-style markdown identifier can be etiher internal internal paths or external links (eg. starting with known scheme eg. https://)

When parsing identifiers, both styles are nomarlized into the same form used internally by the system.

As part of normailization process, element names are converted to GitHub-style anchor link fragments which are internal identifer representations:

1. Simple Identifiers

Plain file or element references, following the path resolution rules.

Examples:

file.md
file.md#element name
../relative_path/file.md#element name
#element name
path/file.md#My Element (Draft)
/path/file.md#Elements

2. GitHub-style Markdown Link Identifiers

A valid GitHub-style Markdown link to a file or a fragment within a file. Identifier is considered the link part of the markdown link: everything inside ‘(identifier)’.

Once link part is obtained from GitHub-style Markdown link, it is following same rules for normalization as simple identifiers.

Examples:

[Specification](documents/specification.html)
[My Element](documents/specification.html#my-element)

Relations in Markdown Documents

The #### Relations subsection specifies associations between elements, files, or other resources, forming the logical and dependency structure of the model.

The #### Relations subsection:

The #### Relations subsection must be located within an element chunk. Each element chunk can have at most one #### Relations subsection.

The #### Relations header marks the beginning of the subsection.

The #### Relations subsection must appear directly within an element chunk. It must follow the ### header of the parent element and any preceding content.

Relation Structure

Relation Format

Relation Type

Target Identifier


Examples of #### Relations

1. Simple Relations



### My Element
This is the content of My Element.

#### Relations
  * dependsOn: [Element2](#element2)
  * relatedTo: [path/to/anotherFile.md/Section3](path/to/anotherFile.html#section3)
  * uses: [file.html](file.html)

2. Relations with Special Characters



### API v2.0
Details about API version 2.0.

#### Relations
  * satisfies: [documents/specification.md#API: v2.0](documents/specification.html#api-v20)

3. Relation to an Element in the Same File

If the referenced element exists within the same file, the identifier can be a fragment only.


#### Relations
  * extends: [Another Section](#another-section)

4. Relative Path Relations

If the referenced file is located in a subfolder relative to the current document, use a relative path.


#### Relations
  * derive: [subfolder/details.md#refined-section](subfolder/details.html#refined-section)

5. Absolute Path Relations

If the reference starts with /, it points to a file or element relative to the git repository root folder.


#### Relations
  * verifiedBy: [/specifications.md#verification-steps](/specifications.html#verification-steps)

6. Invalid Relations Example


This element contains invalid relation entries.

#### Relations
  * derivedFrom: [Element2](#element2)
* InvalidEntry
* : MissingRelationType
  * trace: [path/to/file.html](path/to/file.html)

Identifier Usage in Relations

Identifiers are used in relations to reference files or specific elements within files. Examples:

  1. Relation to a File:

    #### Relations
      * satisfiedBy: [documents/specification.html](documents/specification.html)
    
  2. Relation to an Element:

    #### Relations
      * derivedFrom: [documents/specification.md/section one](documents/specification.html#section-one)
    

Validation rules

The system must validate relation usage according to these rules: