eslint-plugin-markdown-preferences 0.40.0 → 0.40.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -645,7 +645,7 @@ declare namespace meta_d_exports {
645
645
  export { name, version };
646
646
  }
647
647
  declare const name: "eslint-plugin-markdown-preferences";
648
- declare const version: "0.40.0";
648
+ declare const version: "0.40.2";
649
649
  //#endregion
650
650
  //#region src/language/ast-types.d.ts
651
651
  type Node = mdast.Node;
package/lib/index.js CHANGED
@@ -4570,12 +4570,12 @@ var PreserveWordsContext = class {
4570
4570
  if (firstLowerWord !== phrase[0].toLowerCase()) continue;
4571
4571
  while (subWords.length < phrase.length) {
4572
4572
  const word = words.next();
4573
- if (word.done) return null;
4573
+ if (word.done) break;
4574
4574
  subWords.push(word.value);
4575
4575
  }
4576
- if (subWords.every((word, i) => word.toLowerCase() === phrase[i].toLowerCase())) {
4576
+ if (subWords.length >= phrase.length && phrase.every((word, i) => subWords[i].toLowerCase() === word.toLowerCase())) {
4577
4577
  let matchCount = 0;
4578
- for (let i = 0; i < subWords.length; i++) if (subWords[i] === phrase[i]) matchCount++;
4578
+ for (let i = 0; i < phrase.length; i++) if (subWords[i] === phrase[i]) matchCount++;
4579
4579
  if (!returnCandidate || matchCount > returnCandidate.matchCount) returnCandidate = {
4580
4580
  preservePhrase: phrase,
4581
4581
  matchCount
@@ -7987,6 +7987,13 @@ var no_heading_trailing_punctuation_default = createRule("no-heading-trailing-pu
7987
7987
  const sourceCode = context.sourceCode;
7988
7988
  const segmenter$1 = new Intl.Segmenter("en", { granularity: "grapheme" });
7989
7989
  const punctuationMap = buildPunctuationMap(context.options[0]?.punctuation, segmenter$1);
7990
+ const contentNodeTypes = new Set([
7991
+ "inlineCode",
7992
+ "image",
7993
+ "imageReference",
7994
+ "html",
7995
+ "inlineMath"
7996
+ ]);
7990
7997
  return { heading(node) {
7991
7998
  if (!node.children.length) return;
7992
7999
  const punctuationChars = punctuationMap[node.depth];
@@ -8030,6 +8037,7 @@ var no_heading_trailing_punctuation_default = createRule("no-heading-trailing-pu
8030
8037
  if (child.value.trim()) return child;
8031
8038
  continue;
8032
8039
  }
8040
+ if (contentNodeTypes.has(child.type)) return null;
8033
8041
  if ("children" in child && Array.isArray(child.children)) {
8034
8042
  const nestedLast = findLastTextNode(child.children);
8035
8043
  if (nestedLast) return nestedLast;
@@ -9134,7 +9142,7 @@ var no_trailing_spaces_default = createRule("no-trailing-spaces", {
9134
9142
  }
9135
9143
  });
9136
9144
  },
9137
- "code, inlineCode, text, yaml, toml, json"(node) {
9145
+ "code, inlineCode, yaml, toml, json"(node) {
9138
9146
  ignoreNodes.push(node);
9139
9147
  },
9140
9148
  "root:exit"() {
@@ -12754,7 +12762,7 @@ var meta_exports = /* @__PURE__ */ __export({
12754
12762
  version: () => version
12755
12763
  });
12756
12764
  const name = "eslint-plugin-markdown-preferences";
12757
- const version = "0.40.0";
12765
+ const version = "0.40.2";
12758
12766
 
12759
12767
  //#endregion
12760
12768
  //#region src/language/extensions/micromark-custom-container.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-markdown-preferences",
3
- "version": "0.40.0",
3
+ "version": "0.40.2",
4
4
  "description": "ESLint plugin that enforces our markdown preferences",
5
5
  "type": "module",
6
6
  "exports": {