mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-02 12:47:41 +02:00
30 lines
729 B
JavaScript
30 lines
729 B
JavaScript
const { shim } = require('lib/shim');
|
|
|
|
class MdToHtml_Mermaid {
|
|
|
|
name() {
|
|
return 'mermaid';
|
|
}
|
|
|
|
processContent(renderedTokens, content, tagType) {
|
|
renderedTokens.push('<div class="mermaid">' + content + '</div>');
|
|
return renderedTokens;
|
|
}
|
|
|
|
extraCss() {
|
|
// Force a white background because the graphs can have various colours
|
|
// that may not be compatible with the current theme. Also make it
|
|
// inline-block so that the div is the same size as the content.
|
|
return '.mermaid { background-color: white; display:inline-block; }';
|
|
}
|
|
|
|
injectedJavaScript() {
|
|
const js = shim.injectedJs('mermaid');
|
|
return js ? js + '\n' + 'mermaid.init();' : '';
|
|
}
|
|
|
|
async loadAssets() {}
|
|
|
|
}
|
|
|
|
module.exports = MdToHtml_Mermaid; |