From a9c66b3a83f0192a5880a1f2333fc70bbeeba75e Mon Sep 17 00:00:00 2001 From: Edwin Kofler Date: Sun, 1 Oct 2023 23:08:14 -0700 Subject: [PATCH] Fix detection of `Contents` header if it includes an HTML comment (#174) --- rules/list-item.js | 2 +- rules/toc.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rules/list-item.js b/rules/list-item.js index 5a5300a..c47c58d 100644 --- a/rules/list-item.js +++ b/rules/list-item.js @@ -54,7 +54,7 @@ module.exports = rule('remark-lint:awesome-list-item', (ast, file) => { const toc = find(ast, node => ( node.type === 'heading' && node.depth === 2 && - toString(node) === 'Contents' + toString(node).replace(//g, '').trim() === 'Contents' )); if (toc) { diff --git a/rules/toc.js b/rules/toc.js index 5c8b9cc..0f76da1 100644 --- a/rules/toc.js +++ b/rules/toc.js @@ -26,7 +26,7 @@ module.exports = rule('remark-lint:awesome-toc', (ast, file) => { const toc = find(ast, node => ( node.type === 'heading' && node.depth === 2 && - toString(node).trim() === 'Contents' + toString(node).replace(//g, '').trim() === 'Contents' )); if (!toc) {