Closed mkrcah closed 3 years ago
What does the import for remarkWikiLink
look like? Note that if you're importing like:
const remarkWikiLink = require('remark-wiki-link');
You need to pass remarkWikiLink.wikiLinkPlugin
:
console.log(
unified()
.use(remarkParse)
.use(remarkGfm)
.use(remarkWikiLink.wikiLinkPlugin) // <--
.use(remarkRehype)
.use(rehypeStringify)
.processSync("[[Test page]]").contents
)
Maybe that's your problem? If so, I might just change the import so it exports a default. I didn't because rollup was giving me a warning, but it seems too confusing right now.
Thanks for the quick reply. Yes, the import was indeed the problem. This fixed the issue and now it's working:
import { wikiLinkPlugin } from "remark-wiki-link"
I've noticed that unified plugins I have in the current app all using the default export:
import rehypeReact from "rehype-react"
import remarkParse from "remark-parse"
import remarkRehype from "remark-rehype"
import rehypeRaw from "rehype-raw"
import remarkGfm from "remark-gfm"
import rehypeAddClasses from "rehype-add-classes"
import remarkStringify from "remark-stringify"
import rehypeStringify from "rehype-stringify"
import remarkUnlink from "remark-unlink"
import { wikiLinkPlugin } from "remark-wiki-link"
Only the wiki-link-plug does not. Could be an opportunity to make things consistent.
BTW, cool plugin and thanks a lot for the maintenance :) I can now use Obsidian with Wiki-links to edit Markdown blog posts powered by Next.js 🔥
I'll change the import to have a default since it's what everyone expects. I opened https://github.com/landakram/remark-wiki-link/issues/12 to track.
Glad you got it working and that it's helpful for your use-case 🙂 Obsidian is great software, and I love the idea of making wiki-like knowledge graphs public. Closing this one, but do let me know if you run into any other issues.
Code:
Versions (I'm on remark 13, using wiki-link v1):
outputs
What am I missing? Thx