Update MD018/no-missing-space-atx to ignore Keycap Number Sign emoji at start of line (fixes #257).

This commit is contained in:
David Anson 2020-03-08 19:49:52 -07:00
parent 67d1476ed8
commit b87094e33d
2 changed files with 27 additions and 1 deletions

View file

@ -11,7 +11,10 @@ module.exports = {
"tags": [ "headings", "headers", "atx", "spaces" ], "tags": [ "headings", "headers", "atx", "spaces" ],
"function": function MD018(params, onError) { "function": function MD018(params, onError) {
forEachLine(lineMetadata(), (line, lineIndex, inCode) => { forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
if (!inCode && /^#+[^#\s]/.test(line) && !/#\s*$/.test(line)) { if (!inCode &&
/^#+[^#\s]/.test(line) &&
!/#\s*$/.test(line) &&
!line.startsWith("#️⃣")) {
const hashCount = /^#+/.exec(line)[0].length; const hashCount = /^#+/.exec(line)[0].length;
addErrorContext( addErrorContext(
onError, onError,

23
test/emoji-headings.md Normal file
View file

@ -0,0 +1,23 @@
# Emoji Headings
#⃣ Keycap Number Sign
<https://emojipedia.org/keycap-number-sign/>
# #⃣ Keycap Number Sign
Text
##⃣ Keycap Number Sign {MD018}
Text
# Keycap Number Sign #
Text
# Keycap Number Sign#
Text
<!-- markdownlint-disable-file MD025 -->