mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
Support 1-3 spaces prefixing a code fence per specification (fixes #107).
This commit is contained in:
parent
40ace5bb5e
commit
89e12b90e0
3 changed files with 46 additions and 1 deletions
|
|
@ -141,7 +141,7 @@ function makeTokenCache(params) {
|
||||||
// Find fenced code by pattern (parser ignores "``` close fence")
|
// Find fenced code by pattern (parser ignores "``` close fence")
|
||||||
params.lines.forEach(function forLine(line, lineIndex) {
|
params.lines.forEach(function forLine(line, lineIndex) {
|
||||||
var metadata = 0;
|
var metadata = 0;
|
||||||
var match = /^(`{3,}|~{3,})/.exec(line);
|
var match = /^[ ]{0,3}(`{3,}|~{3,})/.exec(line);
|
||||||
var fence = match && match[1];
|
var fence = match && match[1];
|
||||||
if (fence &&
|
if (fence &&
|
||||||
(!inFence || (fence.substr(0, fenceStart.length) === fenceStart))) {
|
(!inFence || (fence.substr(0, fenceStart.length) === fenceStart))) {
|
||||||
|
|
|
||||||
6
test/code-blocks-prefixed-by-spaces.json
Normal file
6
test/code-blocks-prefixed-by-spaces.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"default": true,
|
||||||
|
"MD013": {
|
||||||
|
"code_blocks": false
|
||||||
|
}
|
||||||
|
}
|
||||||
39
test/code-blocks-prefixed-by-spaces.md
Normal file
39
test/code-blocks-prefixed-by-spaces.md
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
# md013-code-blocks-spaces
|
||||||
|
|
||||||
|
Text text text text text text text text text text text text text text text text text text. {MD013}
|
||||||
|
|
||||||
|
```text
|
||||||
|
Text text text text text text text text text text text text text text text text text text.
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
Text text text text text text text text text text text text text text text text text text.
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
Text text text text text text text text text text text text text text text text text text.
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
Text text text text text text text text text text text text text text text text text text.
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
Text text text text text text text text text text text text text text text text text text.
|
||||||
|
```
|
||||||
|
|
||||||
|
Text text text text text text text text text text text text text text text text text text. {MD013}
|
||||||
|
|
||||||
|
```text
|
||||||
|
Text text text text text text text text text text text text text text text text text text.
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
Text text text text text text text text text text text text text text text text text text.
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
Text text text text text text text text text text text text text text text text text text.
|
||||||
|
```
|
||||||
|
|
||||||
|
Text text text text text text text text text text text text text text text text text text. {MD013}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue