An open source design system that's fully customizable and agent ready
TypeScript
feat(Markdown): render heading permalinks (#6915)
Cindy Zhangbfea28bb45d3
diff --git a/.changeset/markdown-heading-permalinks.md b/.changeset/markdown-heading-permalinks.mdindex 987da1deeb..290480fabf 100644--- a/.changeset/markdown-heading-permalinks.md+++ b/.changeset/markdown-heading-permalinks.md@@ -2,8 +2,8 @@'@astryxdesign/core': patch----[feat] Add the first-party Markdown heading-links identity module.+[feat] Add the first-party Markdown heading-links module.-`createMarkdownHeadingLinks()` is exported from `@astryxdesign/core/Markdown/plugins` and gives every rendered h1–h6 a deterministic, collision-safe ID after transforms, including headings nested in blockquotes and lists. Its frozen, versioned entry carries the caller namespace across compatible Core package copies without module-local state. The same opaque plugin entry keeps Markdown-derived Outline aligned, supports Unicode NFKC slugs and an optional caller-owned namespace, and leaves default Markdown plus custom heading anatomy unchanged.+`createMarkdownHeadingLinks()` is exported from `@astryxdesign/core/Markdown/plugins` and gives every built-in h1–h6 a collision-safe generated fragment plus an accessible inline trailing `#` copy button, including headings nested in blockquotes and lists. Its frozen, versioned entry carries the namespace and safe URL base across compatible Core package copies without module-local state. The heading row uses `useContainerReveal`: the button is hidden at fine-pointer rest, reveals on row hover or keyboard focus, and follows the canonical coarse/touch behavior. An unmodified tap, click, Enter, or Space copies the canonical URL without navigating, scrolling, or mutating the hash and briefly shows a check confirmation; failures stay silent. The same opaque plugin entry keeps Markdown-derived Outline aligned, supports Unicode NFKC slugs, an optional caller-owned namespace and safe permalink URL base, and leaves default Markdown plus custom heading renderers unchanged.@cixzhang @vjeuxdiff --git a/packages/core/locales/af-ZA.json b/packages/core/locales/af-ZA.jsonindex ff79ebe264..e49b3f46e6 100644--- a/packages/core/locales/af-ZA.json+++ b/packages/core/locales/af-ZA.json@@ -523,6 +523,14 @@"defaultMessage": "Hierdie {itemName} is reeds {boundary, select, first {eerste} last {laaste} other {}}.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "Skakel gekopieer",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "Kopieer skakel na {heading}",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "Taaklys","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/ar-SA.json b/packages/core/locales/ar-SA.jsonindex a217d2a1fe..23ef09e489 100644--- a/packages/core/locales/ar-SA.json+++ b/packages/core/locales/ar-SA.json@@ -523,6 +523,14 @@"defaultMessage": "{itemName} بالفعل {boundary, select, first {في بداية القائمة} last {في نهاية القائمة} other {}}.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "تم نسخ الرابط",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "نسخ الرابط إلى {heading}",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "قائمة المهام","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/ca-ES.json b/packages/core/locales/ca-ES.jsonindex ffd26d061b..0053ffcab7 100644--- a/packages/core/locales/ca-ES.json+++ b/packages/core/locales/ca-ES.json@@ -523,6 +523,14 @@"defaultMessage": "{itemName} ja és {boundary, select, first {a la primera posició} last {a l’última posició} other {}}.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "Enllaç copiat",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "Copia l'enllaç a {heading}",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "Llista de tasques","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/cs-CZ.json b/packages/core/locales/cs-CZ.jsonindex 90e93530be..fba3d9eb34 100644--- a/packages/core/locales/cs-CZ.json+++ b/packages/core/locales/cs-CZ.json@@ -523,6 +523,14 @@"defaultMessage": "{itemName} je již {boundary, select, first {na první pozici} last {na poslední pozici} other {}}.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "Odkaz zkopírován",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "Kopírovat odkaz na {heading}",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "Seznam úkolů","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/da-DK.json b/packages/core/locales/da-DK.jsonindex ad30dbcafb..bbfb4b60c7 100644--- a/packages/core/locales/da-DK.json+++ b/packages/core/locales/da-DK.json@@ -523,6 +523,14 @@"defaultMessage": "{itemName} er allerede {boundary, select, first {først} last {sidst} other {}}.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "Link kopieret",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "Kopiér link til {heading}",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "Opgaveliste","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/de-DE.json b/packages/core/locales/de-DE.jsonindex 856c3516f9..92e85ab4ef 100644--- a/packages/core/locales/de-DE.json+++ b/packages/core/locales/de-DE.json@@ -523,6 +523,14 @@"defaultMessage": "{itemName} steht bereits {boundary, select, first {an erster Stelle} last {an letzter Stelle} other {}}.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "Link kopiert",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "Link zu {heading} kopieren",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "Aufgabenliste","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/el-GR.json b/packages/core/locales/el-GR.jsonindex 2f634df0cc..96fad467b3 100644--- a/packages/core/locales/el-GR.json+++ b/packages/core/locales/el-GR.json@@ -523,6 +523,14 @@"defaultMessage": "{itemName}: βρίσκεται ήδη {boundary, select, first {στην πρώτη θέση} last {στην τελευταία θέση} other {}}.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "Ο σύνδεσμος αντιγράφηκε",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "Αντιγραφή συνδέσμου προς {heading}",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "Λίστα εργασιών","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/en.json b/packages/core/locales/en.jsonindex 77d272107e..47f6838e40 100644--- a/packages/core/locales/en.json+++ b/packages/core/locales/en.json@@ -527,6 +527,14 @@"defaultMessage": "This {itemName} is already {boundary, select, first {first} last {last} other {}}.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "Link copied",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "Copy link to {heading}",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "Task list","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."diff --git a/packages/core/locales/es-ES.json b/packages/core/locales/es-ES.jsonindex 9ef702ddbc..818e60c732 100644--- a/packages/core/locales/es-ES.json+++ b/packages/core/locales/es-ES.json@@ -523,6 +523,14 @@"defaultMessage": "{itemName} ya está {boundary, select, first {en la primera posición} last {en la última posición} other {}}.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "Enlace copiado",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "Copiar enlace a {heading}",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "Lista de tareas","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/fi-FI.json b/packages/core/locales/fi-FI.jsonindex 123af52790..1e31f6afb7 100644--- a/packages/core/locales/fi-FI.json+++ b/packages/core/locales/fi-FI.json@@ -523,6 +523,14 @@"defaultMessage": "{itemName} on jo {boundary, select, first {ensimmäisenä} last {viimeisenä} other {}}.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "Linkki kopioitu",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "Kopioi linkki kohteeseen {heading}",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "Tehtäväluettelo","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/fr-FR.json b/packages/core/locales/fr-FR.jsonindex 4f859c5ac4..8da22f4bcb 100644--- a/packages/core/locales/fr-FR.json+++ b/packages/core/locales/fr-FR.json@@ -523,6 +523,14 @@"defaultMessage": "{itemName} est déjà {boundary, select, first {en première position} last {en dernière position} other {}}.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "Lien copié",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "Copier le lien vers {heading}",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "Liste de tâches","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/he-IL.json b/packages/core/locales/he-IL.jsonindex 46381b70db..b632274692 100644--- a/packages/core/locales/he-IL.json+++ b/packages/core/locales/he-IL.json@@ -523,6 +523,14 @@"defaultMessage": "{itemName} כבר {boundary, select, first {בתחילת הרשימה} last {בסוף הרשימה} other {}}.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "הקישור הועתק",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "העתקת קישור אל {heading}",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "רשימת משימות","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/hu-HU.json b/packages/core/locales/hu-HU.jsonindex bcee7e4767..7fcd3d493e 100644--- a/packages/core/locales/hu-HU.json+++ b/packages/core/locales/hu-HU.json@@ -523,6 +523,14 @@"defaultMessage": "Ez a(z) {itemName} már {boundary, select, first {az első helyen} last {az utolsó helyen} other {}} van.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "Hivatkozás másolva",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "Hivatkozás másolása ide: {heading}",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "Feladatlista","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/it-IT.json b/packages/core/locales/it-IT.jsonindex 9a1aeba42f..0721839ce6 100644--- a/packages/core/locales/it-IT.json+++ b/packages/core/locales/it-IT.json@@ -523,6 +523,14 @@"defaultMessage": "{itemName} è già {boundary, select, first {in prima posizione} last {in ultima posizione} other {}}.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "Link copiato",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "Copia link a {heading}",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "Elenco di attività","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/ja-JP.json b/packages/core/locales/ja-JP.jsonindex 1ac9bd8ea4..3bcf2ea85b 100644--- a/packages/core/locales/ja-JP.json+++ b/packages/core/locales/ja-JP.json@@ -523,6 +523,14 @@"defaultMessage": "この {itemName} はすでに{boundary, select, first {先頭} last {末尾} other {}}です。","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "リンクをコピーしました",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "{heading} へのリンクをコピー",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "タスクリスト","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/ko-KR.json b/packages/core/locales/ko-KR.jsonindex ac5726b6a8..fbe75361a6 100644--- a/packages/core/locales/ko-KR.json+++ b/packages/core/locales/ko-KR.json@@ -523,6 +523,14 @@"defaultMessage": "이 {itemName} 항목은 이미 {boundary, select, first {맨 앞} last {맨 뒤} other {}}에 있습니다.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "링크 복사됨",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "{heading} 링크 복사",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "작업 목록","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/nl-NL.json b/packages/core/locales/nl-NL.jsonindex c94e474870..c28fca787d 100644--- a/packages/core/locales/nl-NL.json+++ b/packages/core/locales/nl-NL.json@@ -523,6 +523,14 @@"defaultMessage": "{itemName} staat al {boundary, select, first {bovenaan} last {onderaan} other {}}.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "Link gekopieerd",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "Link naar {heading} kopiëren",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "Takenlijst","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/no-NO.json b/packages/core/locales/no-NO.jsonindex 88c0f6f402..bf2bdf07a0 100644--- a/packages/core/locales/no-NO.json+++ b/packages/core/locales/no-NO.json@@ -523,6 +523,14 @@"defaultMessage": "{itemName} er allerede {boundary, select, first {først} last {sist} other {}} i listen.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "Lenke kopiert",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "Kopier lenke til {heading}",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "Oppgaveliste","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/pl-PL.json b/packages/core/locales/pl-PL.jsonindex 09db50f118..d6ce54d655 100644--- a/packages/core/locales/pl-PL.json+++ b/packages/core/locales/pl-PL.json@@ -523,6 +523,14 @@"defaultMessage": "{itemName} jest już {boundary, select, first {na początku} last {na końcu} other {}}.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "Link skopiowany",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "Kopiuj link do {heading}",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "Lista zadań","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/pt-BR.json b/packages/core/locales/pt-BR.jsonindex 3a739a7f38..c04e355ec1 100644--- a/packages/core/locales/pt-BR.json+++ b/packages/core/locales/pt-BR.json@@ -523,6 +523,14 @@"defaultMessage": "{itemName} já está {boundary, select, first {na primeira posição} last {na última posição} other {}}.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "Link copiado",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "Copiar link para {heading}",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "Lista de tarefas","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/pt-PT.json b/packages/core/locales/pt-PT.jsonindex ae591f6437..a1c20f33dd 100644--- a/packages/core/locales/pt-PT.json+++ b/packages/core/locales/pt-PT.json@@ -523,6 +523,14 @@"defaultMessage": "{itemName} já está {boundary, select, first {na primeira posição} last {na última posição} other {}}.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "Ligação copiada",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "Copiar ligação para {heading}",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "Lista de tarefas","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/ro-RO.json b/packages/core/locales/ro-RO.jsonindex beb6512a8b..5d3297d694 100644--- a/packages/core/locales/ro-RO.json+++ b/packages/core/locales/ro-RO.json@@ -523,6 +523,14 @@"defaultMessage": "{itemName} se află deja {boundary, select, first {pe prima poziție} last {pe ultima poziție} other {}}.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "Link copiat",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "Copiază linkul către {heading}",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "Listă de activități","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/ru-RU.json b/packages/core/locales/ru-RU.jsonindex 506c0051c7..f965406dba 100644--- a/packages/core/locales/ru-RU.json+++ b/packages/core/locales/ru-RU.json@@ -523,6 +523,14 @@"defaultMessage": "{itemName} уже {boundary, select, first {в начале списка} last {в конце списка} other {}}.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "Ссылка скопирована",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "Копировать ссылку на {heading}",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "Список задач","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/sr-SP.json b/packages/core/locales/sr-SP.jsonindex 4a1d3e0277..01b33838c7 100644--- a/packages/core/locales/sr-SP.json+++ b/packages/core/locales/sr-SP.json@@ -523,6 +523,14 @@"defaultMessage": "{itemName} је већ {boundary, select, first {на почетку листе} last {на крају листе} other {}}.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "Веза је копирана",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "Копирај везу до {heading}",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "Листа задатака","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/sv-SE.json b/packages/core/locales/sv-SE.jsonindex 162ac54928..e6b208ec97 100644--- a/packages/core/locales/sv-SE.json+++ b/packages/core/locales/sv-SE.json@@ -523,6 +523,14 @@"defaultMessage": "{itemName} är redan {boundary, select, first {först} last {sist} other {}}.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "Länken har kopierats",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "Kopiera länk till {heading}",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "Uppgiftslista","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/tr-TR.json b/packages/core/locales/tr-TR.jsonindex 87f718d538..8f424d7c25 100644--- a/packages/core/locales/tr-TR.json+++ b/packages/core/locales/tr-TR.json@@ -523,6 +523,14 @@"defaultMessage": "Bu {itemName} zaten {boundary, select, first {ilk sırada} last {son sırada} other {}}.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "Bağlantı kopyalandı",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "{heading} bağlantısını kopyala",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "Görev listesi","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/uk-UA.json b/packages/core/locales/uk-UA.jsonindex 763a5964ee..ae0e96a7aa 100644--- a/packages/core/locales/uk-UA.json+++ b/packages/core/locales/uk-UA.json@@ -523,6 +523,14 @@"defaultMessage": "{itemName} уже {boundary, select, first {на початку списку} last {у кінці списку} other {}}.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "Посилання скопійовано",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "Копіювати посилання на {heading}",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "Список завдань","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/vi-VN.json b/packages/core/locales/vi-VN.jsonindex 730447bf44..243b9e66e8 100644--- a/packages/core/locales/vi-VN.json+++ b/packages/core/locales/vi-VN.json@@ -523,6 +523,14 @@"defaultMessage": "{itemName} này đã ở {boundary, select, first {đầu danh sách} last {cuối danh sách} other {}}.","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "Đã sao chép liên kết",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "Sao chép liên kết đến {heading}",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "Danh sách công việc","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/zh-CN.json b/packages/core/locales/zh-CN.jsonindex e25eef1dcf..c762c6a362 100644--- a/packages/core/locales/zh-CN.json+++ b/packages/core/locales/zh-CN.json@@ -523,6 +523,14 @@"defaultMessage": "此 {itemName} 已位于{boundary, select, first {最前面} last {最后面} other {}}。","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "链接已复制",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "复制指向{heading}的链接",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "任务列表","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/locales/zh-TW.json b/packages/core/locales/zh-TW.jsonindex 59c7f38383..88696f10bf 100644--- a/packages/core/locales/zh-TW.json+++ b/packages/core/locales/zh-TW.json@@ -523,6 +523,14 @@"defaultMessage": "此 {itemName} 已位於{boundary, select, first {最前面} last {最後面} other {}}。","description": "Screen-reader-only live announcement when an arrow-key reorder attempt has no effect because the record is already at that end of the list. `{itemName}` is the consumer's singular noun for one record; `{boundary}` is always exactly \"first\" or \"last\"."},+ "@astryx.markdownHeadingLinks.copied": {+ "defaultMessage": "連結已複製",+ "description": "Accessible name on the Markdown heading copy button and text announced to a polite live region for ~1.5s after a successful copy. Sentence meaning \"Link copied\"; pairs with `markdownHeadingLinks.copy`."+ },+ "@astryx.markdownHeadingLinks.copy": {+ "defaultMessage": "複製指向{heading}的連結",+ "description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."+ },"@astryx.markdown.taskList": {"defaultMessage": "工作清單","description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."@@ -1480,4 +1488,3 @@"description": "Default summary on the closed trigger of a lab TransferListSelector, stating how many options are currently chosen. Consumers usually override this with a domain phrase (e.g. \"7 columns\")."}}-diff --git a/packages/core/src/Markdown/Markdown.doc.mjs b/packages/core/src/Markdown/Markdown.doc.mjsindex 802a4f385c..d8901d2526 100644--- a/packages/core/src/Markdown/Markdown.doc.mjs+++ b/packages/core/src/Markdown/Markdown.doc.mjs@@ -305,12 +305,12 @@ export const docs = {{guidance: true,description:- 'Install createMarkdownHeadingLinks() through plugins when a document needs deterministic h1–h6 fragment IDs at every nesting depth. The returned entry carries its validated namespace across compatible Core package copies. The no-plugin path stays unchanged; the plugin shares one depth-first identity projection with Markdown-derived Outline.',+ 'Install createMarkdownHeadingLinks() through plugins when a document needs copyable h1–h6 permalinks. The returned entry carries its validated namespace and URL base across compatible Core package copies. Each built-in heading keeps its incoming fragment ID and gains an inline trailing # copy button: it is hidden at fine-pointer rest through useContainerReveal, reveals on heading-row hover or keyboard focus, and stays visible under the hook’s coarse/touch semantics. Unmodified tap, click, Enter, or Space copies the canonical URL without navigation, hash mutation, or scrolling; a check confirms success for 1.5 seconds. The no-plugin path stays unchanged, and nested headings use the same depth-first identity projection as Markdown-derived Outline.',},{guidance: true,description:- 'For multiple documents, create one heading-links plugin per document with headingIdPrefix and pass that same plugin to Markdown and useOutlineFromMarkdown. Use the same stable value for Markdown id when the root also needs a DOM id.',+ 'For multiple documents, create one heading-links plugin per document with headingIdPrefix and pass that same plugin to Markdown and useOutlineFromMarkdown. Use the same stable value for Markdown id when the root also needs a DOM id; permalinkBaseUrl may supply a safe caller-owned URL before the fragment.',},{guidance: false,@@ -810,12 +810,12 @@ export const docsZh = {{guidance: true,description:- 'Install createMarkdownHeadingLinks() through plugins when a document needs deterministic h1–h6 fragment IDs at every nesting depth. The returned entry carries its validated namespace across compatible Core package copies. The no-plugin path stays unchanged; the plugin shares one depth-first identity projection with Markdown-derived Outline.',+ 'Install createMarkdownHeadingLinks() through plugins when a document needs copyable h1–h6 permalinks. The returned entry carries its validated namespace and URL base across compatible Core package copies. Each built-in heading keeps its incoming fragment ID and gains an inline trailing # copy button: it is hidden at fine-pointer rest through useContainerReveal, reveals on heading-row hover or keyboard focus, and stays visible under the hook’s coarse/touch semantics. Unmodified tap, click, Enter, or Space copies the canonical URL without navigation, hash mutation, or scrolling; a check confirms success for 1.5 seconds. The no-plugin path stays unchanged, and nested headings use the same depth-first identity projection as Markdown-derived Outline.',},{guidance: true,description:- 'For multiple documents, create one heading-links plugin per document with headingIdPrefix and pass that same plugin to Markdown and useOutlineFromMarkdown. Use the same stable value for Markdown id when the root also needs a DOM id.',+ 'For multiple documents, create one heading-links plugin per document with headingIdPrefix and pass that same plugin to Markdown and useOutlineFromMarkdown. Use the same stable value for Markdown id when the root also needs a DOM id; permalinkBaseUrl may supply a safe caller-owned URL before the fragment.',},{guidance: false,@@ -902,7 +902,7 @@ export const docsDense = {{guidance: true,description:- 'Install createMarkdownHeadingLinks() through plugins to add all-depth stable IDs. Pass the same plugin entry to Markdown-derived Outline; use headingIdPrefix for multiple instances.',+ 'Install createMarkdownHeadingLinks() through plugins to add all-depth stable IDs and inline trailing # copy buttons to built-in headings. useContainerReveal keeps each button hidden at fine-pointer rest and keyboard/touch reachable. Unmodified activation copies the canonical URL without navigation, hash mutation, or scrolling and shows a 1.5-second check; failures stay silent. Pass the same plugin entry to Markdown-derived Outline; use headingIdPrefix for multiple instances.',},{guidance: false,diff --git a/packages/core/src/Markdown/Markdown.spec.md b/packages/core/src/Markdown/Markdown.spec.mdindex b05c9a3b0a..419c798f3c 100644--- a/packages/core/src/Markdown/Markdown.spec.md+++ b/packages/core/src/Markdown/Markdown.spec.md@@ -144,8 +144,8 @@ first-party key/value grammar rather than Remark compatibility, and exposes typemetadata through the helper that created it. `spec:AST-036`owns the shared protocol and limited Remark compatibility profile,`module:Markdown/remark` owns that profile's adapter,-`module:Markdown/headingLinks` owns its opt-in identity projection, and this-component owns aggregate application and fallback.+`module:Markdown/headingLinks` owns its opt-in identity projection and permalink+composition, and this component owns aggregate application and fallback.### Acceptance and implementation state@@ -360,9 +360,9 @@ and this change preserves the existing spelling exactly.- `spec:AST-005/DEC-2` keeps embedded-resource policy separate. Markdown mayreject a broader set of image/resource URLs without narrowing the sharednavigation contract.-- `module:Markdown/headingLinks` owns its opt-in public factory and heading- identity projection. Markdown supplies only the generic plugin and built-in/custom- heading ID application seams.+- `module:Markdown/headingLinks` owns its opt-in public factory, heading projection,+ built-in sibling renderer, i18n, styles, accessibility behavior, and evidence.+ Markdown supplies only the generic plugin and built-in-heading composition seams.- `spec:AST-036` owns the opaque syntax/transform/renderer protocol, immutable ASTvalidation, limited Remark compatibility, performance, and resource boundaries.This record owns aggregate Markdown behavior in FR12–FR22;diff --git a/packages/core/src/Markdown/Markdown.tsx b/packages/core/src/Markdown/Markdown.tsxindex 60bef44ba9..e2cf0e9ce6 100644--- a/packages/core/src/Markdown/Markdown.tsx+++ b/packages/core/src/Markdown/Markdown.tsx@@ -79,6 +79,10 @@ import {projectMarkdownHeadings,type MarkdownHeadingProjection,} from './headingProjection';+import {+ HeadingLinksRenderer,+ headingLinksHeadingStyle,+} from './plugins/HeadingLinksRenderer';import {themeProps} from '../utils/themeProps';import {useTranslator, type TranslatorFn} from '../i18n';@@ -1334,6 +1338,8 @@ function renderBlock(),);const headingId = headingProjection?.ids.get(node);+ const headingLabel = headingProjection?.labels.get(node) ?? '';+ const permalinkUrl = headingProjection?.permalinkUrls.get(node);const HeadingComp = components?.heading;if (HeadingComp) {return (@@ -1343,28 +1349,58 @@ function renderBlock();}const Tag = `h${level}` as const;+ if (permalinkUrl == null || headingId == null) {+ return (+ <Tag+ key={index}+ id={headingId}+ {...mergeProps(+ themeProps('markdown-heading', {density, level}),+ stylex.props(+ styles.headingBase,+ headingStyles[level],+ spacing,+ contentWidthValue != null+ ? dynamicStyles.proseWidth(contentWidthValue)+ : null,+ contentAlign !== 'start'+ ? dynamicStyles.proseAlign(ALIGN_MARGIN[contentAlign])+ : null,+ isFirst && styles.noMarginBlockStart,+ isLast && styles.noMarginBlockEnd,+ ),+ )}>+ {headingChildren}+ </Tag>+ );+ }return (- <Tag+ <HeadingLinksRendererkey={index}- id={headingId}- {...mergeProps(- themeProps('markdown-heading', {density, level}),- stylex.props(- styles.headingBase,- headingStyles[level],- spacing,- contentWidthValue != null- ? dynamicStyles.proseWidth(contentWidthValue)- : null,- contentAlign !== 'start'- ? dynamicStyles.proseAlign(ALIGN_MARGIN[contentAlign])- : null,- isFirst && styles.noMarginBlockStart,- isLast && styles.noMarginBlockEnd,- ),- )}>- {headingChildren}- </Tag>+ headingId={headingId}+ headingLabel={headingLabel}+ permalinkUrl={permalinkUrl}+ contentWidth={contentWidthValue}+ contentAlign={contentAlign}+ headingTextStyle={[styles.headingBase, headingStyles[level]]}+ blockSpacingStyle={[+ spacing,+ isFirst && styles.noMarginBlockStart,+ isLast && styles.noMarginBlockEnd,+ ]}>+ <Tag+ id={headingId}+ {...mergeProps(+ themeProps('markdown-heading', {density, level}),+ stylex.props(+ styles.headingBase,+ headingLinksHeadingStyle,+ headingStyles[level],+ ),+ )}>+ {headingChildren}+ </Tag>+ </HeadingLinksRenderer>);}case 'paragraph': {diff --git a/packages/core/src/Markdown/headingProjection.ts b/packages/core/src/Markdown/headingProjection.tsindex 0a363c6939..7c97da56cc 100644--- a/packages/core/src/Markdown/headingProjection.ts+++ b/packages/core/src/Markdown/headingProjection.ts@@ -25,6 +25,8 @@ export interface MarkdownHeadingProjection {readonly ids: ReadonlyMap<Heading, string>;/** Plain-text labels for generated headings. */readonly labels: ReadonlyMap<Heading, string>;+ /** Canonical permalink URL copied by the first-party module, absent by default. */+ readonly permalinkUrls: ReadonlyMap<Heading, string>;/** Root headings only, preserving the released Outline scope. */readonly outline: ReadonlyArray<OutlineItem>;}@@ -66,5 +68,5 @@ export function projectMarkdownHeadings(return {id, label, level: heading.depth};});- return {ids, labels, outline};+ return {ids, labels, permalinkUrls: new Map(), outline};}diff --git a/packages/core/src/Markdown/modules/headingLinks.spec.md b/packages/core/src/Markdown/modules/headingLinks.spec.mdindex f7456ec926..a651159c6d 100644--- a/packages/core/src/Markdown/modules/headingLinks.spec.md+++ b/packages/core/src/Markdown/modules/headingLinks.spec.md@@ -9,13 +9,15 @@ superseded_by: nullapproved_by: cixzhangapproved_at: 2026-10-03owners: [cixzhang]-review_triggers: [public-api, behavior]+review_triggers: [public-api, behavior, accessibility, layout]verified_by:[packages/core/src/Markdown/plugins/headingLinks.test.tsx,packages/core/src/Markdown/plugins/headingLinks.ssr.test.tsx,packages/core/src/Markdown/Markdown.public.test.ts,+ packages/core/src/Markdown/plugins/headingLinks.a11y.chromium.spec.ts,packages/core/src/Outline/parseOutlineFromMarkdown.test.ts,+ apps/storybook/stories/MarkdownHeadingLinks.stories.tsx,]parent_component: component:Markdownreferences:@@ -27,27 +29,27 @@ references:]----# Markdown heading-links identity contract+# Markdown heading-links module contract## Contract at a glance-| Area | Contract |-| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| Public contract | `createMarkdownHeadingLinks(options?)` returns one first-party entry exported from `@astryxdesign/core/Markdown/plugins`. |-| Behavior | Installing the entry gives every rendered h1–h6 a deterministic, collision-safe ID after transforms. |-| End-user impact | Documents gain stable fragment targets at every heading depth without changing heading content, semantics, or visual anatomy. |-| Builder impact | Builders explicitly install one entry and may supply a stable heading namespace. The same entry keeps Markdown-derived Outline IDs aligned and root-only. |-| Compatibility | Additive and default-off. Without this module, released Markdown/Outline heading traversal, IDs, DOM, styling, and custom heading ownership remain unchanged. |-| Review checks | Reject default-on behavior, a Markdown prop, an Outline-only namespace, runtime IDs, module-local entry state, unvalidated lookalikes, imposed visual anatomy, product identity, or host-specific navigation logic. |+| Area | Contract |+| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| Public contract | `createMarkdownHeadingLinks(options?)` returns one first-party entry exported from `@astryxdesign/core/Markdown/plugins`. |+| Behavior | Installing the entry gives every rendered h1–h6 a deterministic, collision-safe ID and gives each built-in heading an inline trailing `#` copy button. |+| End-user impact | Readers can copy a durable heading URL with immediate confirmation without changing the current hash, scroll position, or page; incoming fragment URLs still target the heading ID. |+| Builder impact | Builders explicitly install one entry and may supply a stable heading namespace and safe URL base. The same entry keeps Markdown-derived Outline IDs aligned and root-only. |+| Compatibility | Additive and default-off. Without this module, released Markdown/Outline heading traversal, IDs, DOM, styling, and custom heading ownership remain unchanged. |+| Review checks | Reject default-on behavior, a Markdown prop, an Outline-only namespace, runtime IDs, module-local entry state, unvalidated lookalikes, an anchor/fake link, bespoke reveal logic, imposed custom anatomy, or product-shaped navigation. |This table is a review projection; the body below is authoritative.## Intent-Builders who publish documents should be able to opt into one portable heading-identity projection without turning document identity into a permanent Markdown prop.-This foundation owns the public factory, Unicode slugging, collision allocation, and-Markdown/Outline integration. It intentionally adds no permalink renderer or visual UI.+Builders who publish documents should be able to opt into portable, durable heading+links without turning product identity or navigation policy into a permanent Markdown+prop. The module owns one complete first-party composition: identity projection,+permalink copy-button rendering, localization, and cross-surface evidence.## Compatibility and migration@@ -67,55 +69,51 @@ Markdown/Outline integration. It intentionally adds no permalink renderer or visconfiguration carried by the opaque entry across compatible Core package copies.- NFKC Unicode slugging, fallback, emitted-ID reservation, namespace composition,and all-depth post-transform projection.-- The shared IDs and labels consumed by Markdown and Markdown-derived Outline.-- The built-in renderer extension's observable copy/reveal contract: an honest- `type="button"` shows an inline trailing `#`, copies the canonical permalink without- navigating, scrolling, or mutating the hash, and is visually hidden at fine-pointer- rest. The heading row owns the standard `useContainerReveal` trigger; row hover and- focus-within reveal the mounted button; keyboard and coarse-pointer behavior follow- that hook's accessibility contract.-- Module-focused unit, integration, SSR, and delegated renderer browser evidence.+- The shared IDs, labels, sanitized permalink bases, and canonical copy URLs consumed by+ Markdown and Markdown-derived Outline.+- The built-in sibling copy-button renderer, `useContainerReveal` composition, i18n,+ interaction styles, Storybook example, SSR proof, and browser evidence.**Does not own / non-goals**- Markdown's generic plugin protocol, parser, transform order, default heading styles,or released no-plugin root-heading projection.- Outline's root-only item selection, hook API, or memoization framework.-- A caller's custom `components.heading` DOM, styling, or accessibility.-- Permalink rendering, interaction, i18n, styles, and browser evidence belong to the- renderer extension, which obeys the module-owned reveal contract below without- changing this public API.+- A caller's custom `components.heading` DOM, styling, accessibility, or permalink UI.- Product-specific document identity, versioning, host URL construction, viewerscrolling, callbacks, or routing.## Public API and concepts-| Concept | Closed values or states | Meaning | Default | Owner | Stability |-| ------------------------------ | -------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------- | ------------------------------ | --------- |-| `createMarkdownHeadingLinks()` | one factory returning `MarkdownPluginEntry<never>` | Installs a portable module entry recognized by compatible Core copies. | absent | `module:Markdown/headingLinks` | stable |-| `headingIdPrefix` | string or omitted | Caller-owned stable namespace prepended as `<prefix>--<slug>`. | unprefixed | caller | stable |-| Heading projection | absent or installed | Released root-only identity when absent; module-owned all-depth identity when installed. | absent | module | stable |-| Custom heading renderer | caller replacement | Receives the generated ID at every depth and otherwise keeps complete output ownership. | built-in | caller | stable |+| Concept | Closed values or states | Meaning | Default | Owner | Stability |+| ------------------------------ | -------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------- | ------------------------------ | --------- |+| `createMarkdownHeadingLinks()` | one factory returning `MarkdownPluginEntry<never>` | Installs a portable module entry recognized by compatible Core copies. | absent | `module:Markdown/headingLinks` | stable |+| `headingIdPrefix` | string or omitted | Caller-owned stable namespace prepended as `<prefix>--<slug>`. | unprefixed | caller | stable |+| `permalinkBaseUrl` | safe navigation URL or omitted | Caller-owned base whose existing fragment is replaced by the generated fragment. | current document | caller | stable |+| Heading projection | absent or installed | Released root-only identity when absent; module-owned all-depth identity when installed. | absent | module | stable |+| Built-in copy control | honest sibling `type="button"` | Copies the canonical URL without navigation and shows a check for 1.5s. | absent | module | stable |+| Custom heading renderer | caller replacement | Receives the generated ID only and keeps complete output ownership. | built-in | caller | stable |## Behavioral contract-| ID | Invariant | Basis |-| --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |-| FR1 | The factory and options type are exported only through the server-safe `@astryxdesign/core/Markdown/plugins` entry point. The ordinary opaque `MarkdownPluginEntry<never>` carries a frozen, versioned module configuration inside the shared structurally validated `Symbol.for` protocol envelope, so a compatible Core copy can recognize it without module-local identity or state. | `spec:AST-036` FR1–FR5, DEC-11 |-| FR2 | `headingIdPrefix` accepts only a string when present and travels on the entry. It is caller-owned stable data, not derived from runtime tree position or React `useId`. Consumers recognize only the exact compatible module configuration. A valid generic same-name plugin with malformed, missing, older, or newer module data remains subject to ordinary plugin ordering but is not treated as heading links, so its configuration cannot affect IDs. A malformed generic entry follows the existing consumer fail-soft path: Markdown and Outline report the configuration failure and preserve released behavior rather than throwing during render. Direct invalid factory arguments may still throw. Another valid plugin is never treated as this module. | `spec:AST-002/DEC-8` |-| FR3 | After transforms, every heading at every depth participates once in document order. Labels use the canonical extension text projection. Slugs use NFKC, lowercase Unicode letters/numbers, quote removal, collapsed hyphens, and `section`. | `component:Markdown` FR13, FR16 |-| FR4 | Every emitted ID is reserved. A natural numeric suffix can never collide with or re-emit an earlier generated ID. | module identity ownership |-| FR5 | Omitting the module preserves released root-heading IDs, nested-heading behavior, DOM, styles, Outline results, and custom-renderer ownership. | `component:Markdown` FR12 |-| FR6 | Passing the same entry to Markdown and Markdown-derived Outline shares one projection. Nested headings consume identity and collisions, while Outline continues to select root headings only. | `module:Outline/parseOutlineFromMarkdown` |-| FR7 | Built-in and custom headings receive the projected ID at every depth without an imposed wrapper or sibling UI. | `component:Markdown` FR2–FR3 |-| FR8 | IDs are deterministic across synchronous SSR, hydration, multiple namespaced instances, reordering, and independent rendering. | module identity ownership |-| FR9 | The public entry remains server-safe and tree-shakeable. Product identity, URL/version/scroll/callback/routing logic never enters the factory or projection. | package export and side-effect conventions |+| ID | Invariant | Basis |+| ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |+| FR1 | The factory and options type are exported only through the server-safe `@astryxdesign/core/Markdown/plugins` entry point. The ordinary opaque `MarkdownPluginEntry<never>` carries a frozen, versioned module configuration inside the shared structurally validated `Symbol.for` protocol envelope, so a compatible Core copy can recognize it without module-local identity or state. | `spec:AST-036` FR1–FR5, DEC-11 |+| FR2 | `headingIdPrefix` and `permalinkBaseUrl` accept strings only and travel on the entry. The URL base uses Markdown's navigation sanitizer, rejects unsafe destinations, and replaces any existing fragment. Consumers recognize only the exact compatible module configuration. A valid generic same-name plugin with incompatible module data keeps ordinary plugin ordering but gains no heading-links behavior; malformed generic entries follow the existing Markdown/Outline fail-soft path. Direct invalid factory arguments may still throw. | `family:navigation-destinations` |+| FR3 | After transforms, every heading at every depth participates once in document order. Labels use the canonical extension text projection. Slugs use NFKC, lowercase Unicode letters/numbers, quote removal, collapsed hyphens, and `section`. | `component:Markdown` FR13, FR16 |+| FR4 | Every emitted ID is reserved. A natural numeric suffix can never collide with or re-emit an earlier generated ID. | module identity ownership |+| FR5 | Omitting the module preserves released root-heading IDs, nested-heading behavior, DOM, styles, Outline results, and custom-renderer ownership. | `component:Markdown` FR12 |+| FR6 | Passing the same entry to Markdown and Markdown-derived Outline shares one projection. Nested headings consume identity and collisions, while Outline continues to select root headings only. | `module:Outline/parseOutlineFromMarkdown` |+| FR7 | A built-in heading remains one semantic h1–h6 and gains one honest sibling `type="button"`; a custom heading receives the generated ID and no imposed wrapper or control. | `component:Markdown` FR2–FR3 |+| FR8 | IDs are deterministic across synchronous SSR, hydration, multiple namespaced instances, reordering, and independent rendering. | module identity ownership |+| FR9 | The public entry remains server-safe and tree-shakeable; the client renderer stays private to Markdown. Product identity, versioning, scrolling, callbacks, routing, and host URL construction never enter the module. | package export and side-effect conventions |+| FR10 | Unmodified click, tap, Enter, or Space copies the canonical absolute URL without navigation, scroll, or hash mutation. Success shows the check and localized polite announcement for 1.5s; failure stays silent. The heading row uses canonical `useContainerReveal`, line-height-sized flow layout, stable logical-end spacing, non-overlapping 24px coarse hit geometry, and one keyboard-only focus ring. | module interaction and layout ownership |## Accessibility contract-- **AR1 — semantics stay intact.** The foundation changes only the `id` attribute on- existing semantic h1–h6 output; heading role, level, content, and accessible name do- not change.+- **AR1 — heading semantics stay intact.** The built-in control is a sibling, so the+ h1–h6 role/name excludes `#`; authored heading links remain valid. A custom heading+ receives identity only.- **AR2 — custom ownership stays intact.** A custom heading receives identity only andremains responsible for all anatomy, styling, and accessibility beyond the ID.- **AR3 — the renderer extension uses the canonical reveal primitive.** Its copy@@ -155,14 +153,15 @@ context-menu semantics. Custom headings remain outside this renderer contract.## Design relationships-| State | Design requirement | Representation authority | Module contract |-| ------------------ | ------------------------------------------------------------------------------- | --------------------------- | --------------- |-| Built-in heading | Preserve existing anatomy and styles while adding the projected `id`. | Current source and Markdown | FR5, FR7 |-| Custom heading | Forward the projected `id` without wrapping or adding sibling presentation. | Caller | FR7 |-| No-plugin Markdown | Preserve released root-only identity and nested-heading behavior byte-for-byte. | Current source and Markdown | FR5 |+| State | Design requirement | Representation authority | Module contract |+| ------------------ | ----------------------------------------------------------------------------------------------------- | --------------------------- | --------------- |+| Built-in heading | Preserve semantic h1–h6 content while adding the projected ID and sibling copy control. | Current source and Markdown | FR5, FR7, FR10 |+| Copy control | Align `#`/check in the heading line box; reveal canonically and extend only to the 24px AA hit floor. | Button and module contract | FR10 |+| Custom heading | Forward the projected ID without wrapping or adding sibling presentation. | Caller | FR7 |+| No-plugin Markdown | Preserve released root-only identity and nested-heading behavior byte-for-byte. | Current source and Markdown | FR5 |-The foundation adds no visual part, private layout, theme target, i18n message, or-interaction state.+The module adds no Markdown-local theme target. The button uses Button's existing target;+the row is private layout.## Parent and system relationships@@ -173,7 +172,9 @@ interaction state.- `spec:AST-036` owns the opaque plugin protocol; this first-party module uses itwithout a privileged public capability.- `spec:AST-002/DEC-8` admits this factory instead of a broad Markdown prop because- installation and namespace are caller decisions Astryx cannot derive.+ installation, namespace, and URL base are caller decisions Astryx cannot derive.+- `family:navigation-destinations` owns URL accept/block policy; this module owns+ sanitizing the optional base and copying the canonical URL.## Implementation plan and boundaries@@ -181,19 +182,20 @@ interaction state.`plugins/headingLinks.ts`; carry normalized module configuration inside the sharedportable plugin envelope, and export only the factory and options type from`plugins/index.ts`.-2. Let Markdown's existing built-in and custom heading paths consume the projected ID- without visual composition. Keep the default path unchanged.-3. Keep identity tests, SSR proof, and Outline integration named and located with the- module; keep generic/no-plugin tests in Markdown and root selection in Outline.+2. Keep rendering and StyleX private under `plugins/`; Markdown's built-in heading path+ invokes the renderer only when projection supplies a canonical URL. Default and+ custom-renderer paths remain unchanged.+3. Keep module tests, SSR proof, Storybook, and Playwright evidence with the module;+ keep generic/no-plugin tests in Markdown and root selection in Outline.## Verification map-| Contract | Verification | Representative states | Failure expectation |-| ---------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| FR1–FR4 | `plugins/headingLinks.test.tsx`, core typecheck, export/package checks | public entry/type, duplicate Core copies, lookalike/malformed/other plugins, h1–h6, Unicode, empty label, suffix collisions | Export drift, lost options, false recognition, unstable slug, duplicate ID, or non-server-safe construction fails. |-| FR5–FR7 | module tests plus Markdown and Outline integration tests | omitted/installed plugin, root/nested, custom heading, namespace, root ID | Default behavior changes, custom output is wrapped, or Markdown/Outline IDs diverge. |-| FR8–FR9 | `plugins/headingLinks.ssr.test.tsx`, package checks, plus delegated renderer Storybook/Chromium evidence | duplicate Core copy, two namespaces, SSR/hydration, honest button, no navigation/hash/scroll, copy/check/announcement, hidden rest, row hover, keyboard focus, coarse/touch hook semantics | IDs/options drift, hydration recovers, construction imports a client boundary, the control fakes link semantics, or the renderer bypasses `useContainerReveal`. |-| Repository | formatting, ESLint, knowledge/sync, Changeset validation, core typecheck, focused tests, pre-commit | module files, Markdown/Outline seams, docs/specs | Stale authority, duplicate ownership, type/lint failure, or unrelated diff blocks. |+| Contract | Verification | Representative states | Failure expectation |+| ---------- | --------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |+| FR1–FR4 | module tests, public API test, typecheck, export/package checks | public entry/options, duplicate copies, invalid entries/URLs, h1–h6, Unicode, suffix collisions | Export drift, lost options, false recognition, unsafe URL, unstable slug, or duplicate ID fails. |+| FR5–FR7 | module tests plus Markdown and Outline integration tests | omitted/installed plugin, root/nested, honest sibling button, custom heading | Default changes, custom output is wrapped, the control fakes link semantics, or IDs diverge. |+| FR8–FR10 | SSR test, Storybook, and `plugins/headingLinks.a11y.chromium.spec.ts` | hydration, copy/failure/timer, no location mutation, rest/hover/focus/touch, line-height rows, 24px target, RTL/zoom/forced colors | Hydration recovers, feedback lies/shifts, layout grows, targets overlap, pointer paints a keyboard ring, or reveal semantics drift. |+| Repository | formatting, ESLint, knowledge/sync, i18n, Changeset validation, core typecheck, focused tests, pre-commit | module files, locale catalogs, Markdown/Outline seams, docs/specs, Storybook, workflow | Stale authority, untranslated drift, duplicate ownership, type/lint failure, or unrelated diff blocks. |## Decision log@@ -202,11 +204,12 @@ interaction state.**Reference:** `module:Markdown/headingLinks/DEC-1`**Decider:** `cixzhang`, `2026-10-03`-One factory preserves the opaque plugin list while exposing only installation and an-optional stable namespace. Its configuration rides the existing portable, versioned-plugin envelope rather than a creating module's WeakMap or object identity, so duplicate-compatible Core copies agree. A broad Markdown prop or separate Outline option would-make one projection into permanent parallel API and could drift across surfaces.+One factory preserves the opaque plugin list while exposing only installation, an optional+stable namespace, and an optional safe URL base. Its configuration rides the existing+portable, versioned plugin envelope rather than a creating module's WeakMap or object+identity, so duplicate compatible Core copies agree. A broad Markdown prop or separate+Outline option would make one composition into permanent parallel API and could drift+across surfaces.Compatible duplicate copies consume the exact envelope. A valid generic same-name pluginwith absent or incompatible module data stays an ordinary plugin in the caller's declared@@ -241,16 +244,18 @@ The renderer extension uses an inline trailing `#` sibling with baseline/logicalspacing, secondary color, and inherited typography. Its primary action is copy, so it isa real button rather than an anchor that suppresses navigation. `useContainerReveal`owns fine-pointer rest, heading-row hover, focus-within, coarse/touch, and motion-semantics. The heading ID remains the incoming fragment target.+semantics. Its in-flow box matches the heading line-height, with stable logical-end space+and non-overlapping 24px coarse hit geometry; pointer activation paints no keyboard ring.+The heading ID remains the incoming fragment target.Rejected: native fragment navigation; a copy-plus-navigation anchor hybrid; bespokereveal media logic; product routing; a new public reveal API.## Content boundary-The module reads only transformed heading nodes and the caller-supplied configuration-carried by the validated plugin entry for the current document invocation. It does not-persist document content, labels, options, or generated IDs in module-local state.+The module reads only transformed heading nodes and caller-supplied configuration carried+by the validated plugin entry for the current document invocation. It does not persist+document content, labels, destinations, options, or generated IDs in module-local state.## Open questionsdiff --git a/packages/core/src/Markdown/plugins/HeadingLinksRenderer.tsx b/packages/core/src/Markdown/plugins/HeadingLinksRenderer.tsxnew file mode 100644index 0000000000..96d6ecb854--- /dev/null+++ b/packages/core/src/Markdown/plugins/HeadingLinksRenderer.tsx@@ -0,0 +1,195 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++'use client';++/**+ * @file HeadingLinksRenderer.tsx+ * @input A built-in semantic heading and its module-owned identity projection+ * @output Inline heading-permalink copy composition with isolated control geometry+ * @position Internal renderer owned by module:Markdown/headingLinks+ */++import {useCallback} from 'react';+import type {MouseEvent, ReactElement} from 'react';+import * as stylex from '@stylexjs/stylex';+import type {StyleXStyles} from '@stylexjs/stylex';+import {Button} from '../../Button/Button';+import {Icon} from '../../Icon';+import {useClipboard} from '../../hooks/useClipboard';+import {useContainerReveal} from '../../hooks/useContainerReveal';+import {useTranslator} from '../../i18n';+import {colorVars, sizeVars, spacingVars} from '../../theme/tokens.stylex';+import {mergeProps, rtlStyles} from '../../utils';++const COPY_FEEDBACK_MS = 1500;+const COARSE_TARGET = '24px';++const ALIGN_MARGIN = {+ start: '0',+ center: 'auto',+} as const;++const dynamicStyles = stylex.create({+ proseWidth: (maxWidth: string) => ({maxWidth}),+ proseAlign: (marginInline: string) => ({marginInline}),+});++const styles = stylex.create({+ row: {+ display: 'flex',+ alignItems: 'last baseline',+ minWidth: 0,+ maxWidth: '100%',+ overflow: 'visible',+ isolation: 'isolate',+ },+ heading: {+ flex: '0 1 auto',+ minWidth: 0,+ marginBlock: 0,+ },+ controlSlot: {+ position: 'relative',+ display: 'inline-block',+ flexShrink: 0,+ zIndex: 1,+ inlineSize: {+ default: sizeVars['--size-element-sm'],+ '@media (any-pointer: coarse)': COARSE_TARGET,+ },+ marginInlineStart: spacingVars['--spacing-1-5'],+ color: colorVars['--color-text-secondary'],+ fontFamily: 'inherit',+ fontSize: 'inherit',+ fontWeight: 'inherit',+ lineHeight: 'inherit',+ },+ baselineProbe: {+ visibility: 'hidden',+ },+ copyButton: {+ position: 'absolute',+ insetBlockStart: '50%',+ inlineSize: {+ default: sizeVars['--size-element-sm'],+ '@media (any-pointer: coarse)': COARSE_TARGET,+ },+ blockSize: {+ default: sizeVars['--size-element-sm'],+ '@media (any-pointer: coarse)': COARSE_TARGET,+ },+ paddingBlock: 0,+ paddingInline: 0,+ color: 'inherit',+ fontFamily: 'inherit',+ fontSize: 'inherit',+ fontWeight: 'inherit',+ lineHeight: 'inherit',+ },+ glyph: {+ display: 'inline-flex',+ alignItems: 'center',+ justifyContent: 'center',+ inlineSize: '1em',+ blockSize: '1em',+ },+});++/** @internal Applied only while this module owns the built-in heading row. */+export const headingLinksHeadingStyle = styles.heading;++interface HeadingLinksRendererProps {+ readonly children: ReactElement;+ readonly headingId: string;+ readonly headingLabel: string;+ readonly permalinkUrl: string;+ readonly contentWidth: string | null;+ readonly contentAlign: 'start' | 'center';+ readonly headingTextStyle: StyleXStyles;+ readonly blockSpacingStyle: StyleXStyles;+}++function isUnmodifiedPrimaryActivation(+ event: MouseEvent<HTMLButtonElement>,+): boolean {+ return (+ event.button === 0 &&+ !event.altKey &&+ !event.ctrlKey &&+ !event.metaKey &&+ !event.shiftKey+ );+}++/** @internal Portable renderer composed by Markdown for built-in headings only. */+export function HeadingLinksRenderer({+ children,+ headingId,+ headingLabel,+ permalinkUrl,+ contentWidth,+ contentAlign,+ headingTextStyle,+ blockSpacingStyle,+}: HeadingLinksRendererProps): ReactElement {+ const t = useTranslator();+ const copiedLabel = t('@astryx.markdownHeadingLinks.copied');+ const copyLabel = t('@astryx.markdownHeadingLinks.copy', {+ heading: headingLabel || headingId,+ });+ const {copy, isCopied} = useClipboard({+ announce: copiedLabel,+ resetAfterMs: COPY_FEEDBACK_MS,+ });+ const {getContainerProps, getContentRevealProps} = useContainerReveal();+ const handleClick = useCallback(+ (event: MouseEvent<HTMLButtonElement>) => {+ if (!isUnmodifiedPrimaryActivation(event)) {+ return;+ }+ // This is deliberately an honest copy button rather than an anchor: the+ // heading remains an incoming fragment target, while activating the #+ // never mutates location, scrolls, or implies open-in-new-tab semantics.+ void copy(new URL(permalinkUrl, window.location.href).href);+ },+ [copy, permalinkUrl],+ );++ return (+ <div+ {...mergeProps(+ getContainerProps(),+ stylex.props(+ styles.row,+ headingTextStyle,+ blockSpacingStyle,+ contentWidth != null ? dynamicStyles.proseWidth(contentWidth) : null,+ contentAlign !== 'start'+ ? dynamicStyles.proseAlign(ALIGN_MARGIN[contentAlign])+ : null,+ ),+ )}>+ {children}+ <span {...stylex.props(styles.controlSlot)}>+ <span aria-hidden="true" {...stylex.props(styles.baselineProbe)}>+ #+ </span>+ <Button+ type="button"+ variant="ghost"+ size="sm"+ label={isCopied ? copiedLabel : copyLabel}+ icon={+ <span aria-hidden="true" {...stylex.props(styles.glyph)}>+ {isCopied ? <Icon icon="check" size="sm" color="inherit" /> : '#'}+ </span>+ }+ isIconOnly+ onClick={handleClick}+ xstyle={[styles.copyButton, rtlStyles.centerInline('-50%')]}+ {...getContentRevealProps({isLayoutPreserved: true})}+ />+ </span>+ </div>+ );+}diff --git a/packages/core/src/Markdown/plugins/headingLinks.ssr.test.tsx b/packages/core/src/Markdown/plugins/headingLinks.ssr.test.tsxindex bda740dda6..ba2d834fbb 100644--- a/packages/core/src/Markdown/plugins/headingLinks.ssr.test.tsx+++ b/packages/core/src/Markdown/plugins/headingLinks.ssr.test.tsx@@ -22,7 +22,7 @@ afterEach(() => {});describe('Markdown heading links — SSR', () => {- it('keeps duplicate-copy namespaced ids stable across SSR and hydration', async () => {+ it('keeps duplicate-copy ids and buttons stable across SSR and hydration', async () => {vi.resetModules();const duplicateCore = await import('./headingLinks');const articleAHeadingLinks = duplicateCore.createMarkdownHeadingLinks({@@ -43,9 +43,9 @@ describe('Markdown heading links — SSR', () => {);const serverHTML = renderToString(tree);expect(serverHTML).toContain('id="article-a--overview"');- expect(serverHTML).toContain('id="article-a--details"');expect(serverHTML).toContain('id="article-b--overview"');- expect(serverHTML).toContain('id="article-b--details"');+ expect(serverHTML).toContain('aria-label="Copy link to Details"');+ expect(serverHTML).not.toContain('href="#article-');const container = document.createElement('div');container.innerHTML = serverHTML;diff --git a/packages/core/src/Markdown/plugins/headingLinks.test.tsx b/packages/core/src/Markdown/plugins/headingLinks.test.tsxindex 3ee03ffc40..3da794df16 100644--- a/packages/core/src/Markdown/plugins/headingLinks.test.tsx+++ b/packages/core/src/Markdown/plugins/headingLinks.test.tsx@@ -3,13 +3,33 @@/*** @file headingLinks.test.tsx* @input Markdown and Outline with the first-party heading-links plugin- * @output Identity, projection, compatibility, and custom-renderer evidence+ * @output Identity, rendering, routing, i18n, and custom-renderer evidence* @position Acceptance tests for module:Markdown/headingLinks*/-import {render, screen} from '@testing-library/react';-import type {ReactNode} from 'react';-import {describe, expect, expectTypeOf, it, vi} from 'vitest';+import {+ act,+ fireEvent,+ render,+ renderHook,+ screen,+ waitFor,+} from '@testing-library/react';+import userEvent from '@testing-library/user-event';+import type {ComponentProps, ReactNode} from 'react';+import {+ afterEach,+ beforeEach,+ describe,+ expect,+ expectTypeOf,+ it,+ vi,+} from 'vitest';+import {__resetLiveRegionsForTest} from '../../hooks/useAnnounce';+import {useContainerReveal} from '../../hooks/useContainerReveal';+import {LinkProvider} from '../../Link/LinkProvider';+import {InternationalizationProvider} from '../../i18n';import {parseOutlineFromMarkdown} from '../../Outline/parseOutlineFromMarkdown';import {Markdown} from '../Markdown';import {createMarkdownHeadingLinks} from './index';@@ -96,6 +116,12 @@ const incompatibleHeadingLinksEntries: ReadonlyArray<'newer module configuration',createBrandedSameNameEntry({config: createConfig({apiVersion: 2})}),],+ [+ 'unparseable URL configuration',+ createBrandedSameNameEntry({+ config: createConfig({permalinkBaseUrl: 'https://%'}),+ }),+ ],['wrong module configuration shape',createBrandedSameNameEntry({@@ -104,16 +130,33 @@ const incompatibleHeadingLinksEntries: ReadonlyArray<],];+function clipboardWrite(): ReturnType<typeof vi.fn> {+ return navigator.clipboard.writeText as ReturnType<typeof vi.fn>;+}+describe('createMarkdownHeadingLinks', () => {+ beforeEach(() => {+ Object.defineProperty(navigator, 'clipboard', {+ configurable: true,+ value: {writeText: vi.fn().mockResolvedValue(undefined)},+ });+ });++ afterEach(() => {+ __resetLiveRegionsForTest();+ vi.useRealTimers();+ vi.restoreAllMocks();+ });it('returns an ordinary public plugin entry', () => {expectTypeOf(headingLinks).toMatchTypeOf<MarkdownPluginEntry<never>>();});- it('carries its namespace across a duplicate compatible Core copy', async () => {+ it('carries namespace and URL options across a duplicate compatible Core copy', async () => {vi.resetModules();const duplicateCore = await import('./headingLinks');const portableEntry = duplicateCore.createMarkdownHeadingLinks({headingIdPrefix: 'portable',+ permalinkBaseUrl: '/reader?document=42#stale',});const source = '> # Nested\n\n# Root';@@ -123,9 +166,17 @@ describe('createMarkdownHeadingLinks', () => {'id','portable--nested',);- expect(screen.getByRole('heading', {name: 'Root'})).toHaveAttribute(- 'id',- 'portable--root',+ const copyButton = screen.getByRole('button', {+ name: 'Copy link to Nested',+ });+ expect(copyButton).not.toHaveAttribute('href');+ await act(async () => {+ fireEvent.click(copyButton);+ await Promise.resolve();+ });+ expect(clipboardWrite()).toHaveBeenCalledWith(+ new URL('/reader?document=42#portable--nested', window.location.href)+ .href,);expect(parseOutlineFromMarkdown(source, {plugins: [portableEntry]}),@@ -163,9 +214,10 @@ describe('createMarkdownHeadingLinks', () => {expect(nested).not.toHaveAttribute('id');expect(root).toHaveAttribute('id', 'root');+ expect(screen.queryByRole('button', {name: /Copy link/})).toBeNull();});- it('projects a stable id for every semantic heading level without permalink UI', () => {+ it('links every semantic heading level', () => {render(<Markdown plugins={[headingLinks]}>{Array.from(@@ -176,11 +228,17 @@ describe('createMarkdownHeadingLinks', () => {);for (let level = 1; level <= 6; level += 1) {- expect(- screen.getByRole('heading', {level, name: `Level ${level}`}),- ).toHaveAttribute('id', `level-${level}`);+ const heading = screen.getByRole('heading', {+ level,+ name: `Level ${level}`,+ });+ expect(heading).toHaveAttribute('id', `level-${level}`);+ const copyButton = screen.getByRole('button', {+ name: `Copy link to Level ${level}`,+ });+ expect(copyButton).not.toHaveAttribute('href');+ expect(copyButton).toHaveTextContent('#');}- expect(screen.queryByRole('link')).toBeNull();});it('shares one depth-first allocator while Outline remains root-only', () => {@@ -228,15 +286,6 @@ describe('createMarkdownHeadingLinks', () => {);});- it('uses a stable section fallback when the label has no slug text', () => {- render(- <Markdown plugins={[headingLinks]} sources={{cite: {title: 'Citation'}}}>- {'# [cite]'}- </Markdown>,- );- expect(screen.getByRole('heading')).toHaveAttribute('id', 'section');- });-it('uses a caller-owned namespace across Markdown and Outline', () => {const source = '# Overview\n\n## Details';const namespaced = createMarkdownHeadingLinks({@@ -259,15 +308,317 @@ describe('createMarkdownHeadingLinks', () => {]);});- it('rejects a non-string namespace', () => {+ it('renders one honest sibling copy button for every owned heading', () => {+ render(+ <Markdown plugins={[headingLinks]}>+ {'# Overview\n\n> ## Nested details'}+ </Markdown>,+ );+ const headings = screen.getAllByRole('heading');+ const copyButtons = screen.getAllByRole('button', {name: /Copy link to/});++ expect(headings.map(heading => heading.id)).toEqual([+ 'overview',+ 'nested-details',+ ]);+ expect(copyButtons).toHaveLength(headings.length);+ headings.forEach((heading, index) => {+ expect(heading).not.toContainElement(copyButtons[index]);+ expect(heading.parentElement).toContainElement(copyButtons[index]);+ expect(copyButtons[index]).toHaveAttribute('type', 'button');+ expect(copyButtons[index]).not.toHaveAttribute('href');+ });+ });++ it('wires the heading row and button to canonical container reveal', () => {+ const {result} = renderHook(() => useContainerReveal());+ const containerClasses = result.current+ .getContainerProps()+ .className?.split(/\s+/)+ .filter(Boolean);+ const contentClasses = result.current+ .getContentRevealProps({isLayoutPreserved: true})+ .className?.split(/\s+/)+ .filter(Boolean);+ render(<Markdown plugins={[headingLinks]}>{'# Overview'}</Markdown>);+ const heading = screen.getByRole('heading', {name: 'Overview'});+ const copyButton = screen.getByRole('button', {+ name: 'Copy link to Overview',+ });++ expect(containerClasses).toBeTruthy();+ expect(contentClasses).toBeTruthy();+ for (const className of containerClasses ?? []) {+ expect(heading.parentElement).toHaveClass(className);+ }+ for (const className of contentClasses ?? []) {+ expect(copyButton).toHaveClass(className);+ }+ });++ it('copies the canonical URL, shows fixed-space confirmation, announces, and restores', async () => {+ vi.useFakeTimers();+ render(<Markdown plugins={[headingLinks]}>{'# Overview'}</Markdown>);+ const permalink = screen.getByRole('button', {+ name: 'Copy link to Overview',+ });+ const canonicalUrl = new URL('#overview', window.location.href).href;+ const locationBefore = window.location.href;+ const scrollBefore = {x: window.scrollX, y: window.scrollY};++ await act(async () => {+ fireEvent.click(permalink);+ await Promise.resolve();+ });++ expect(window.location.href).toBe(locationBefore);+ expect({x: window.scrollX, y: window.scrollY}).toEqual(scrollBefore);+ expect(clipboardWrite()).toHaveBeenCalledWith(canonicalUrl);+ expect(permalink).toHaveAccessibleName('Link copied');+ expect(permalink.querySelector('.astryx-icon')).toBeInTheDocument();++ await act(async () => {+ vi.advanceTimersByTime(20);+ await Promise.resolve();+ });+ expect(+ document.querySelector('[data-astryx-live-region="polite"]'),+ ).toHaveTextContent('Link copied');++ act(() => {+ vi.advanceTimersByTime(1480);+ });+ expect(permalink).toHaveAccessibleName('Copy link to Overview');+ expect(permalink).toHaveTextContent('#');+ });++ it('fails softly without navigation when clipboard writing rejects', async () => {+ clipboardWrite().mockRejectedValueOnce(new Error('clipboard denied'));+ render(<Markdown plugins={[headingLinks]}>{'# Overview'}</Markdown>);+ const permalink = screen.getByRole('button', {+ name: 'Copy link to Overview',+ });+ const locationBefore = window.location.href;++ await act(async () => {+ fireEvent.click(permalink);+ await Promise.resolve();+ });++ expect(window.location.href).toBe(locationBefore);+ expect(permalink).toHaveAccessibleName('Copy link to Overview');+ expect(permalink).toHaveTextContent('#');+ expect(+ document.querySelector('[data-astryx-live-region="polite"]'),+ ).toBeNull();+ });++ it('fails softly when the Clipboard API is unavailable', async () => {+ Object.defineProperty(navigator, 'clipboard', {+ configurable: true,+ value: undefined,+ });+ render(<Markdown plugins={[headingLinks]}>{'# Overview'}</Markdown>);+ const permalink = screen.getByRole('button', {+ name: 'Copy link to Overview',+ });+ const locationBefore = window.location.href;++ await act(async () => {+ fireEvent.click(permalink);+ await Promise.resolve();+ });++ expect(window.location.href).toBe(locationBefore);+ expect(permalink).toHaveAccessibleName('Copy link to Overview');+ expect(permalink).toHaveTextContent('#');+ });++ it('ignores modified and non-primary pointer activation', () => {+ render(<Markdown plugins={[headingLinks]}>{'# Overview'}</Markdown>);+ const permalink = screen.getByRole('button', {+ name: 'Copy link to Overview',+ });++ expect(fireEvent.click(permalink, {ctrlKey: true})).toBe(true);+ expect(fireEvent.click(permalink, {metaKey: true})).toBe(true);+ expect(fireEvent.click(permalink, {shiftKey: true})).toBe(true);+ expect(fireEvent.click(permalink, {altKey: true})).toBe(true);+ expect(fireEvent.click(permalink, {button: 1})).toBe(true);+ expect(clipboardWrite()).not.toHaveBeenCalled();+ });++ it('copies on keyboard Enter and Space without navigation semantics', async () => {+ const user = userEvent.setup();+ render(<Markdown plugins={[headingLinks]}>{'# Keyboard target'}</Markdown>);+ const permalink = screen.getByRole('button', {+ name: 'Copy link to Keyboard target',+ });+ const canonicalUrl = new URL('#keyboard-target', window.location.href).href;+ permalink.focus();++ await user.keyboard('{Enter}');++ await waitFor(async () => {+ expect(await navigator.clipboard.readText()).toBe(canonicalUrl);+ });+ expect(permalink).toHaveFocus();+ expect(permalink).toHaveAttribute('type', 'button');+ expect(permalink).not.toHaveAttribute('href');++ await navigator.clipboard.writeText('sentinel');+ await user.keyboard(' ');+ await waitFor(async () => {+ expect(await navigator.clipboard.readText()).toBe(canonicalUrl);+ });+ expect(permalink).toHaveFocus();+ });++ it('keeps one feedback timer across re-click and clears it on unmount', async () => {+ vi.useFakeTimers();+ const clearTimer = vi.spyOn(globalThis, 'clearTimeout');+ const {unmount} = render(+ <Markdown plugins={[headingLinks]}>{'# Overview'}</Markdown>,+ );+ const permalink = screen.getByRole('button', {+ name: 'Copy link to Overview',+ });++ await act(async () => {+ fireEvent.click(permalink);+ await Promise.resolve();+ });+ act(() => {+ vi.advanceTimersByTime(1000);+ });+ await act(async () => {+ fireEvent.click(permalink);+ await Promise.resolve();+ });+ expect(clearTimer).toHaveBeenCalled();++ act(() => {+ vi.advanceTimersByTime(600);+ });+ expect(permalink).toHaveAccessibleName('Link copied');+ const clearsBeforeUnmount = clearTimer.mock.calls.length;+ unmount();+ expect(clearTimer.mock.calls.length).toBeGreaterThan(clearsBeforeUnmount);+ });++ it('keeps authored heading links valid instead of nesting anchors', () => {+ const {container} = render(+ <Markdown plugins={[headingLinks]}>+ {'# Read the [guide](https://example.com/guide)'}+ </Markdown>,+ );+ const heading = screen.getByRole('heading', {name: 'Read the guide'});++ expect(heading.querySelectorAll('a')).toHaveLength(1);+ expect(+ heading.parentElement?.querySelectorAll(':scope > span > button'),+ ).toHaveLength(1);+ expect(container.querySelector('a a')).toBeNull();+ });++ it('uses honest button semantics outside product link routing', async () => {+ const onLinkClick = vi.fn();+ const ProviderLink = ({children, ...linkProps}: ComponentProps<'a'>) => (+ <a data-provider-link {...linkProps}>+ {children}+ </a>+ );+ render(+ <LinkProvider component={ProviderLink}>+ <Markdown onLinkClick={onLinkClick} plugins={[headingLinks]}>+ {'# Overview'}+ </Markdown>+ </LinkProvider>,+ );++ const permalink = screen.getByRole('button', {+ name: 'Copy link to Overview',+ });+ expect(permalink.tagName).toBe('BUTTON');+ expect(permalink).not.toHaveAttribute('href');+ expect(permalink).not.toHaveAttribute('data-provider-link');+ await act(async () => {+ fireEvent.click(permalink);+ await Promise.resolve();+ });+ expect(onLinkClick).not.toHaveBeenCalled();+ });++ it('localizes the copy action and copied names through module keys', async () => {+ render(+ <InternationalizationProvider+ locale="fr"+ overrides={{+ fr: {+ '@astryx.markdownHeadingLinks.copied': 'Lien copié',+ '@astryx.markdownHeadingLinks.copy':+ 'Copier le lien vers {heading}',+ },+ }}>+ <Markdown plugins={[headingLinks]}>{'# Aperçu'}</Markdown>+ </InternationalizationProvider>,+ );+ const permalink = screen.getByRole('button', {+ name: 'Copier le lien vers Aperçu',+ });+ expect(permalink).not.toHaveAttribute('href');++ await act(async () => {+ fireEvent.click(permalink);+ await Promise.resolve();+ });+ expect(permalink).toHaveAccessibleName('Lien copié');+ });++ it('uses a stable section fallback when the label has no slug text', () => {+ render(+ <Markdown plugins={[headingLinks]} sources={{cite: {title: 'Citation'}}}>+ {'# [cite]'}+ </Markdown>,+ );+ expect(screen.getByRole('heading')).toHaveAttribute('id', 'section');+ expect(+ screen.getByRole('button', {name: 'Copy link to section'}),+ ).toHaveTextContent('#');+ });++ it('keeps namespaces inside copied URLs and sanitizes optional bases', async () => {+ const namespace = ['java', 'script:alert(1)'].join('');+ const routed = createMarkdownHeadingLinks({+ headingIdPrefix: namespace,+ permalinkBaseUrl: '/reader?document=42#stale',+ });+ render(<Markdown plugins={[routed]}>{'# Overview'}</Markdown>);++ const copyButton = screen.getByRole('button', {+ name: 'Copy link to Overview',+ });+ await act(async () => {+ fireEvent.click(copyButton);+ await Promise.resolve();+ });+ expect(clipboardWrite()).toHaveBeenCalledWith(+ new URL(+ `/reader?document=42#${namespace}--overview`,+ window.location.href,+ ).href,+ );+ expect(() =>+ createMarkdownHeadingLinks({permalinkBaseUrl: 'javascript:alert(1)'}),+ ).toThrow(/safe, parseable navigation URL/);expect(() =>- createMarkdownHeadingLinks({headingIdPrefix: 42 as unknown as string}),- ).toThrow(/headingIdPrefix must be a string/);+ createMarkdownHeadingLinks({permalinkBaseUrl: 'https://%'}),+ ).toThrow(/safe, parseable navigation URL/);});- it('gives custom heading renderers ids at every depth without imposing anatomy', () => {+ it('leaves permalink output to a custom heading renderer at every depth', () => {const received: (string | undefined)[] = [];- const {container} = render(+ render(<Markdownplugins={[headingLinks]}components={{@@ -281,16 +632,6 @@ describe('createMarkdownHeadingLinks', () => {);expect(received).toEqual(['nested', 'root']);- expect(container.querySelectorAll('h2')).toHaveLength(2);- expect(screen.queryByRole('link')).toBeNull();- });-- it('preserves released no-plugin identity and nested-heading behavior', () => {- render(<Markdown>{'> # Nested\n\n# Root'}</Markdown>);- const [nested, root] = screen.getAllByRole('heading');-- expect(nested).not.toHaveAttribute('id');- expect(root).toHaveAttribute('id', 'root');- expect(screen.queryByRole('link')).toBeNull();+ expect(screen.queryByRole('button', {name: /Copy link to/})).toBeNull();});});diff --git a/packages/core/src/Markdown/plugins/headingLinks.ts b/packages/core/src/Markdown/plugins/headingLinks.tsindex ce56be4793..0a4a3abd06 100644--- a/packages/core/src/Markdown/plugins/headingLinks.ts+++ b/packages/core/src/Markdown/plugins/headingLinks.ts@@ -2,13 +2,14 @@/*** @file headingLinks.ts- * @input Transformed Markdown headings plus an optional caller namespace- * @output First-party heading-links plugin and its deterministic identity projection+ * @input Transformed Markdown headings plus optional namespace and URL base+ * @output First-party heading-links plugin and its deterministic projection* @position Public server-safe module built on the canonical Markdown plugin protocol*/import {markdownAstText, visitMarkdownNodes} from '../ast';import type {MarkdownAstHeading, MarkdownAstRoot} from '../ast';+import {sanitizeMarkdownLinkUrl} from '../url';import {createMarkdownPlugin,getMarkdownPluginDefinition,@@ -31,13 +32,17 @@ export interface MarkdownHeadingLinksOptions {* namespace. Omit it to keep unprefixed fragments for a single document.*/readonly headingIdPrefix?: string;+ /**+ * Optional caller-owned URL before the generated `#fragment`. Omit it to copy+ * an absolute URL for the current document. Any existing fragment is replaced.+ */+ readonly permalinkBaseUrl?: string;}interface PortableMarkdownHeadingLinksConfig {readonly kind: typeof PORTABLE_CONFIG_KIND;readonly apiVersion: 1;readonly headingIdPrefix?: string;- /** Reserved for the separately reviewed renderer layer. */readonly permalinkBaseUrl: string;}@@ -45,6 +50,7 @@ interface PortableMarkdownHeadingLinksConfig {export interface MarkdownHeadingLinksProjection {readonly ids: ReadonlyMap<Heading, string>;readonly labels: ReadonlyMap<Heading, string>;+ readonly permalinkUrls: ReadonlyMap<Heading, string>;}const identityTransform = markMarkdownTransformTrusted(root => root);@@ -81,15 +87,27 @@ function uniqueHeadingSlug(function createPortableConfig(headingIdPrefix: string | undefined,+ permalinkBaseUrl: string,): PortableMarkdownHeadingLinksConfig {return Object.freeze({kind: PORTABLE_CONFIG_KIND,apiVersion: 1 as const,headingIdPrefix,- permalinkBaseUrl: '',+ permalinkBaseUrl,});}+const PERMALINK_VALIDATION_BASE = 'https://astryx.invalid/';++function isParsablePermalinkBaseUrl(url: string): boolean {+ try {+ new URL(url, PERMALINK_VALIDATION_BASE);+ return true;+ } catch {+ return false;+ }+}+function readPortableConfig(entry: MarkdownPluginEntry,): PortableMarkdownHeadingLinksConfig | undefined {@@ -111,7 +129,12 @@ function readPortableConfig(config.apiVersion !== 1 ||(config.headingIdPrefix !== undefined &&typeof config.headingIdPrefix !== 'string') ||- typeof config.permalinkBaseUrl !== 'string'+ typeof config.permalinkBaseUrl !== 'string' ||+ config.permalinkBaseUrl.includes('#') ||+ !isParsablePermalinkBaseUrl(config.permalinkBaseUrl) ||+ (config.permalinkBaseUrl !== '' &&+ sanitizeMarkdownLinkUrl(config.permalinkBaseUrl) !==+ config.permalinkBaseUrl)) {return undefined;}@@ -119,9 +142,10 @@ function readPortableConfig(}/**- * Create the opt-in plugin that gives every rendered h1–h6 a stable identity.- * The entry is safe to share between Markdown and Markdown-derived Outline,- * including consumers loaded from another compatible Core package copy.+ * Create the opt-in plugin that gives every rendered h1–h6 a stable identity+ * and an inline sibling copy button for each built-in heading. The entry is safe+ * to share between Markdown and Markdown-derived Outline, including compatible+ * Core package copies.*/export function createMarkdownHeadingLinks(options: MarkdownHeadingLinksOptions = {},@@ -132,6 +156,23 @@ export function createMarkdownHeadingLinks() {fail('headingIdPrefix must be a string');}+ if (+ options.permalinkBaseUrl !== undefined &&+ typeof options.permalinkBaseUrl !== 'string'+ ) {+ fail('permalinkBaseUrl must be a string');+ }++ const rawBaseUrl = options.permalinkBaseUrl ?? '';+ const sanitizedBaseUrl =+ rawBaseUrl === '' ? '' : sanitizeMarkdownLinkUrl(rawBaseUrl);+ if (+ sanitizedBaseUrl == null ||+ !isParsablePermalinkBaseUrl(sanitizedBaseUrl)+ ) {+ fail('permalinkBaseUrl must be a safe, parseable navigation URL');+ }+ const permalinkBaseUrl = sanitizedBaseUrl.replace(/#.*$/u, '');const definition = {name: PLUGIN_NAME,@@ -141,7 +182,7 @@ export function createMarkdownHeadingLinks(Object.defineProperty(definition, portableConfigKey, {configurable: false,enumerable: false,- value: createPortableConfig(options.headingIdPrefix),+ value: createPortableConfig(options.headingIdPrefix, permalinkBaseUrl),writable: false,});return createMarkdownPlugin(definition);@@ -174,6 +215,7 @@ export function projectMarkdownHeadingLinks(const ids = new Map<Heading, string>();const labels = new Map<Heading, string>();+ const permalinkUrls = new Map<Heading, string>();const counts = new Map<string, number>();visitMarkdownNodes(root, 'heading', heading => {@@ -187,7 +229,8 @@ export function projectMarkdownHeadingLinks(: slug;ids.set(heading, id);labels.set(heading, label);+ permalinkUrls.set(heading, `${config.permalinkBaseUrl}#${id}`);});- return {ids, labels};+ return {ids, labels, permalinkUrls};}