mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
Ignore TOML front matter in addition to YAML (fixes #63).
This commit is contained in:
parent
0e8cb8f0dd
commit
5bea80f5cd
9 changed files with 38 additions and 8 deletions
10
README.md
10
README.md
|
|
@ -301,15 +301,13 @@ Some Markdown content begins with metadata; the default `RegExp` for this option
|
|||
ignores common forms of "front matter". To match differently, specify a custom
|
||||
`RegExp` or use the value `null` to disable the feature.
|
||||
|
||||
Note: Matches must occur at the start of the file.
|
||||
|
||||
Default:
|
||||
The default value:
|
||||
|
||||
```js
|
||||
/^---$[^]*?^---$(\r\n|\r|\n)/m
|
||||
/^(---|\+\+\+)$[^]*?^\1$(\r\n|\r|\n)/m
|
||||
```
|
||||
|
||||
Ignores:
|
||||
Ignores [YAML](https://en.wikipedia.org/wiki/YAML) and [TOML](https://en.wikipedia.org/wiki/TOML) such as:
|
||||
|
||||
```text
|
||||
---
|
||||
|
|
@ -318,6 +316,8 @@ title: Title
|
|||
---
|
||||
```
|
||||
|
||||
Note: Matches must occur at the start of the file.
|
||||
|
||||
##### options.noInlineConfig
|
||||
|
||||
Type: `Boolean`
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
// Regular expression for matching common newline characters
|
||||
module.exports.newLineRe = /\r\n|\r|\n/;
|
||||
|
||||
// Regular expression for matching common front matter
|
||||
module.exports.frontMatterRe = /^---$[^]*?^---$(\r\n|\r|\n)/m;
|
||||
// Regular expression for matching common front matter (YAML and TOML)
|
||||
module.exports.frontMatterRe = /^(---|\+\+\+)$[^]*?^\1$(\r\n|\r|\n)/m;
|
||||
|
||||
// Regular expression for matching inline disable/enable comments
|
||||
module.exports.inlineCommentRe =
|
||||
|
|
|
|||
4
test/front-matter-empty.json
Normal file
4
test/front-matter-empty.json
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"default": true,
|
||||
"MD041": true
|
||||
}
|
||||
4
test/front-matter.json
Normal file
4
test/front-matter.json
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"default": true,
|
||||
"MD041": true
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
front: matter
|
||||
---
|
||||
|
||||
# Header 1
|
||||
|
||||
## Header 2
|
||||
|
|
|
|||
4
test/hugo-quickstart-example-clean.json
Normal file
4
test/hugo-quickstart-example-clean.json
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"default": true,
|
||||
"MD041": true
|
||||
}
|
||||
7
test/hugo-quickstart-example-clean.md
Normal file
7
test/hugo-quickstart-example-clean.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
+++
|
||||
date = "2016-02-14T16:11:58+05:30"
|
||||
draft = true
|
||||
title = "Good to Great Book Review"
|
||||
|
||||
+++
|
||||
# Header 1
|
||||
4
test/hugo-quickstart-example-issue.json
Normal file
4
test/hugo-quickstart-example-issue.json
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"default": true,
|
||||
"MD041": true
|
||||
}
|
||||
8
test/hugo-quickstart-example-issue.md
Normal file
8
test/hugo-quickstart-example-issue.md
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
+++
|
||||
date = "2016-02-14T16:11:58+05:30"
|
||||
draft = true
|
||||
title = "Good to Great Book Review"
|
||||
|
||||
+++
|
||||
|
||||
# Header 1 {MD041}
|
||||
Loading…
Add table
Add a link
Reference in a new issue