Skip to content

Commit

Permalink
Exclude mermaid block
Browse files Browse the repository at this point in the history
  • Loading branch information
kudoh committed Feb 17, 2022
1 parent 23ae649 commit abbed39
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ const defaultRendererOptions = {
function renderCode(origRule, rendererOptions) {
return (tokens, idx, options, env, self) => {
const origRendered = origRule(tokens, idx, options, env, self);
if (tokens[idx].tag === 'code' && !tokens[idx].info) {
if (tokens[idx].tag !== 'code') {
return origRendered;
}
if (!tokens[idx].info || tokens[idx].info === 'mermaid') {
return origRendered;
}
if (tokens[idx].content.length === 0) {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The plugin consists of the following contents.

`markdown-it custom renderer`

This custom renderer attaches clipboard copy button to code block with language(does nothing for non-language block).
This custom renderer attaches clipboard copy button to code block with language(does nothing for non-language/mermaid block).
Of course, it only supports eleventy markdown template(markdown-it).

The clipboard button is provided by [Material Design Icons](https://materialdesignicons.com/) `content-copy` icon.
Expand Down

0 comments on commit abbed39

Please sign in to comment.