diff --git a/README.md b/README.md index bb20a92a..1c875ba9 100644 --- a/README.md +++ b/README.md @@ -342,7 +342,7 @@ ignores common forms of "front matter". To match differently, specify a custom The default value: ```js -/^(---|\+\+\+)$[^]*?^\1$(\r\n|\r|\n)/m +/((^---$[^]*?^---$)|(^\+\+\+$[^]*?^(\+\+\+|\.\.\.)$))(\r\n|\r|\n|$)/m ``` Ignores [YAML](https://en.wikipedia.org/wiki/YAML) and diff --git a/lib/shared.js b/lib/shared.js index cec21296..e6f516cb 100644 --- a/lib/shared.js +++ b/lib/shared.js @@ -7,7 +7,8 @@ module.exports.newLineRe = /\r[\n\u0085]?|[\n\u2424\u2028\u0085]/; // Regular expression for matching common front matter (YAML and TOML) -module.exports.frontMatterRe = /^(---|\+\+\+)$[^]*?^\1$(\r\n|\r|\n|$)/m; +module.exports.frontMatterRe = + /((^---$[^]*?^---$)|(^\+\+\+$[^]*?^(\+\+\+|\.\.\.)$))(\r\n|\r|\n|$)/m; // Regular expression for matching inline disable/enable comments const inlineCommentRe = diff --git a/test/front-matter-title-pandoc.json b/test/front-matter-title-pandoc.json new file mode 100644 index 00000000..054e8566 --- /dev/null +++ b/test/front-matter-title-pandoc.json @@ -0,0 +1,4 @@ +{ + "default": true, + "MD041": true +} diff --git a/test/front-matter-title-pandoc.md b/test/front-matter-title-pandoc.md new file mode 100644 index 00000000..469c602b --- /dev/null +++ b/test/front-matter-title-pandoc.md @@ -0,0 +1,6 @@ ++++ +title: "Welcome to pandoc!" +date: 2015-11-17 16:16:01 -0600 +... + +Some plain text here.