mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-17 18:22:33 +00:00
Fix mermaid tag
This commit is contained in:
parent
33723be6ad
commit
10b577cc7f
4
layout/_third-party/tags/mermaid.njk
vendored
4
layout/_third-party/tags/mermaid.njk
vendored
@ -3,13 +3,13 @@
|
||||
<script{{ pjax }}>
|
||||
if (document.querySelectorAll('pre.mermaid').length) {
|
||||
NexT.utils.getScript('{{ url_for(mermaid_uri) }}', () => {
|
||||
mermaid.initialize({
|
||||
mermaid.init({
|
||||
theme : '{{ theme.mermaid.theme }}',
|
||||
logLevel : 3,
|
||||
flowchart: { curve : 'linear' },
|
||||
gantt : { axisFormat: '%m/%d/%Y' },
|
||||
sequence : { actorMargin: 50 }
|
||||
});
|
||||
}, '.mermaid');
|
||||
}, window.mermaid);
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -4,9 +4,11 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const { escapeHTML } = require('hexo-util');
|
||||
|
||||
module.exports = function(args, content) {
|
||||
return `<pre class="mermaid" style="text-align: center;">
|
||||
${args.join(' ')}
|
||||
${content}
|
||||
${escapeHTML(content)}
|
||||
</pre>`;
|
||||
};
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
|
||||
require('chai').should();
|
||||
|
||||
const { escapeHTML } = require('hexo-util');
|
||||
|
||||
const result = `A[Hard] -->|Text| B(Round)
|
||||
B --> C{Decision}
|
||||
C -->|One| D[Result 1]
|
||||
@ -13,7 +15,7 @@ describe('mermaid', () => {
|
||||
it('default', () => {
|
||||
mermaid(['graph', 'TD'], result).should.eql(`<pre class="mermaid" style="text-align: center;">
|
||||
graph TD
|
||||
${result}
|
||||
${escapeHTML(result)}
|
||||
</pre>`);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user