remark-wiki-link-plus
remark-wiki-link-plus copied to clipboard
Feature: Support for markdown -> markdown remark usage (emit [text](url) / )
Summary
- Today the plugin is excellent for Markdown→HTML pipelines (Remark → Rehype → HTML).
- However, when using a Markdown→Markdown pipeline (Remark → remark-stringify), wikilinks are re-emitted as
[[...]]instead of standard Markdown links/images. - Note: there is also a small serialization quirk: an empty alias results in a trailing
|(e.g.,[[Page|]]).
Motivation / Use cases
- Static-site workflows that want to stay in Markdown space (e.g., generate MD/MDX for Docusaurus or other toolchains) and let another compiler do the HTML step.
- Linting/formatting or content export scenarios where standard link syntax is required downstream.
- Uniform link resolution (aliases, fragments, shortest permalinks) without committing to the Rehype stage.
Example
const transformed = await unified()
.use(remarkParse)
.use(wikiLinkPlugin, {
aliasDivider: "|",
format: "regular",
// no urlResolver provided in this minimal case
})
.use(remarkStringify)
.process("> [[How to Get Started in Under 2 Minutes]]");
// Observed output:
// > [[How to Get Started in Under 2 Minutes|]]
Implementation options
- You could add a toMarkdown extension export (
.use(remarkStringify, extensions: [wikiLinkToMarkdown({ mode: "standard" })]});) - add an inline transform flag (
use(wikiLink, { ..., stringify: "standard" | "wikilink" });)
@z2k-gwp good suggestion.