Skip to content

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.

[[Note Name]]

Links to a note named “Note Name.md”. The display text matches the target note name.

[[Note Name|display text]]

Links to “Note Name.md” but displays “display text” to the user.

[[Note Name#Heading]]

Links to a specific heading within “Note Name.md”.

[[Note Name#^block-id]]

Links to a specific block within “Note Name.md”. Block references start with ^ after the # symbol.

[[Note Name#Section|Display Text]]

Links to a heading within a note, but displays custom text.

![[Note Name]]

Embeds (transcludes) the content of another note at the current location.

![[Note Name#Heading]]

Embeds only the content under a specific heading.

![[Note Name#^block-id]]

Embeds a specific block identified by its block ID.

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.md

The parser (crates/crucible-core/src/parser/wikilinks.rs) uses a regex to extract wikilinks:

Regex::new(r"(!?)\[\[([^\]]+)\]\]")

The content inside brackets is parsed in the following order:

  1. Alias separation: Split on |(target_part, alias)
  2. Reference extraction: Split target_part on #(target, ref_part)
  3. Reference type detection: If ref_part starts with ^: Block reference, otherwise: Heading reference

Wikilinks inside code blocks are not parsed.

At query time, the storage layer resolves wikilinks:

  1. Exact match: Search for note with exact title match
  2. Path match: Search for note at exact path
  3. Fuzzy match: Search for notes with similar names

Wikilinks support various special characters in note names:

[[note-with-dashes]]
[[note_with_underscores]]
[[note with spaces]]
[[note.with.dots]]
[[]]

Empty wikilinks are parsed but may be ignored.

[[broken

Unclosed wikilinks are not parsed.

Multiple links: [[first]] and [[second]] and [[third]]

All wikilinks on the same line are parsed independently.

There is no escape mechanism for wikilink syntax. If you need to display literal [[ and ]]:

  1. Use inline code: `[[not a link]]`
  2. Use HTML entities: [[not a link]]
  3. Place in a code block

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

  • :h frontmatter - YAML metadata format
  • :h tags - Tag system and nested tags
  • :h block-references - Block ID syntax and usage