gitbook-plugin-mermaid-2 icon indicating copy to clipboard operation
gitbook-plugin-mermaid-2 copied to clipboard

Code fence reg-ex does not work for CRLF line endings.

Open ElsewhereGames opened this issue 9 years ago • 3 comments

The regular expression used to find the Mermaid code fence in a markdown document does not work if the document uses CRLF line endings (as opposed to just LF).

ElsewhereGames avatar Dec 29 '15 17:12 ElsewhereGames

Any update on this?

devdigital avatar Mar 04 '16 11:03 devdigital

Sorry for replying too late, but I think this issue will be reported on https://github.com/knsv/mermaid

morlay avatar Mar 08 '16 02:03 morlay

@morlay hi, the issue is in the plugin code, not the mermaid library.

In the first line in index.js:

var mermaidRegex = /^```mermaid((.*\n)+?)?```$/im;

This only matches LF line endings. This means if you save your markdown files with CRLF endings, then the plugin does not find the mermaid blocks and therefore they won't be processed.

devdigital avatar Mar 10 '16 11:03 devdigital