@slotted/react 0.1.0-beta.42 → 0.1.0-beta.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (298) hide show
  1. package/dist/{app-shell-D54YkU7E.js → app-shell-DsWhsSMU.js} +3 -2
  2. package/dist/app-shell.js +1 -1
  3. package/dist/attachment-TZykYNu5.js +300 -0
  4. package/dist/attachment.js +2 -2
  5. package/dist/{avatar-group-bJaZE1_C.js → avatar-group-Bzmmj2HI.js} +2 -1
  6. package/dist/avatar-group.js +1 -1
  7. package/dist/{carousel-B9nMK7Yf.js → carousel-CRNz-T3g.js} +1 -1
  8. package/dist/carousel.js +1 -1
  9. package/dist/{command-palette-C90CzfQi.js → command-palette-Bgf5tfCI.js} +160 -156
  10. package/dist/command-palette.js +1 -1
  11. package/dist/{data-grid-D106baPp.js → data-grid-DUft3rJb.js} +1 -1
  12. package/dist/data-grid.js +1 -1
  13. package/dist/{data-list-BA0xrySM.js → data-list-Dv3orBtf.js} +15 -15
  14. package/dist/data-list.js +1 -1
  15. package/dist/detail-panel-Cke3ZFU3.js +342 -0
  16. package/dist/detail-panel.js +2 -2
  17. package/dist/docs/action-bar.examples.md +768 -0
  18. package/dist/docs/action-bar.json +74 -50
  19. package/dist/docs/action-bar.md +49 -311
  20. package/dist/docs/app-shell.examples.md +1221 -64
  21. package/dist/docs/app-shell.json +92 -60
  22. package/dist/docs/app-shell.md +92 -57
  23. package/dist/docs/attachment.examples.md +689 -0
  24. package/dist/docs/attachment.json +69 -37
  25. package/dist/docs/attachment.md +44 -203
  26. package/dist/docs/avatar-group.json +111 -23
  27. package/dist/docs/avatar-group.md +487 -28
  28. package/dist/docs/button-group.json +98 -2
  29. package/dist/docs/button-group.md +411 -8
  30. package/dist/docs/calendar.examples.md +512 -0
  31. package/dist/docs/calendar.json +72 -24
  32. package/dist/docs/calendar.md +18 -147
  33. package/dist/docs/carousel.examples.md +868 -0
  34. package/dist/docs/carousel.json +58 -50
  35. package/dist/docs/carousel.md +66 -300
  36. package/dist/docs/cascader.examples.md +1269 -0
  37. package/dist/docs/cascader.json +72 -16
  38. package/dist/docs/cascader.md +78 -154
  39. package/dist/docs/chart.examples.md +734 -24
  40. package/dist/docs/chart.json +93 -13
  41. package/dist/docs/chart.md +28 -7
  42. package/dist/docs/clock.json +71 -15
  43. package/dist/docs/clock.md +326 -21
  44. package/dist/docs/code-block.json +79 -55
  45. package/dist/docs/code-block.md +417 -74
  46. package/dist/docs/color-picker.json +60 -12
  47. package/dist/docs/color-picker.md +245 -22
  48. package/dist/docs/column-manager.examples.md +764 -0
  49. package/dist/docs/column-manager.json +68 -12
  50. package/dist/docs/column-manager.md +44 -203
  51. package/dist/docs/command-palette.examples.md +747 -0
  52. package/dist/docs/command-palette.json +48 -24
  53. package/dist/docs/command-palette.md +60 -339
  54. package/dist/docs/currency-field.examples.md +355 -73
  55. package/dist/docs/currency-field.json +96 -64
  56. package/dist/docs/currency-field.md +57 -50
  57. package/dist/docs/dashboard-grid.examples.md +629 -0
  58. package/dist/docs/dashboard-grid.json +64 -16
  59. package/dist/docs/dashboard-grid.md +34 -152
  60. package/dist/docs/data-list.examples.md +1556 -0
  61. package/dist/docs/data-list.json +58 -18
  62. package/dist/docs/data-list.md +139 -224
  63. package/dist/docs/date-field.examples.md +543 -0
  64. package/dist/docs/date-field.json +64 -24
  65. package/dist/docs/date-field.md +22 -168
  66. package/dist/docs/datetime-field.examples.md +699 -0
  67. package/dist/docs/datetime-field.json +79 -31
  68. package/dist/docs/datetime-field.md +24 -269
  69. package/dist/docs/datetime-range-picker.examples.md +682 -0
  70. package/dist/docs/datetime-range-picker.json +117 -61
  71. package/dist/docs/datetime-range-picker.md +59 -224
  72. package/dist/docs/description-list.examples.md +652 -0
  73. package/dist/docs/description-list.json +49 -25
  74. package/dist/docs/description-list.md +33 -188
  75. package/dist/docs/detail-panel.examples.md +1177 -0
  76. package/dist/docs/detail-panel.json +69 -53
  77. package/dist/docs/detail-panel.md +114 -324
  78. package/dist/docs/entity-picker.examples.md +1037 -0
  79. package/dist/docs/entity-picker.json +66 -18
  80. package/dist/docs/entity-picker.md +56 -246
  81. package/dist/docs/event-calendar.examples.md +749 -49
  82. package/dist/docs/event-calendar.json +46 -22
  83. package/dist/docs/event-calendar.md +81 -11
  84. package/dist/docs/field-group.examples.md +554 -0
  85. package/dist/docs/field-group.json +98 -34
  86. package/dist/docs/field-group.md +55 -133
  87. package/dist/docs/filter-bar.examples.md +772 -0
  88. package/dist/docs/filter-bar.json +41 -25
  89. package/dist/docs/filter-bar.md +42 -246
  90. package/dist/docs/form.examples.md +579 -0
  91. package/dist/docs/form.json +87 -39
  92. package/dist/docs/form.md +53 -177
  93. package/dist/docs/fullscreen.examples.md +558 -0
  94. package/dist/docs/fullscreen.json +58 -18
  95. package/dist/docs/fullscreen.md +50 -169
  96. package/dist/docs/highlight.json +57 -25
  97. package/dist/docs/highlight.md +402 -50
  98. package/dist/docs/icon.json +85 -5
  99. package/dist/docs/icon.md +401 -10
  100. package/dist/docs/image.examples.md +670 -0
  101. package/dist/docs/image.json +44 -28
  102. package/dist/docs/image.md +24 -176
  103. package/dist/docs/import-export-center.examples.md +1280 -0
  104. package/dist/docs/import-export-center.json +67 -27
  105. package/dist/docs/import-export-center.md +121 -226
  106. package/dist/docs/list-item.examples.md +769 -0
  107. package/dist/docs/list-item.json +110 -38
  108. package/dist/docs/list-item.md +84 -201
  109. package/dist/docs/listbox.examples.md +858 -0
  110. package/dist/docs/listbox.json +76 -28
  111. package/dist/docs/listbox.md +41 -263
  112. package/dist/docs/markdown.json +79 -55
  113. package/dist/docs/markdown.md +581 -85
  114. package/dist/docs/media-viewer.examples.md +1038 -0
  115. package/dist/docs/media-viewer.json +70 -15
  116. package/dist/docs/media-viewer.md +84 -135
  117. package/dist/docs/message-scroller.examples.md +1193 -0
  118. package/dist/docs/message-scroller.json +41 -17
  119. package/dist/docs/message-scroller.md +80 -134
  120. package/dist/docs/message.examples.md +944 -0
  121. package/dist/docs/message.json +64 -16
  122. package/dist/docs/message.md +34 -326
  123. package/dist/docs/meter.json +58 -26
  124. package/dist/docs/meter.md +312 -32
  125. package/dist/docs/navigation-menu.examples.md +1107 -0
  126. package/dist/docs/navigation-menu.json +57 -41
  127. package/dist/docs/navigation-menu.md +105 -298
  128. package/dist/docs/notification-center.examples.md +1045 -0
  129. package/dist/docs/notification-center.json +71 -15
  130. package/dist/docs/notification-center.md +76 -266
  131. package/dist/docs/otp-input.examples.md +490 -0
  132. package/dist/docs/otp-input.json +65 -25
  133. package/dist/docs/otp-input.md +20 -191
  134. package/dist/docs/page-header.examples.md +1041 -0
  135. package/dist/docs/page-header.json +75 -43
  136. package/dist/docs/page-header.md +79 -291
  137. package/dist/docs/page.examples.md +633 -0
  138. package/dist/docs/page.json +48 -16
  139. package/dist/docs/page.md +62 -129
  140. package/dist/docs/prompt-composer.examples.md +630 -0
  141. package/dist/docs/prompt-composer.json +66 -18
  142. package/dist/docs/prompt-composer.md +35 -161
  143. package/dist/docs/prose.json +69 -37
  144. package/dist/docs/prose.md +393 -75
  145. package/dist/docs/rating.examples.md +525 -0
  146. package/dist/docs/rating.json +92 -28
  147. package/dist/docs/rating.md +27 -241
  148. package/dist/docs/saved-views.examples.md +1108 -0
  149. package/dist/docs/saved-views.json +53 -21
  150. package/dist/docs/saved-views.md +86 -171
  151. package/dist/docs/scroll-area.examples.md +837 -0
  152. package/dist/docs/scroll-area.json +64 -24
  153. package/dist/docs/scroll-area.md +57 -140
  154. package/dist/docs/section.examples.md +676 -0
  155. package/dist/docs/section.json +68 -20
  156. package/dist/docs/section.md +39 -162
  157. package/dist/docs/segmented-control.examples.md +480 -0
  158. package/dist/docs/segmented-control.json +76 -28
  159. package/dist/docs/segmented-control.md +20 -191
  160. package/dist/docs/side-navigation.examples.md +1468 -0
  161. package/dist/docs/side-navigation.json +53 -53
  162. package/dist/docs/side-navigation.md +79 -354
  163. package/dist/docs/slider.examples.md +505 -0
  164. package/dist/docs/slider.json +91 -51
  165. package/dist/docs/slider.md +47 -212
  166. package/dist/docs/sparkline.json +60 -36
  167. package/dist/docs/sparkline.md +447 -71
  168. package/dist/docs/split-button.examples.md +509 -0
  169. package/dist/docs/split-button.json +73 -41
  170. package/dist/docs/split-button.md +64 -194
  171. package/dist/docs/splitter.examples.md +921 -0
  172. package/dist/docs/splitter.json +94 -46
  173. package/dist/docs/splitter.md +75 -182
  174. package/dist/docs/stat-card.examples.md +725 -0
  175. package/dist/docs/stat-card.json +89 -41
  176. package/dist/docs/stat-card.md +55 -227
  177. package/dist/docs/status-indicator.json +80 -32
  178. package/dist/docs/status-indicator.md +409 -65
  179. package/dist/docs/stepper.json +53 -21
  180. package/dist/docs/stepper.md +369 -48
  181. package/dist/docs/table-of-contents.examples.md +550 -0
  182. package/dist/docs/table-of-contents.json +60 -28
  183. package/dist/docs/table-of-contents.md +70 -205
  184. package/dist/docs/tags-input.examples.md +541 -0
  185. package/dist/docs/tags-input.json +64 -16
  186. package/dist/docs/tags-input.md +15 -262
  187. package/dist/docs/time-field.examples.md +587 -0
  188. package/dist/docs/time-field.json +69 -29
  189. package/dist/docs/time-field.md +21 -223
  190. package/dist/docs/time-picker.json +117 -53
  191. package/dist/docs/time-picker.md +499 -54
  192. package/dist/docs/time-range-picker.examples.md +750 -0
  193. package/dist/docs/time-range-picker.json +139 -75
  194. package/dist/docs/time-range-picker.md +63 -225
  195. package/dist/docs/timeline.examples.md +617 -0
  196. package/dist/docs/timeline.json +44 -28
  197. package/dist/docs/timeline.md +34 -208
  198. package/dist/docs/toolbar.json +56 -16
  199. package/dist/docs/toolbar.md +357 -63
  200. package/dist/docs/top-navigation.examples.md +1206 -140
  201. package/dist/docs/top-navigation.json +49 -33
  202. package/dist/docs/top-navigation.md +87 -36
  203. package/dist/docs/tour.examples.md +960 -0
  204. package/dist/docs/tour.json +57 -25
  205. package/dist/docs/tour.md +60 -244
  206. package/dist/docs/transfer.examples.md +631 -0
  207. package/dist/docs/transfer.json +80 -16
  208. package/dist/docs/transfer.md +41 -170
  209. package/dist/docs/typography.json +96 -0
  210. package/dist/docs/typography.md +352 -4
  211. package/dist/docs/upload.examples.md +555 -53
  212. package/dist/docs/upload.json +62 -30
  213. package/dist/docs/upload.md +46 -11
  214. package/dist/docs/wizard.examples.md +1389 -0
  215. package/dist/docs/wizard.json +89 -49
  216. package/dist/docs/wizard.md +122 -263
  217. package/dist/{entity-picker-CC4VoC3p.js → entity-picker-C78f3Z0o.js} +9 -6
  218. package/dist/entity-picker.js +1 -1
  219. package/dist/{event-calendar-CjmF_e0H.js → event-calendar-DJPoCi-O.js} +1 -1
  220. package/dist/event-calendar.js +1 -1
  221. package/dist/{filter-bar-B3QJD7SZ.js → filter-bar-D61wiQFP.js} +1 -1
  222. package/dist/filter-bar.js +1 -1
  223. package/dist/{import-export-center-CW8YVZev.js → import-export-center-mqvmlzwB.js} +44 -36
  224. package/dist/import-export-center.js +1 -1
  225. package/dist/index.js +58 -58
  226. package/dist/{markdown-BdskE4-L.js → markdown-8CtV4k44.js} +2 -2
  227. package/dist/markdown.js +1 -1
  228. package/dist/{media-viewer-zEXcwfEY.js → media-viewer-C_cbuAq-.js} +64 -60
  229. package/dist/media-viewer.js +2 -2
  230. package/dist/message-P91bEGyV.js +455 -0
  231. package/dist/message.js +2 -2
  232. package/dist/{page-header-DmwBGwlm.js → page-header-jeAIQSZM.js} +103 -108
  233. package/dist/page-header.js +1 -1
  234. package/dist/section-CVTQdWBl.js +216 -0
  235. package/dist/section.js +2 -2
  236. package/dist/{segmented-control-CbK7SurB.js → segmented-control-BSMVjukr.js} +1 -1
  237. package/dist/segmented-control.js +1 -1
  238. package/dist/{side-navigation-CKRETc8E.js → side-navigation-BQzBxz2B.js} +179 -179
  239. package/dist/side-navigation.js +1 -1
  240. package/dist/{stat-card-CL3Xe6pV.js → stat-card-BpGZiFbG.js} +12 -14
  241. package/dist/stat-card.js +1 -1
  242. package/dist/{stepper-DHdrANZI.js → stepper-Cxb_tHnA.js} +130 -127
  243. package/dist/stepper.js +2 -2
  244. package/dist/styles/carousel.css +1 -1
  245. package/dist/styles/index.css +1 -1
  246. package/dist/styles.css +1 -1
  247. package/dist/{timeline-BiL2CXfn.js → timeline-ZngK6zLC.js} +9 -6
  248. package/dist/timeline.js +1 -1
  249. package/dist/top-navigation-YSEQzBhD.js +744 -0
  250. package/dist/top-navigation.js +2 -2
  251. package/dist/{transfer-sKUvmEKe.js → transfer-Cv5yQuTN.js} +1 -1
  252. package/dist/transfer.js +1 -1
  253. package/dist/types/attachment/attachment-parts.d.ts +24 -11
  254. package/dist/types/attachment/attachment-parts.d.ts.map +1 -1
  255. package/dist/types/attachment/attachment.d.ts +3 -3
  256. package/dist/types/attachment/attachment.d.ts.map +1 -1
  257. package/dist/types/avatar-group/avatar-group.d.ts.map +1 -1
  258. package/dist/types/carousel/carousel-parts.d.ts +2 -2
  259. package/dist/types/command-palette/command-palette.d.ts.map +1 -1
  260. package/dist/types/data-list/data-list.d.ts.map +1 -1
  261. package/dist/types/detail-panel/detail-panel-parts.d.ts +10 -3
  262. package/dist/types/detail-panel/detail-panel-parts.d.ts.map +1 -1
  263. package/dist/types/detail-panel/detail-panel.d.ts.map +1 -1
  264. package/dist/types/detail-panel/detail-panel.types.d.ts +7 -0
  265. package/dist/types/detail-panel/detail-panel.types.d.ts.map +1 -1
  266. package/dist/types/entity-picker/entity-picker.d.ts.map +1 -1
  267. package/dist/types/import-export-center/import-export-center.d.ts.map +1 -1
  268. package/dist/types/media-viewer/index.d.ts +2 -2
  269. package/dist/types/media-viewer/index.d.ts.map +1 -1
  270. package/dist/types/media-viewer/media-viewer-bar.d.ts +3 -1
  271. package/dist/types/media-viewer/media-viewer-bar.d.ts.map +1 -1
  272. package/dist/types/media-viewer/media-viewer.types.d.ts +1 -0
  273. package/dist/types/media-viewer/media-viewer.types.d.ts.map +1 -1
  274. package/dist/types/message/message-parts.d.ts +7 -0
  275. package/dist/types/message/message-parts.d.ts.map +1 -1
  276. package/dist/types/message/message.d.ts.map +1 -1
  277. package/dist/types/page-header/page-header-parts.d.ts.map +1 -1
  278. package/dist/types/section/section-parts.d.ts +16 -8
  279. package/dist/types/section/section-parts.d.ts.map +1 -1
  280. package/dist/types/section/section.d.ts.map +1 -1
  281. package/dist/types/segmented-control/segmented-control-parts.d.ts.map +1 -1
  282. package/dist/types/side-navigation/side-navigation-parts.d.ts.map +1 -1
  283. package/dist/types/stat-card/stat-card-delta.d.ts.map +1 -1
  284. package/dist/types/stat-card/stat-card-parts.d.ts +3 -3
  285. package/dist/types/stat-card/stat-card-parts.d.ts.map +1 -1
  286. package/dist/types/stepper/stepper-parts.d.ts +11 -2
  287. package/dist/types/stepper/stepper-parts.d.ts.map +1 -1
  288. package/dist/types/stepper/stepper.d.ts.map +1 -1
  289. package/dist/types/timeline/timeline-parts.d.ts.map +1 -1
  290. package/dist/types/top-navigation/top-navigation.d.ts.map +1 -1
  291. package/dist/{wizard-4c0X7Bx_.js → wizard-Dfryz1id.js} +214 -214
  292. package/dist/wizard.js +1 -1
  293. package/package.json +6 -6
  294. package/dist/attachment-MqczA38F.js +0 -292
  295. package/dist/detail-panel-EImAtksY.js +0 -327
  296. package/dist/message-D1Dd6Y2k.js +0 -452
  297. package/dist/section-D_qOfdxR.js +0 -213
  298. package/dist/top-navigation-D8IHPOmm.js +0 -744
