mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
Update MD018/MD019/MD020/MD021 to look specifically for "space" characters (space or tab) instead of RegExp's "\s" characters per CommonMark specification (fixes #367).
This commit is contained in:
parent
d2d4b310b9
commit
5aef3a4a51
6 changed files with 50 additions and 8 deletions
|
|
@ -12,7 +12,7 @@ module.exports = {
|
|||
"function": function MD018(params, onError) {
|
||||
forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
|
||||
if (!inCode &&
|
||||
/^#+[^#\s]/.test(line) &&
|
||||
/^#+[^# \t]/.test(line) &&
|
||||
!/#\s*$/.test(line) &&
|
||||
!line.startsWith("#️⃣")) {
|
||||
const hashCount = /^#+/.exec(line)[0].length;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ module.exports = {
|
|||
filterTokens(params, "heading_open", (token) => {
|
||||
if (headingStyleFor(token) === "atx") {
|
||||
const { line, lineNumber } = token;
|
||||
const match = /^(#+)(\s{2,})(?:\S)/.exec(line);
|
||||
const match = /^(#+)([ \t]{2,})(?:\S)/.exec(line);
|
||||
if (match) {
|
||||
const [
|
||||
,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ module.exports = {
|
|||
forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
|
||||
if (!inCode) {
|
||||
const match =
|
||||
/^(#+)(\s*)([^#]*?[^#\\])(\s*)((?:\\#)?)(#+)(\s*)$/.exec(line);
|
||||
/^(#+)([ \t]*)([^#]*?[^#\\])([ \t]*)((?:\\#)?)(#+)(\s*)$/.exec(line);
|
||||
if (match) {
|
||||
const [
|
||||
,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ module.exports = {
|
|||
filterTokens(params, "heading_open", (token) => {
|
||||
if (headingStyleFor(token) === "atx_closed") {
|
||||
const { line, lineNumber } = token;
|
||||
const match = /^(#+)(\s+)([^#]+?)(\s+)(#+)(\s*)$/.exec(line);
|
||||
const match = /^(#+)([ \t]+)([^#]+?)([ \t]+)(#+)(\s*)$/.exec(line);
|
||||
if (match) {
|
||||
const [
|
||||
,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue