markdown-it-plantuml
markdown-it-plantuml copied to clipboard
Handling multi-line closeMarker
What I want to do is like following:
const MarkdownIt = require('markdown-it')
const md = new MarkdownIt()
md.use(require('markdown-it-plantuml'), {
openMarker: '```puml\n@startuml',
closeMarker: '@enduml\n```'
})
md.render(`\`\`\`puml
@startuml
Bob -> Alice : hello
@enduml
\`\`\``)
Because Previewing markdown on vscode needs the plantuml description to be enclosed with ```puml and ```.
When running the above sample, markdown-it-plantuml can find openMarker and closeMarker, but fails in moving the cursor after closing.
The simple solution is to rewrite index.js as follows, which will work as expected for me, but I'm not sure if it's the proper way.
135c135
< state.line = nextLine + (autoClosed ? 1 : 0);
---
> state.line = nextLine + (autoClosed ? 1 + closeMarker.match(/\n/g).length : 0);
This would come in handy while using this plugin with Vuepress
or similar.