@@ -12,14 +12,29 @@ import { completeMarkdown, fromMarkedTokens, prepareMarkdown } from '@slotted/co
12
12
 
13
13
  ## Minimal example
14
14
 
15
- Excerpt — not a complete module
15
+ Example
16
16
 
17
17
  ```tsx
18
- import { marked } from 'marked';
18
+ import { Markdown } from '@slotted/react/markdown';
19
19
 
20
- const tree = fromMarkedTokens(marked.lexer(source));
20
+ const SOURCE = `## Receiving a late pallet
21
21
 
22
- <Markdown headingAnchors tree={tree} />;
22
+ A pallet that arrives after the **dock window** closes is *held* at the gate until a supervisor releases it. Log the arrival in the [receiving queue](/receiving/queue) before moving it.
23
+
24
+ - Scan the pallet label with \`scan --pallet\`.
25
+ - Check the count against the advance ship notice.
26
+ - A difference above 2% goes to the supervisor.
27
+ - Photograph any damaged cartons.
28
+
29
+ > A held pallet blocks its dock door. Release it in the same shift.
30
+
31
+ ---
32
+
33
+ Reviewed by the warehouse operations team.`;
34
+
35
+ export default function MarkdownBasic() {
36
+ return <Markdown source={SOURCE} />;
37
+ }
23
38
  ```
24
39
 
25
40
  ## Anatomy
@@ -40,34 +55,34 @@ const tree = fromMarkedTokens(marked.lexer(source));
40
55
 
41
56
  | Name | Type | Default | Applies to | Description |
42
57
  | --- | --- | --- | --- | --- |
43
- | `tree` | `MarkdownNode \| null` | — | Markdown | The document in mdast; never HTML |
44
- | `source` | `string` | — | Markdown | The document as CommonMark text, read by parseMarkdown in place of tree: the syntax of the types in allow is read and any other stays text. Paragraphs, ATX headings, fenced code, quotes, rules, GFM tables, nested lists, code spans, strong, emphasis, links, images (their URL through transformUrl), escapes and hard breaks; HTML, reference links and footnotes need an adapter |
45
- | `size` | `'md' \| 'lg' \| 'xl'` | lg | Markdown | The region’s type step, from prose |
46
- | `flow` | `'tight' \| 'normal' \| 'loose'` | normal | Markdown | The space between blocks, from prose |
47
- | `status` | `'ready' \| 'error'` | ready | Markdown | error replaces the document with the error part |
48
- | `loading` | `boolean` | false | Markdown | A waiting paragraph, after the skeleton delay |
49
- | `streaming` | `boolean` | false | Markdown | aria-busy while the source arrives |
50
- | `external` | `'new-tab' \| 'same-tab'` | new-tab | Markdown | Where a link that leaves the application opens |
51
- | `headingAnchors` | `boolean` | false | Markdown | A permalink on every heading |
52
- | `headingOffset` | `number` | 0 | Markdown | Added to the level of each heading, up to six |
53
- | `idPrefix` | `string` | | Markdown | Before each generated id; required with two regions on the page |
54
- | `alerts` | `boolean` | true | Markdown | Reads > [!NOTE] and its siblings as alert |
55
- | `allow` | `string[]` | CommonMark + GFM without html | Markdown | The mdast types drawn |
56
- | `unwrapDisallowed` | `boolean` | false | Markdown | A refused type hands its children to the parent |
57
- | `transformUrl` | `(url, kind, node) => string \| null` | safeUrl | Markdown | The URL policy; null refuses |
58
- | `isExternal` | `(href) => boolean` | isExternalUrl | Markdown | Whether a link leaves the application |
59
- | `renderers` | `MarkdownRenderers` | — | Markdown | Replaces the element of a known type |
60
- | `extensions` | `MarkdownExtensions` | — | Markdown | Draws a type the family does not know |
61
- | `messages` | `PartialMessages<MarkdownMessages>` | — | Markdown | The family’s words over the current locale, key by key |
62
- | `empty` | `ReactNode` | — | Markdown | The content of the empty part |
63
- | `render` | `(props) => ReactNode` | — | Markdown | The root as another element: article, section |
64
- | `ref` | `Ref<HTMLDivElement>` | — | Markdown | The root element |
65
- | `MarkdownDefaultsProvider` | `external \| headingAnchors \| alerts \| allow \| transformUrl \| isExternal` | — | Application | Decided once for every document below; a prop wins |
66
- | `prepareMarkdown` | `(tree, options) => MarkdownDocument` | — | @slotted/core/markdown | headings for a table of contents, with the page’s ids |
67
- | `completeMarkdown` | `(source) => string` | — | @slotted/core/markdown | Closes a cut source before the parser |
68
- | `fromMarkedTokens` | `(tokens) => MarkdownNode` | — | @slotted/core/markdown | The marked lexer as mdast |
69
- | `CodeBlockDefaultsProvider` | `highlight` | — | Application | The highlighting engine of each fence |
70
- | `id, aria-*, data-*, on*` | `native props` | — | Markdown | Reach the root |
58
+ | `tree` | `MarkdownNode \| null` | — | Markdown | The document in mdast; never HTML. |
59
+ | `source` | `string` | — | Markdown | The document as CommonMark text, read by parseMarkdown in place of tree: the syntax of the types in allow is read and any other stays text. Paragraphs, ATX headings, fenced code, quotes, rules, GFM tables, nested lists, code spans, strong, emphasis, links, images (their URL through transformUrl), escapes and hard breaks; HTML, reference links and footnotes need an adapter. |
60
+ | `size` | `'md' \| 'lg' \| 'xl'` | lg | Markdown | The region’s type step, from prose. |
61
+ | `flow` | `'tight' \| 'normal' \| 'loose'` | normal | Markdown | The space between blocks, from prose. |
62
+ | `status` | `'ready' \| 'error'` | ready | Markdown | error replaces the document with the error part. |
63
+ | `loading` | `boolean` | false | Markdown | A waiting paragraph, after the skeleton delay. |
64
+ | `streaming` | `boolean` | false | Markdown | aria-busy while the source arrives. |
65
+ | `external` | `'new-tab' \| 'same-tab'` | new-tab | Markdown | Where a link that leaves the application opens. |
66
+ | `headingAnchors` | `boolean` | false | Markdown | A permalink on every heading. |
67
+ | `headingOffset` | `number` | 0 | Markdown | Added to the level of each heading, up to six. |
68
+ | `idPrefix` | `string` | | Markdown | Before each generated id; required with two regions on the page. |
69
+ | `alerts` | `boolean` | true | Markdown | Reads > [!NOTE] and its siblings as alert. |
70
+ | `allow` | `string[]` | CommonMark + GFM without html | Markdown | The mdast types drawn. |
71
+ | `unwrapDisallowed` | `boolean` | false | Markdown | A refused type hands its children to the parent. |
72
+ | `transformUrl` | `(url, kind, node) => string \| null` | safeUrl | Markdown | The URL policy; null refuses. |
73
+ | `isExternal` | `(href) => boolean` | isExternalUrl | Markdown | Whether a link leaves the application. |
74
+ | `renderers` | `MarkdownRenderers` | — | Markdown | Replaces the element of a known type. |
75
+ | `extensions` | `MarkdownExtensions` | — | Markdown | Draws a type Markdown does not know. |
76
+ | `messages` | `PartialMessages<MarkdownMessages>` | — | Markdown | Markdown’s words over the current locale, key by key. |
77
+ | `empty` | `ReactNode` | — | Markdown | The content of the empty part. |
78
+ | `render` | `(props) => ReactNode` | — | Markdown | The root as another element: article, section. |
79
+ | `ref` | `Ref<HTMLDivElement>` | — | Markdown | The root element. |
80
+ | `MarkdownDefaultsProvider` | `external \| headingAnchors \| alerts \| allow \| transformUrl \| isExternal` | — | Application | Decided once for every document below; a prop wins. |
81
+ | `prepareMarkdown` | `(tree, options) => MarkdownDocument` | — | @slotted/core/markdown | headings for a table of contents, with the page’s ids. |
82
+ | `completeMarkdown` | `(source) => string` | — | @slotted/core/markdown | Closes a cut source before the parser. |
83
+ | `fromMarkedTokens` | `(tokens) => MarkdownNode` | — | @slotted/core/markdown | The marked lexer as mdast. |
84
+ | `CodeBlockDefaultsProvider` | `highlight` | — | Application | The highlighting engine of each fence. |
85
+ | `id, aria-*, data-*, on*` | `native props` | — | Markdown | Reach the root. |
71
86
 
72
87
  ## Events
73
88
 
@@ -78,7 +93,7 @@ const tree = fromMarkedTokens(marked.lexer(source));
78
93
 
79
94
  ## Rules
80
95
 
81
- - No source string reaches innerHTML: the family receives a tree, refuses raw HTML and executable schemes by default, and each element is created by the framework.
96
+ - No source string reaches innerHTML: Markdown receives a tree, refuses raw HTML and executable schemes by default, and each element is created by the framework.
82
97
  - The headings are real headings, shiftable with headingOffset to fit the page outline; the anchor stays in the tab order and in the accessibility tree, with the name "Link to section: <heading>".
83
98
  - A task is a checkbox named by the item’s text; without onTaskChange it is aria-readonly, not disabled, so it stays focusable and readable.
84
99
  - Each note reference has aria-describedby pointing to the hidden heading of the section, and each return says which reference it goes back to; a GitHub alert is live="off", because it is content and not an event.
@@ -90,6 +105,20 @@ const tree = fromMarkedTokens(marked.lexer(source));
90
105
 
91
106
  ## Examples
92
107
 
108
+ ### Playground
109
+
110
+ A runbook written in Markdown, passed through the marked lexer and fromMarkedTokens. The controls below the stage move the size, the flow, the anchors and the heading offset.
111
+
112
+ Excerpt — not a complete module
113
+
114
+ ```tsx
115
+ import { marked } from 'marked';
116
+
117
+ const tree = fromMarkedTokens(marked.lexer(source));
118
+
119
+ <Markdown headingAnchors tree={tree} />;
120
+ ```
121
+
93
122
  ### A whole document
94
123
 
95
124
  Headings with a stable id, emphasis, inline code, nested lists, a quote and a rule: all in prose, whose typography is the region’s. Hover a heading to see the anchor; with Tab it appears too.
@@ -104,102 +133,406 @@ Excerpt — not a complete module
104
133
 
105
134
  The :-- and --: alignment arrives as start and end, so a table seen in RTL keeps the prices against the edge where reading ends. A table wider than the column scrolls inside the prose scroll part, which only gains tabindex and a name while it overflows.
106
135
 
107
- Excerpt — not a complete module
136
+ Example
108
137
 
109
- ```markdown
110
- | Plan | Seats | Price |
111
- | :--- | :---: | ------: |
112
- | Team | 10 | $120.00 |
138
+ ```tsx
139
+ import { Markdown } from '@slotted/react/markdown';
140
+ import { Stack } from '@slotted/react/stack';
141
+
142
+ const RATES = `| Carrier | Pickups | Cost per pallet |
143
+ | :--- | :---: | ---: |
144
+ | Northwind Freight | 12 | $48.00 |
145
+ | Harbor Line | 7 | $52.50 |
146
+ | Coastal Express | 3 | $61.25 |`;
147
+
148
+ const LANES = `| Lane | Origin | Destination | Transit | Carrier | Service | Cost per pallet |
149
+ | --- | --- | --- | ---: | --- | --- | ---: |
150
+ | 1042 | Santos | Rotterdam | 18 days | Harbor Line | Ocean, consolidated | $214.00 |
151
+ | 1043 | Santos | Hamburg | 19 days | Coastal Express | Ocean, full container | $231.50 |`;
152
+
153
+ export default function MarkdownTables() {
154
+ return (
155
+ <Stack gap={5}>
156
+ <Markdown size="md" source={RATES} />
157
+ <Markdown size="md" source={LANES} />
158
+ </Stack>
159
+ );
160
+ }
113
161
  ```
