@bettercms-ai/richtext 0.17.0 → 0.17.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/toc.ts +7 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bettercms-ai/richtext",
3
- "version": "0.17.0",
3
+ "version": "0.17.1",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "The one Portable Text contract for BetterCMS: schema, converters, and rendering. Shared by the backend, the dashboard and every delivery SDK.",
package/src/toc.ts CHANGED
@@ -27,8 +27,13 @@ export interface OutlineItem {
27
27
  const isRecord = (v: unknown): v is Record<string, unknown> =>
28
28
  !!v && typeof v === "object" && !Array.isArray(v);
29
29
 
30
- /** A heading id kept from an imported page: a plain HTML id a link can name (`#…`) without escaping. */
31
- export const isHeadingAnchor = (v: unknown): v is string => typeof v === "string" && /^[A-Za-z0-9][A-Za-z0-9_:.-]{0,127}$/.test(v);
30
+ /**
31
+ * A heading id kept from an imported page: a plain HTML id a link can name (`#…`). Letters of any
32
+ * script, as a slugger writes them (`un-héritage-dinnovation`, `快速开始`): an ASCII-only test threw
33
+ * those away and the write made a new id the page's own links never named (screw-fast-two #12).
34
+ * Still no space, quote or markup character, so it is safe in an `id` attribute as it stands.
35
+ */
36
+ export const isHeadingAnchor = (v: unknown): v is string => typeof v === "string" && /^[\p{L}\p{N}][\p{L}\p{N}\p{M}_:.-]{0,127}$/u.test(v);
32
37
 
33
38
  /** Does this value hold a heading anchor? A comparison reads the page with anchors only when it does (ingest `headingAnchors`). */
34
39
  export const hasHeadingAnchors = (value: unknown): boolean =>