mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-20 19:02:33 +00:00
Fix mermaid background color
This commit is contained in:
parent
8d57b6d980
commit
376d71878f
2
layout/_third-party/tags/mermaid.njk
vendored
2
layout/_third-party/tags/mermaid.njk
vendored
@ -1,6 +1,6 @@
|
|||||||
{%- if theme.mermaid.enable %}
|
{%- if theme.mermaid.enable %}
|
||||||
<script{{ pjax }}>
|
<script{{ pjax }}>
|
||||||
if (document.querySelectorAll('pre.mermaid').length) {
|
if (document.querySelectorAll('.mermaid').length) {
|
||||||
NexT.utils.getScript('{{ theme.vendors.mermaid }}', () => {
|
NexT.utils.getScript('{{ theme.vendors.mermaid }}', () => {
|
||||||
mermaid.init({
|
mermaid.init({
|
||||||
theme : '{{ theme.mermaid.theme }}',
|
theme : '{{ theme.mermaid.theme }}',
|
||||||
|
|||||||
@ -7,8 +7,8 @@
|
|||||||
const { escapeHTML } = require('hexo-util');
|
const { escapeHTML } = require('hexo-util');
|
||||||
|
|
||||||
module.exports = function(args, content) {
|
module.exports = function(args, content) {
|
||||||
return `<pre class="mermaid" style="text-align: center;">
|
return `<div class="mermaid">
|
||||||
${args.join(' ')}
|
${args.join(' ')}
|
||||||
${escapeHTML(content)}
|
${escapeHTML(content)}
|
||||||
</pre>`;
|
</div>`;
|
||||||
};
|
};
|
||||||
|
|||||||
4
source/css/_common/scaffolding/tags/mermaid.styl
Normal file
4
source/css/_common/scaffolding/tags/mermaid.styl
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.mermaid {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
@ -7,3 +7,5 @@
|
|||||||
@import 'note' if (hexo-config('note.style') != 'disabled');
|
@import 'note' if (hexo-config('note.style') != 'disabled');
|
||||||
|
|
||||||
@import 'pdf' if (hexo-config('pdf.enable'));
|
@import 'pdf' if (hexo-config('pdf.enable'));
|
||||||
|
|
||||||
|
@import 'mermaid' if (hexo-config('mermaid.enable'));
|
||||||
|
|||||||
@ -13,9 +13,9 @@ describe('mermaid', () => {
|
|||||||
const mermaid = require('../../scripts/tags/mermaid');
|
const mermaid = require('../../scripts/tags/mermaid');
|
||||||
|
|
||||||
it('default', () => {
|
it('default', () => {
|
||||||
mermaid(['graph', 'TD'], result).should.eql(`<pre class="mermaid" style="text-align: center;">
|
mermaid(['graph', 'TD'], result).should.eql(`<div class="mermaid">
|
||||||
graph TD
|
graph TD
|
||||||
${escapeHTML(result)}
|
${escapeHTML(result)}
|
||||||
</pre>`);
|
</div>`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user