114
162
 
115
163
  ### Fences with code-block
116
164
 
117
165
  Each fence is a CodeBlock: the language from the info string, and what comes after it — title="…", {2} and showLineNumbers — arrives as title, highlighted line and numbers. The syntax highlighting is that of the CodeBlockDefaultsProvider.
118
166
 
119
- Excerpt — not a complete module
167
+ Example
168
+
169
+ ```tsx
170
+ import { Markdown } from '@slotted/react/markdown';
171
+
172
+ const SOURCE = `Book a shipment with one call:
173
+
174
+ \`\`\`ts title="ship.ts" {2}
175
+ import { book } from '@northwind/logistics';
176
+ await book({ order: 48213, carrier: 'harbor-line' });
177
+ \`\`\`
120
178
 
121
- ````markdown
122
- ```ts title="deploy.ts" {2} showLineNumbers
123
- import { deploy } from '@acme/cli';
124
- await deploy({ env: 'production' });
179
+ The tracking events are listed with:
180
+
181
+ \`\`\`sh showLineNumbers
182
+ nw track --order 48213
183
+ nw track --order 48213 --since 24h
184
+ \`\`\``;
185
+
186
+ export default function MarkdownCode() {
187
+ return <Markdown size="md" source={SOURCE} />;
188
+ }
125
189
  ```
126
- ````
127
190
 
128
191
  ### Task lists
129
192
 
130
193
  Without onTaskChange the boxes are checkboxes in readOnly: focusable, announced as read only. With it, checking a task requests the change with the index and the offset in the source; the box only moves when the new tree arrives.
131
194
 
132
- Excerpt — not a complete module
195
+ Example
133
196
 
134
197
  ```tsx
