Fix issue where escaped trailing hash on header caused MD003 due to incorrect classification.

This commit is contained in:
David Anson 2018-04-28 14:49:31 -07:00
parent f77b7ae4ec
commit 017fe127fa
3 changed files with 26 additions and 3 deletions

View file

@ -108,7 +108,7 @@ module.exports.indentFor = indentFor;
// Returns the heading style for a heading token
module.exports.headingStyleFor = function headingStyleFor(token) {
if ((token.map[1] - token.map[0]) === 1) {
if (/#\s*$/.test(token.line)) {
if (/[^\\]#\s*$/.test(token.line)) {
return "atx_closed";
}
return "atx";

View file

@ -12,6 +12,8 @@
## Heading 7 {MD021} ##
## Heading 8 \#
## Heading 8 {MD003}\#
## Heading 9 \#
## Heading 9 {MD003} \#
## Heading 10 {MD003} \#

View 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}\##