mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Add support for pandoc-style YAML front matter fences ---/... (fixes #153).
This commit is contained in:
parent
61d6311a3e
commit
df2507f030
4 changed files with 13 additions and 2 deletions
|
@ -342,7 +342,7 @@ ignores common forms of "front matter". To match differently, specify a custom
|
||||||
The default value:
|
The default value:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
/^(---|\+\+\+)$[^]*?^\1$(\r\n|\r|\n)/m
|
/((^---$[^]*?^---$)|(^\+\+\+$[^]*?^(\+\+\+|\.\.\.)$))(\r\n|\r|\n|$)/m
|
||||||
```
|
```
|
||||||
|
|
||||||
Ignores [YAML](https://en.wikipedia.org/wiki/YAML) and
|
Ignores [YAML](https://en.wikipedia.org/wiki/YAML) and
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
module.exports.newLineRe = /\r[\n\u0085]?|[\n\u2424\u2028\u0085]/;
|
module.exports.newLineRe = /\r[\n\u0085]?|[\n\u2424\u2028\u0085]/;
|
||||||
|
|
||||||
// Regular expression for matching common front matter (YAML and TOML)
|
// 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
|
// Regular expression for matching inline disable/enable comments
|
||||||
const inlineCommentRe =
|
const inlineCommentRe =
|
||||||
|
|
4
test/front-matter-title-pandoc.json
Normal file
4
test/front-matter-title-pandoc.json
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"default": true,
|
||||||
|
"MD041": true
|
||||||
|
}
|
6
test/front-matter-title-pandoc.md
Normal file
6
test/front-matter-title-pandoc.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
+++
|
||||||
|
title: "Welcome to pandoc!"
|
||||||
|
date: 2015-11-17 16:16:01 -0600
|
||||||
|
...
|
||||||
|
|
||||||
|
Some plain text here.
|
Loading…
Add table
Add a link
Reference in a new issue