135
- <Markdown
136
- onTaskChange={({ index, checked }) => setSource(toggleTask(source, index, checked))}
137
- tree={fromMarkedTokens(marked.lexer(source))}
138
- />;
198
+ import { useState } from 'react';
199
+
200
+ import type { MarkdownNode } from '@slotted/core/markdown';
201
+ import { Markdown } from '@slotted/react/markdown';
202
+ import type { MarkdownTaskChange } from '@slotted/react/markdown';
203
+ import { Stack } from '@slotted/react/stack';
204
+ import { Text } from '@slotted/react/typography';
205
+
206
+ const TASKS = [
207
+ 'Confirm the pickup window',
208
+ 'Print the packing list',
209
+ 'Attach the customs forms',
210
+ 'Release the order',
211
+ ];
212
+
213
+ export default function MarkdownTasks() {
214
+ const [done, setDone] = useState([true, false, false, false]);
215
+
216
+ const tree = toTree(done);
217
+
218
+ function handleTaskChange({ index, checked }: MarkdownTaskChange) {
219
+ setDone((current) => current.map((value, position) => (position === index ? checked : value)));
220
+ }
221
+
222
+ return (
223
+ <Stack gap={5}>
224
+ <Text size="sm" tone="muted">
225
+ With onTaskChange
226
+ </Text>
227
+ <Markdown onTaskChange={handleTaskChange} size="md" tree={tree} />
228
+
229
+ <Text size="sm" tone="muted">
230
+ Without onTaskChange
231
+ </Text>
232
+ <Markdown size="md" tree={tree} />
233
+ </Stack>
234
+ );
235
+ }
236
+
237
+ function toTree(done: readonly boolean[]): MarkdownNode {
238
+ return {
239
+ type: 'root',
240
+ children: [
241
+ {
242
+ type: 'list',
243
+ ordered: false,
244
+ spread: false,
245
+ children: TASKS.map((task, index) => ({
246
+ type: 'listItem',
247
+ checked: done[index] ?? false,
248
+ spread: false,
249
+ children: [{ type: 'paragraph', children: [{ type: 'text', value: task }] }],
250
+ })),
251
+ },
252
+ ],
253
+ };
254
+ }
139
255
  ```
140
256
 
141
257
  ### GitHub alerts
142
258
 
143
259
  > [!NOTE], [!TIP], [!IMPORTANT], [!WARNING] and [!CAUTION] become an alert with reach="section" and live="off" — content, not an announcement — in the tones accent, success, secondary, warning and danger. alerts={false} gives back the quote.
144
260
 
145
- Excerpt — not a complete module
261
+ Example
262
+
263
+ ```tsx
264
+ import { Markdown } from '@slotted/react/markdown';
265
+ import { Stack } from '@slotted/react/stack';
266
+ import { Text } from '@slotted/react/typography';
267
+
268
+ const ALERTS = `> [!NOTE]
269
+ > Pickups are scheduled in the order the requests arrive.
270
+
271
+ > [!TIP]
272
+ > Book before 14:00 to ship the same day.
273
+
274
+ > [!IMPORTANT]
275
+ > Orders above $10,000 need a second approver.
146
276
 
147
- ```markdown
148
277
  > [!WARNING]
