mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00:13 +01:00
Fix issue where escaped trailing hash on header caused MD003 due to incorrect classification.
This commit is contained in:
parent
f77b7ae4ec
commit
017fe127fa
3 changed files with 26 additions and 3 deletions
|
|
@ -108,7 +108,7 @@ module.exports.indentFor = indentFor;
|
||||||
// Returns the heading style for a heading token
|
// Returns the heading style for a heading token
|
||||||
module.exports.headingStyleFor = function headingStyleFor(token) {
|
module.exports.headingStyleFor = function headingStyleFor(token) {
|
||||||
if ((token.map[1] - token.map[0]) === 1) {
|
if ((token.map[1] - token.map[0]) === 1) {
|
||||||
if (/#\s*$/.test(token.line)) {
|
if (/[^\\]#\s*$/.test(token.line)) {
|
||||||
return "atx_closed";
|
return "atx_closed";
|
||||||
}
|
}
|
||||||
return "atx";
|
return "atx";
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,8 @@
|
||||||
|
|
||||||
## Heading 7 {MD021} ##
|
## Heading 7 {MD021} ##
|
||||||
|
|
||||||
## Heading 8 \#
|
## Heading 8 {MD003}\#
|
||||||
|
|
||||||
## Heading 9 \#
|
## Heading 9 {MD003} \#
|
||||||
|
|
||||||
|
## Heading 10 {MD003} \#
|
||||||
|
|
|
||||||
21
test/md003-escaped-trailing-hash.md
Normal file
21
test/md003-escaped-trailing-hash.md
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Heading
|
||||||
|
|
||||||
|
## Heading with trailing hash \#
|
||||||
|
|
||||||
|
## Heading with trailing hash no space\#
|
||||||
|
|
||||||
|
### Heading with trailing hash \#\#
|
||||||
|
|
||||||
|
### Heading with trailing hash no space\#\#
|
||||||
|
|
||||||
|
### Heading with trailing hash #\#
|
||||||
|
|
||||||
|
### Heading with trailing hash no space#\#
|
||||||
|
|
||||||
|
### Heading with trailing hash {MD003} ##
|
||||||
|
|
||||||
|
### Heading with trailing hash no space{MD003}{MD020}##
|
||||||
|
|
||||||
|
### Heading with trailing hash {MD003}{MD020} \##
|
||||||
|
|
||||||
|
### Heading with trailing hash no space{MD003}{MD020}\##
|
||||||
Loading…
Add table
Add a link
Reference in a new issue