Wikilinks
Wikilinks are Obsidian-style links that connect notes within your kiln. They use double bracket syntax [[...]] and support various forms of references including aliases, headings, and block references.
Basic Syntax
Section titled “Basic Syntax”Simple Link
Section titled “Simple Link”[[Note Name]]Links to a note named “Note Name.md”. The display text matches the target note name.
Link with Alias
Section titled “Link with Alias”[[Note Name|display text]]Links to “Note Name.md” but displays “display text” to the user.
Link with Heading Reference
Section titled “Link with Heading Reference”[[Note Name#Heading]]Links to a specific heading within “Note Name.md”.
Link with Block Reference
Section titled “Link with Block Reference”[[Note Name#^block-id]]Links to a specific block within “Note Name.md”. Block references start with ^ after the # symbol.
Combined: Heading with Alias
Section titled “Combined: Heading with Alias”[[Note Name#Section|Display Text]]Links to a heading within a note, but displays custom text.
Embed Syntax
Section titled “Embed Syntax”Basic Embed
Section titled “Basic Embed”![[Note Name]]Embeds (transcludes) the content of another note at the current location.
Embed with Heading
Section titled “Embed with Heading”![[Note Name#Heading]]Embeds only the content under a specific heading.
Embed with Block Reference
Section titled “Embed with Block Reference”![[Note Name#^block-id]]Embeds a specific block identified by its block ID.
Path Syntax
Section titled “Path Syntax”Wikilinks support hierarchical paths for notes organized in folders:
[[Folder/Subfolder/Note]]Examples:
[[Help/Wikilinks]] → docs/Help/Wikilinks.md[[Organization Styles/PARA]] → docs/Organization Styles/PARA.mdResolution Algorithm
Section titled “Resolution Algorithm”1. Parsing Phase
Section titled “1. Parsing Phase”The parser (crates/crucible-core/src/parser/wikilinks.rs) uses a regex to extract wikilinks:
Regex::new(r"(!?)\[\[([^\]]+)\]\]")2. Component Extraction
Section titled “2. Component Extraction”The content inside brackets is parsed in the following order:
- Alias separation: Split on
|→(target_part, alias) - Reference extraction: Split
target_parton#→(target, ref_part) - Reference type detection: If
ref_partstarts with^: Block reference, otherwise: Heading reference
3. Code Block Exclusion
Section titled “3. Code Block Exclusion”Wikilinks inside code blocks are not parsed.
4. Link Resolution
Section titled “4. Link Resolution”At query time, the storage layer resolves wikilinks:
- Exact match: Search for note with exact title match
- Path match: Search for note at exact path
- Fuzzy match: Search for notes with similar names
Edge Cases
Section titled “Edge Cases”Special Characters
Section titled “Special Characters”Wikilinks support various special characters in note names:
[[note-with-dashes]][[note_with_underscores]][[note with spaces]][[note.with.dots]]Empty Wikilinks
Section titled “Empty Wikilinks”[[]]Empty wikilinks are parsed but may be ignored.
Unclosed Wikilinks
Section titled “Unclosed Wikilinks”[[brokenUnclosed wikilinks are not parsed.
Multiple Wikilinks on Same Line
Section titled “Multiple Wikilinks on Same Line”Multiple links: [[first]] and [[second]] and [[third]]All wikilinks on the same line are parsed independently.
Escaping
Section titled “Escaping”There is no escape mechanism for wikilink syntax. If you need to display literal [[ and ]]:
- Use inline code:
`[[not a link]]` - Use HTML entities:
[[not a link]] - Place in a code block
Parser Implementation
Section titled “Parser Implementation”Main extension: crates/crucible-core/src/parser/wikilinks.rs
markdown-it plugin: crates/crucible-core/src/parser/markdown_it/plugins/wikilink.rs
Type definition: crates/crucible-core/src/parser/types/links.rs
Edge case tests: crates/crucible-core/tests/wikilink_edge_cases.rs
See Also
Section titled “See Also”:h frontmatter- YAML metadata format:h tags- Tag system and nested tags:h block-references- Block ID syntax and usage