149
- > A deployment during a migration waits for the migration to finish.
278
+ > A pickup during a cycle count waits for the count to finish.
279
+
280
+ > [!CAUTION]
281
+ > Canceling a booking releases the reserved dock door.`;
282
+
283
+ const QUOTE = `> [!NOTE]
284
+ > Pickups are scheduled in the order the requests arrive.`;
285
+
286
+ export default function MarkdownAlerts() {
287
+ return (
288
+ <Stack gap={5}>
289
+ <Markdown size="md" source={ALERTS} />
290
+
291
+ <Text size="sm" tone="muted">
292
+ alerts off
293
+ </Text>
294
+ <Markdown alerts={false} size="md" source={QUOTE} />
295
+ </Stack>
296
+ );
297
+ }
150
298
  ```
151
299
 
152
300
  ### Footnotes
153
301
 
154
302
  Numbered by the first reference, with one return arrow per reference inside the last paragraph of the note. The section has a hidden heading that names the set; a definition nobody references is not drawn, as on GitHub.
155
303
 
156
- Excerpt — not a complete module
304
+ Example
157
305
 
158
306
  ```tsx
159
- <Markdown messages={{ footnotes: 'Notas' }} tree={tree} />;
307
+ import type { MarkdownNode } from '@slotted/core/markdown';
308
+ import { Markdown } from '@slotted/react/markdown';
309
+
310
+ const TREE: MarkdownNode = {
311
+ type: 'root',
312
+ children: [
313
+ {
314
+ type: 'paragraph',
315
+ children: [
316
+ { type: 'text', value: 'On-time pickups reached 96%' },
317
+ { type: 'footnoteReference', identifier: 'window' },
318
+ { type: 'text', value: ' after the dock windows were shortened' },
319
+ { type: 'footnoteReference', identifier: 'docks' },
320
+ { type: 'text', value: ', and late fees fell with them' },
321
+ { type: 'footnoteReference', identifier: 'window' },
322
+ { type: 'text', value: '.' },
323
+ ],
324
+ },
325
+ {
326
+ type: 'footnoteDefinition',
327
+ identifier: 'window',
328
+ children: [
329
+ {
330
+ type: 'paragraph',
331
+ children: [{ type: 'text', value: 'A pickup counts as on time within 15 minutes.' }],
332
+ },
333
+ ],
334
+ },
335
+ {
336
+ type: 'footnoteDefinition',
337
+ identifier: 'docks',
338
+ children: [
339
+ {
340
+ type: 'paragraph',
341
+ children: [{ type: 'text', value: 'Windows went from 60 to 30 minutes.' }],
342
+ },
343
+ ],
344
+ },
345
+ {
346
+ type: 'footnoteDefinition',
347
+ identifier: 'unused',
348
+ children: [
349
+ { type: 'paragraph', children: [{ type: 'text', value: 'No text points here.' }] },
350
+ ],
351
+ },
352
+ ],
353
+ };
354
+
355
+ export default function MarkdownFootnotes() {
356
+ return <Markdown size="md" tree={TREE} />;
357
+ }
160
358
  ```
