Skip to content

Commit b4044c3

Browse files
committed
Pass a vfile to the transformer
It’s not used by remark-mermaidjs (yet), but unified plugins do expect it.
1 parent ca0c9f2 commit b4044c3

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
module.exports = async ({ markdownAST }, options) => {
1+
module.exports = async ({ markdownAST, markdownNode }, options) => {
2+
const { VFile } = await import('vfile')
23
const { default: plugin } = await import('remark-mermaidjs')
4+
5+
const vfile = new VFile({
6+
value: markdownNode.rawMarkdownBody,
7+
path: markdownNode.fileAbsolutePath
8+
})
39
const transformer = plugin(options)
4-
return transformer(markdownAST)
10+
return transformer(markdownAST, vfile)
511
}

package-lock.json

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"diagram"
2828
],
2929
"dependencies": {
30-
"remark-mermaidjs": "^4.0.0"
30+
"remark-mermaidjs": "^4.0.0",
31+
"vfile": "^5.0.0"
3132
},
3233
"devDependencies": {
3334
"prettier": "^2.0.0"

0 commit comments

Comments
 (0)