Obsidian to MkDocs Converter
Convert Obsidian vault Markdown files to MkDocs Material-compatible format for web deployment.
Quick Start
- •
Run conversion script on source file(s):
bashpython .skills/obsidian-to-mkdocs/scripts/convert_obsidian.py <source.md> --output <dest.md>
- •
Or convert entire directory:
bashpython .skills/obsidian-to-mkdocs/scripts/convert_obsidian.py <source_dir/> --output <docs_dir/> --recursive
Conversion Rules Summary
Block References (Critical)
Keep ^block-id markers in place. The block-links.js script handles them at runtime.
| Obsidian | Behavior |
|---|---|
[[#^abc123]] | Converted by roamlinks plugin to <a href="#abc123"> |
^abc123 | Kept as-is, converted to anchor by JS |
Wiki Links
| Obsidian | MkDocs |
|---|---|
[[Page Name]] | [Page Name](Page%20Name.md) or handled by roamlinks |
[[Page|Display]] | [Display](Page.md) |
[[folder/Page]] | [Page](folder/Page.md) |
[[]] in Code Contexts (Important)
Rule: [[]] inside inline code (`) or fenced code blocks (```) is array/list syntax (e.g. Python/NumPy), NOT wiki-links. Do NOT convert or escape these.
However, the roamlinks plugin may still misparse [[]] inside code blocks and generate warnings. Workaround: insert a zero-width space (\u200b) between [ and [ to break the pattern: [\u200b[1,2,3]]. This is invisible to the reader but prevents RoamLinks from treating it as a wiki-link.
| Context | Example | Action |
|---|---|---|
| Inline code | `np.array([[1,2,3]])` | May need [\u200b[ if RoamLinks warns |
| Fenced code block | ```python\nnp.array([[1,2,3]])\n``` | May need [\u200b[ if RoamLinks warns |
| Regular text | [[Page Name]] | Convert (wiki-link) |
Image Embeds
| Obsidian | MkDocs |
|---|---|
![[image.png]] |  |
![[image.png|300]] | { width="300" } |
Callouts
Handled automatically by mkdocs-callouts plugin. No conversion needed.
> [!NOTE] Title > Content
Workflow
Manual Conversion Steps
- •Copy file to docs/
- •Fix image paths: Move images to
images/subfolder, update references - •Verify links: Ensure internal links point to correct
.mdfiles - •Check front matter: Remove Obsidian-specific fields (
cssclass,aliases) - •Test locally: Run
mkdocs serveto preview
Using Conversion Script
# Single file
python .skills/obsidian-to-mkdocs/scripts/convert_obsidian.py \
"vault/Notes/MyNote.md" \
--output "docs/Notes/MyNote.md"
# Directory (recursive)
python .skills/obsidian-to-mkdocs/scripts/convert_obsidian.py \
"vault/Notes/" \
--output "docs/Notes/" \
--recursive
Post-Conversion Checklist
- • Images copied to correct
images/directories - • Internal links resolve (no 404s)
- • Block references work (click jump + highlight)
- • Code blocks render correctly
- • Callouts display as admonitions
- • Front matter valid YAML
- •
mkdocs buildcompletes without errors
Troubleshooting
Block Links Not Working
- •Ensure
javascripts/block-links.jsis inextra_javascriptinmkdocs.yml - •Verify
^block-idmarkers are preserved in source - •Check browser console for "Block anchors created" log
Broken Wiki Links
- •If using roamlinks plugin, ensure it's enabled
- •For manual conversion, URL-encode spaces:
My File→My%20File
Missing Images
- •Check image path case sensitivity (Linux servers are case-sensitive)
- •Ensure images are in
docs/*/images/not vault's attachment folder
References
For detailed conversion rules: references/conversion-rules.md