1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-12-05 22:57:29 +02:00
Files
joplin/ReactNativeClient/lib/MdToHtml_Mermaid.js

30 lines
742 B
JavaScript
Raw Normal View History

2019-02-18 18:11:53 +00:00
const { shim } = require('lib/shim');
const injectedJs = require('lib/rnInjectedJs/mermaid');
2019-02-18 18:11:53 +00:00
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; }';
2019-02-18 18:11:53 +00:00
}
injectedJavaScript() {
return injectedJs + '\n' + 'mermaid.init();';
}
2019-02-18 18:11:53 +00:00
async loadAssets() {}
}
module.exports = MdToHtml_Mermaid;