hexo-obsidian-link-converter
v0.1.5
Published
Convert Obsidian-style wiki links ([[...]]) to Hexo permanent links based on abbrlink.
Downloads
521
Maintainers
Readme
hexo-obsidian-link-converter
Convert Obsidian-style bidirectional links ([[...]]) into Hexo permanent links (based on the article’s abbrlink in front matter).
Features
- Supports enabling/disabling the plugin via the
enableswitch (compatible with the misspellingenbale) - Converts
[[Title]]→[Title](/posts/<abbrlink>) - Supports
[[Title|Alias]] - Supports
[[Title#Anchor]]and[[Title#Anchor|Alias]] - Configurable domain prefix for generating absolute URLs
- Converts during the
before_post_renderstage and only modifies compiled content without changing the source Markdown files - Does not replace
[[...]]inside fenced code blocks or inline code - Built-in automated tests (
npm test)
Installation
Install in the Hexo root directory (for local development, you can use npm link or the file: method).
npm install hexo-obsidian-link-converterConfiguration
Add the following to your Hexo _config.yml:
obsidian_link_converter:
# Optional: whether to enable the plugin (default: true)
# Compatible with the old misspelling "enbale"
enable: true
# Optional: output absolute URLs if configured
# Example: https://example.com/blog
domain_prefix: ""
# Optional: enable debug logging
debug: falseMatching Rules
- Target article matching priority:
title→slug - Conversion only occurs if the target article contains
abbrlink - If no target is found, the original
[[...]]is preserved
Output Examples
Assume the article Hello Hexo has abbrlink: abcd1234
[[Hello Hexo]]→[Hello Hexo](/posts/abcd1234)[[Hello Hexo|Click Me]]→[Click Me](/posts/abcd1234)[[Hello Hexo#Section A]]→[Hello Hexo](/posts/abcd1234#Section%20A)
If domain_prefix: https://example.com
[[Hello Hexo]]→[Hello Hexo](https://example.com/posts/abcd1234)
