markdown-it-textual-uml
Version:
Markdown-it markdown parser plugin to create uml diagrams from text, based on plantuml, mermaid, etc.
31 lines (25 loc) • 574 B
JavaScript
const functions = {
options: {},
initialize(options) {
if (options) {
this.options = options
}
},
getMarkup(code) {
let content = removeTripleBackticks(code)
return `<pre class="mermaid">\n${content}\n</pre>\n`
},
}
function removeTripleBackticks(inputString) {
if (inputString.endsWith('```')) {
// Remove the last 3 characters
return inputString.slice(0, -3)
} else {
// String doesn't end with "```", return as is
return inputString
}
}
export default {
functions,
}