Fix issue in MD020/no-missing-space-closed-atx that reported errors for single-character headers (fixes #229).

This commit is contained in:
David Anson 2019-10-23 19:56:24 -07:00
parent 31ffe52f0f
commit 84b6d935f5
2 changed files with 84 additions and 1 deletions

View file

@ -13,7 +13,7 @@ module.exports = {
forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
if (!inCode) {
const match =
/^(#+)(\s*)([^#]+?[^#\\])(\s*)((?:\\#)?)(#+)(\s*)$/.exec(line);
/^(#+)(\s*)([^#]*?[^#\\])(\s*)((?:\\#)?)(#+)(\s*)$/.exec(line);
if (match) {
const [
,

83
test/short-headings.md Normal file
View file

@ -0,0 +1,83 @@
# Short Headings
<!-- markdownlint-disable single-title heading-style -->
#A
{MD018:5}
# B
# C
{MD019:11}
#D#
{MD020:15}
# E #
# F #
{MD021:21}
##G
{MD018:25}
## H
## I
{MD019:31}
##J##
{MD020:35}
## K ##
## L ##
{MD021:41}
#MM
{MD018:45}
# NN
# OO
{MD019:51}
#PP#
{MD020:55}
# QQ #
# RR #
{MD021:61}
##SS
{MD018:65}
## TT
## UU
{MD019:71}
##VV##
{MD020:75}
## WW ##
## XX ##
{MD021:81}