161
359
 
162
360
  ### Internal and external links
163
361
 
164
362
  An absolute http(s) address leaves the application: it is a Link with the glyph and the new-tab hint. A relative path is a plain a. external="same-tab" keeps the tab; isExternal decides which hosts belong to the application.
165
363
 
166
- Excerpt — not a complete module
364
+ Example
167
365
 
168
366
  ```tsx
169
- <Markdown
170
- isExternal={(href) => /^https?:\/\//.test(href) && !href.startsWith('https://acme.example')}
171
- tree={tree}
172
- />;
367
+ import { Markdown } from '@slotted/react/markdown';
368
+ import { Stack } from '@slotted/react/stack';
369
+ import { Text } from '@slotted/react/typography';
370
+
371
+ const SOURCE = `Track the shipment on the [carrier portal](https://portal.harborline.example/tracking), or read the [return policy](https://northwind.example/returns) and the [dock schedule](/docks/schedule).`;
372
+
373
+ const isNorthwindInternal = (href: string) =>
374
+ !/^https?:\/\//.test(href) || href.startsWith('https://northwind.example');
375
+
376
+ export default function MarkdownLinks() {
377
+ return (
378
+ <Stack gap={5}>
379
+ <Text size="sm" tone="muted">
380
+ Default
381
+ </Text>
382
+ <Markdown size="md" source={SOURCE} />
383
+
384
+ <Text size="sm" tone="muted">
385
+ external same-tab
386
+ </Text>
387
+ <Markdown external="same-tab" size="md" source={SOURCE} />
388
+
389
+ <Text size="sm" tone="muted">
390
+ isExternal
391
+ </Text>
392
+ <Markdown isExternal={(href) => !isNorthwindInternal(href)} size="md" source={SOURCE} />
393
+ </Stack>
394
+ );
395
+ }
173
396
  ```
174
397
 
175
398
  ### Sanitization by construction
176
399
 
177
- The family never writes innerHTML. Raw HTML is not drawn; javascript:, data: and the disguised spellings lose the link and stay as text; a refused image stays as its alternative text. transformUrl swaps the policy; allow restricts the types.
400
+ Markdown never writes innerHTML. Raw HTML is not drawn; javascript:, data: and the disguised spellings lose the link and stay as text; a refused image stays as its alternative text. transformUrl swaps the policy; allow restricts the types.
178
401
 
179
- Excerpt — not a complete module
402
+ Example
180
403
 
181
404
  ```tsx
182
- <Markdown
183
- allow={['paragraph', 'text', 'emphasis', 'strong', 'link']}
184
- tree={tree}
185
- unwrapDisallowed
186
- />;
405
+ import type { MarkdownNode } from '@slotted/core/markdown';
406
+ import { Markdown } from '@slotted/react/markdown';
407
+ import { Stack } from '@slotted/react/stack';
408
+ import { Text } from '@slotted/react/typography';
409
+
410
+ const SOURCE = `A message from the supplier portal:
411
+
412
+ <script>alert('x')</script>
413
+
414
+ [Download the invoice](javascript:alert(document.cookie)) ![company logo](data:image/svg+xml;base64,AAAA)
415
+
416
+ A valid link: [shipping terms](https://northwind.example/terms).`;
417
+
418
+ const ALLOW = ['paragraph', 'text', 'emphasis', 'strong', 'link'];
419
+
420
+ const TREE: MarkdownNode = {
421
+ type: 'root',
422
+ children: [
423
+ { type: 'heading', depth: 2, children: [{ type: 'text', value: 'Weekly summary' }] },
424
+ {
425
+ type: 'paragraph',
426
+ children: [
427
+ { type: 'text', value: 'Three pickups were ' },
428
+ { type: 'strong', children: [{ type: 'text', value: 'late' }] },
429
+ { type: 'text', value: '. See the ' },
430
+ {
431
+ type: 'link',
432
+ url: '/reports/late-pickups',
433
+ children: [{ type: 'text', value: 'report' }],
434
+ },
435
+ { type: 'text', value: '.' },
436
+ ],
437
+ },
438
+ {
439
+ type: 'list',
440
+ ordered: false,
441
+ children: [
442
+ {
443
+ type: 'listItem',
444
+ children: [{ type: 'paragraph', children: [{ type: 'text', value: 'Harbor Line' }] }],
445
+ },
446
+ {
447
+ type: 'listItem',
448
+ children: [{ type: 'paragraph', children: [{ type: 'text', value: 'Coastal Express' }] }],
449
+ },
450
+ ],
451
+ },
452
+ ],
453
+ };
454
+
455
+ export default function MarkdownSanitisation() {
456
+ return (
457
+ <Stack gap={5}>
458
+ <Text size="sm" tone="muted">
459
+ Default policy
460
+ </Text>
461
+ <Markdown size="md" source={SOURCE} />
462
+
463
+ <Text size="sm" tone="muted">
464
+ allow with unwrapDisallowed
465
+ </Text>
466
+ <Markdown allow={ALLOW} size="md" tree={TREE} unwrapDisallowed />
467
+ </Stack>
468
+ );
469
+ }
187
470
  ```
188
471
 
189
472
  ### Renderers and extensions
190
473
 
191
- renderers replaces the element of a known type — here the link becomes the application’s router link. extensions draws a type the family does not know: an @name mention that a pass over the tree created. A type without a renderer does not appear.
474
+ renderers replaces the element of a known type — here the link becomes the application’s router link. extensions draws a type Markdown does not know: an @name mention that a pass over the tree created. A type without a renderer does not appear.
192
475
 
193
- Excerpt — not a complete module
476
+ Example
194
477
 
195
478
  ```tsx
196
- <Markdown
197
- extensions={{ mention: ({ element }) => <Tag>@{String(element.node.value)}</Tag> }}
198
- renderers={{
199
- link: ({ element, children }) => <RouterLink to={element.href}>{children}</RouterLink>,
200
- }}
201
- tree={withMentions(tree)}
202
- />;
479
+ import { useState } from 'react';
480
+ import type { MouseEvent } from 'react';
481
+
482
+ import type { MarkdownNode } from '@slotted/core/markdown';
483
+ import { Link } from '@slotted/react/link';
484
+ import { Markdown } from '@slotted/react/markdown';
485
+ import type { MarkdownExtensions, MarkdownRenderers } from '@slotted/react/markdown';
486
+ import { Stack } from '@slotted/react/stack';
487
+ import { Tag } from '@slotted/react/tag';
488
+ import { Text } from '@slotted/react/typography';
489
+
490
+ const TREE: MarkdownNode = {
491
+ type: 'root',
492
+ children: [
493
+ {
494
+ type: 'paragraph',
495
+ children: [
496
+ { type: 'mention', value: 'dana.ortiz' },
497
+ { type: 'text', value: ' approved the carrier change and ' },
498
+ { type: 'mention', value: 'luis.mendes' },
499
+ { type: 'text', value: ' confirms the pickup. The details are in the ' },
500
+ { type: 'link', url: '/orders/48213', children: [{ type: 'text', value: 'order record' }] },
501
+ { type: 'text', value: '.' },
502
+ ],
503
+ },
504
+ ],
505
+ };
506
+
507
+ const EXTENSIONS: MarkdownExtensions = {
508
+ mention: ({ element }) => <Tag size="sm">@{String(element.node.value)}</Tag>,
509
+ };
510
+
511
+ export default function MarkdownRenderersExample() {
512
+ const [route, setRoute] = useState('/');
513
+
514
+ const renderers: MarkdownRenderers = {
515
+ link: ({ element, children }) => (
516
+ <Link href={element.href} onClick={(event) => handleNavigate(event, element.href)}>
517
+ {children}
518
+ </Link>
519
+ ),
520
+ };
521
+
522
+ function handleNavigate(event: MouseEvent<HTMLAnchorElement>, href: string) {
523
+ event.preventDefault();
524
+ setRoute(href);
525
+ }
526
+
527
+ return (
528
+ <Stack gap={4}>
529
+ <Markdown extensions={EXTENSIONS} renderers={renderers} size="md" tree={TREE} />
530
+ <Text size="sm" tone="muted">
531
+ Current route: {route}
532
+ </Text>
533
+ </Stack>
534
+ );
535
+ }
203
536
  ```
204
537
 
205
538
  ### An answer that is still arriving
@@ -220,20 +553,74 @@ Excerpt — not a complete module
220
553
 
221
554
  loading draws a three-line paragraph after the skeleton delay, in the region’s typography; empty writes messages.empty or the consumer’s node; status="error" replaces the document with a message and, with onRetry, a button.
222
555
 
223
- Excerpt — not a complete module
556
+ Example
224
557
 
225
558
  ```tsx
226
- <Markdown
227
- loading={query.isLoading}
228
- onRetry={query.refetch}
229
- status={query.isError ? 'error' : 'ready'}
230
- tree={query.data}
231
- />;
559
+ import { useEffect, useState } from 'react';
560
+
561
+ import { Link } from '@slotted/react/link';
562
+ import { Markdown } from '@slotted/react/markdown';
563
+ import { Stack } from '@slotted/react/stack';
564
+ import { Text } from '@slotted/react/typography';
565
+
566
+ export default function MarkdownStates() {
567
+ const [failed, setFailed] = useState(true);
568
+ const [loading, setLoading] = useState(false);
569
+
570
+ useEffect(() => {
571
+ if (!loading) return undefined;
572
+
573
+ const timer = setTimeout(() => {
574
+ setLoading(false);
575
+ setFailed(true);
576
+ }, 1500);
577
+
578
+ return () => clearTimeout(timer);
579
+ }, [loading]);
580
+
581
+ function handleRetry() {
582
+ setFailed(false);
583
+ setLoading(true);
584
+ }
585
+
586
+ return (
587
+ <Stack gap={5}>
588
+ <Text size="sm" tone="muted">
589
+ loading
590
+ </Text>
591
+ <Markdown loading size="md" tree={null} />
592
+
593
+ <Text size="sm" tone="muted">
594
+ empty
595
+ </Text>
596
+ <Markdown
597
+ empty={
598
+ <>
599
+ No handover notes yet. <Link href="#new-note">Write the first one</Link>.
600
+ </>
601
+ }
602
+ size="md"
603
+ tree={null}
604
+ />
605
+
606
+ <Text size="sm" tone="muted">
607
+ error with onRetry
608
+ </Text>
609
+ <Markdown
610
+ loading={loading}
611
+ onRetry={handleRetry}
612
+ size="md"
613
+ status={failed ? 'error' : 'ready'}
614
+ tree={null}
615
+ />
616
+ </Stack>
617
+ );
618
+ }
232
619
  ```
233
620
 
234
621
  ### On a documentation page
235
622
 
236
- Container gives the measure, prepareMarkdown gives the table of contents with the same ids the page draws, and MarkdownDefaultsProvider says once, in Portuguese, what the family writes.
623
+ Container gives the measure, prepareMarkdown gives the table of contents with the same ids the page draws, and MarkdownDefaultsProvider sets the heading anchors once for every document below.
237
624
 
238
625
  Excerpt — not a complete module
239
626
 
@@ -242,17 +629,126 @@ const { headings } = prepareMarkdown(tree);
242
629
 
243
630
  <MarkdownDefaultsProvider headingAnchors>
244
631
  <Container size="measure">
245
- <Markdown messages={{ footnotes: 'Notas' }} tree={tree} />
632
+ <Markdown messages={{ footnotes: 'Notes' }} tree={tree} />
246
633
  </Container>
247
634
  </MarkdownDefaultsProvider>;
248
635
  ```
249
636
 
250
637
  ### Keyboard and screen reader
251
638
 
252
- Tab goes through the heading anchors, the links, a table that scrolls, the controls of a code block, the editable tasks and the footnote returns. The family adds no key: each stop belongs to a composed family.
639
+ Tab goes through the heading anchors, the links, a table that scrolls, the controls of a code block, the editable tasks and the footnote returns. Markdown adds no key: each stop belongs to a composed family.
253
640
 
254
641
  Excerpt — not a complete module
255
642
 
256
643
  ```tsx
257
644
  <Markdown headingAnchors headingOffset={1} tree={tree} />;
258
645
  ```
646
+
647
+ ### page.tsx
648
+
649
+ Example
650
+
651
+ ```tsx
652
+ import { parseMarkdown, prepareMarkdown } from '@slotted/core/markdown';
653
+ import { Container } from '@slotted/react/container';
654
+ import { Link } from '@slotted/react/link';
655
+ import { Markdown, MarkdownDefaultsProvider } from '@slotted/react/markdown';
656
+ import { Stack } from '@slotted/react/stack';
657
+ import { Heading } from '@slotted/react/typography';
658
+
659
+ const SOURCE = `## Booking the carrier
660
+
661
+ Confirm the pickup window with the carrier before the order is released.
662
+
663
+ ### Documents
664
+
665
+ Attach the commercial invoice and the packing list.
666
+
667
+ ## Pickup
668
+
669
+ The driver scans the pallet label at the dock door.
670
+
671
+ ## Delivery
672
+
673
+ The carrier sends the proof of delivery within two business days.`;
674
+
675
+ const HEADINGS = prepareMarkdown(parseMarkdown(SOURCE), { idPrefix: 'runbook-' }).headings;
676
+
677
+ export default function MarkdownPage() {
678
+ return (
679
+ <Container size="measure">
680
+ <Stack gap={4}>
681
+ <Heading level={2} size="md">
682
+ Carrier runbook
683
+ </Heading>
684
+
685
+ <nav aria-label="On this page">
686
+ <Stack gap={2}>
687
+ {HEADINGS.map((heading) => (
688
+ <Link key={heading.id} href={`#${heading.id}`}>
689
+ {heading.text}
690
+ </Link>
691
+ ))}
692
+ </Stack>
693
+ </nav>
694
+
695
+ <MarkdownDefaultsProvider headingAnchors>
696
+ <Markdown headingOffset={1} idPrefix="runbook-" size="md" source={SOURCE} />
697
+ </MarkdownDefaultsProvider>
698
+ </Stack>
699
+ </Container>
700
+ );
701
+ }
702
+ ```
703
+
704
+ ### sizes.tsx
705
+
706
+ Example
707
+
708
+ ```tsx
709
+ import { Markdown } from '@slotted/react/markdown';
710
+ import { Stack } from '@slotted/react/stack';
711
+ import { Text } from '@slotted/react/typography';
712
+
713
+ const SOURCE = `### Cycle counts
714
+
715
+ Count each aisle twice.
716
+
717
+ Compare both totals with the system.`;
718
+
719
+ export default function MarkdownSizes() {
720
+ return (
721
+ <Stack gap={5}>
722
+ <Text size="sm" tone="muted">
723
+ size md
724
+ </Text>
725
+ <Markdown size="md" source={SOURCE} />
726
+
727
+ <Text size="sm" tone="muted">
728
+ size lg, the default
729
+ </Text>
730
+ <Markdown size="lg" source={SOURCE} />
731
+
732
+ <Text size="sm" tone="muted">
733
+ size xl
734
+ </Text>
735
+ <Markdown size="xl" source={SOURCE} />
736
+
737
+ <Text size="sm" tone="muted">
738
+ flow tight
739
+ </Text>
740
+ <Markdown flow="tight" size="md" source={SOURCE} />
741
+
742
+ <Text size="sm" tone="muted">
743
+ flow normal, the default
744
+ </Text>
745
+ <Markdown flow="normal" size="md" source={SOURCE} />
746
+
747
+ <Text size="sm" tone="muted">
748
+ flow loose
749
+ </Text>
750
+ <Markdown flow="loose" size="md" source={SOURCE} />
751
+ </Stack>
752
+ );
753
+ }
754
+ ```