Obsidian Markdown
Obsidian-flavored Markdown support: wikilinks, callouts, inline tags, and block references.
Overview
obsidianMarkdown() registers remark transforms that convert Obsidian syntax
during the build. It runs with order: -20 so it processes content before
other Markdown plugins.
Usage
import { defineConfig } from "@riebeckite/core";
import { obsidianMarkdown } from "@riebeckite/plugin-obsidian-markdown";
export default defineConfig({
// ...
plugins: [obsidianMarkdown()],
});
Syntax
Wikilinks
-
[[Note]]→ link to the target's resolved canonical permalink (ContentManifestEntry.permalink) with classwikilink, alias with[[Note|Alias]]. The target is looked up by slug; thehrefis the resolved permalink -
Fragments:
[[Note#Heading]]→#heading-slug,[[Note#^block-id]]→#block-id -
![[Note]]→ note embed. The core pipeline renders the target note recursively (max depth 3, cycle-safe). Unresolved embeds render a placeholder link or text ![[image.png]]→<img>underassetBase[[image.png]]→ link to the asset URL-
[[file.pdf]]/![[file.pdf]]→ rendered by a plugin that providesrenderAttachment(see@riebeckite/plugin-attachment), otherwise a plain download link - Unresolvable targets → link with class
wikilink wikilink-broken
Callouts
> [!note] Optional title
> Callout content.
> [!warning]- Collapsed by default
> More content.
Output: div.rr-callout.rr-callout--{type} with data-callout, plus
rr-callout--collapsible / rr-callout--collapsed for + / - markers. Titles fall back to
built-in defaults (note, tip, warning, danger, bug, quote, ...).
Inline tags
-
#tag,#nested/tag→ link to{tagBase}{slugified tag}with classtaganddata-tag - Purely numeric tags are ignored; trailing
/and-are stripped - Each tag also triggers the optional
onTagcallback
Block references
-
A trailing
^block-idon a block is removed from the text and applied to the element asidanddata-block-id
Options
| Option | Type | Default | Description |
|---|---|---|---|
assetBase |
string |
"/" |
Base path for image wikilink URLs |
callout.defaultTitles |
Record<string, string> |
built-in map | Override default callout titles |
tag.tagBase |
string |
"/tags/" |
Tag page base path |
tag.onTag |
(tag: string) => void |
— | Called for every tag found |
Exports
obsidianMarkdown(options?)/obsidianMarkdownPlugin— plugin factory-
Types:
ObsidianMarkdownOptions,CalloutOptions,TagOptions,WikilinkOptions,WikilinkFragment