morlay / gitbook-plugin-mermaid-2

14 stars 41 forks source link

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

Open ElsewhereGames opened 8 years ago

ElsewhereGames commented 8 years ago

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).

devdigital commented 8 years ago

Any update on this?

morlay commented 8 years ago

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

devdigital commented 8 years ago

@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.