@heroiclands/package-build 24.0.4 → 24.1.0

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.
@@ -53,7 +53,8 @@ export function spanMarkdownPlugin(md, { spoilers = false, source = false } = {}
53
53
  /@[A-Za-z]+$/.test(state.src.slice(0, start)) ||
54
54
  state.src[start + 1] === "^" ||
55
55
  state.src[start + 1] === "!" ||
56
- ["!", "[", "]"].includes(state.src[start - 1])
56
+ ["!", "]"].includes(state.src[start - 1]) ||
57
+ (state.src[start - 1] === "[" && state.linkLevel === 0)
57
58
  )
58
59
  return false;
59
60
  const end = state.md.helpers.parseLinkLabel(state, start, false);
@@ -91,6 +92,17 @@ export function spanMarkdownPlugin(md, { spoilers = false, source = false } = {}
91
92
  finish = close + 1;
92
93
  }
93
94
  }
95
+ // A generated book link may put its language/script span directly
96
+ // inside the label. Preserve the literal class-only bracket spelling
97
+ // there for ordinary spans, including names used by the first-use audit.
98
+ if (
99
+ state.src[start - 1] === "[" &&
100
+ !["lang", "font", "map"].some((key) => Object.hasOwn(parsed.values, key)) &&
101
+ !parsed.classes.some(
102
+ (name) => name === "script" || /^font-(?:mono|serif|sans)$/.test(name),
103
+ )
104
+ )
105
+ return false;
94
106
  const problems = [...parsed.problems, ...refusedAttributes(parsed.values)];
95
107
  if (parsed.classes.includes("glyph")) problems.push(...glyphProblems(parsed));
96
108
  else if (parsed.classes.includes("cartouche")) problems.push(...cartoucheProblems(parsed));