markstream-react 0.0.44 → 0.0.46

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 (36) hide show
  1. package/README.md +22 -0
  2. package/dist/Tooltip-DQ6sUeEf.js +205 -0
  3. package/dist/customHtmlTag-BRT4eqd8.js +3 -0
  4. package/dist/index-DOjYeelM.js +86 -0
  5. package/dist/index.css +1 -1
  6. package/dist/index.d.ts +3 -3
  7. package/dist/index.js +1 -1
  8. package/dist/index.px.css +1 -1
  9. package/dist/index.tailwind.css +1 -1
  10. package/dist/markstream-react.css +1 -1
  11. package/dist/next.d.ts +27 -11
  12. package/dist/next.js +1 -1
  13. package/dist/server.d.ts +23 -9
  14. package/dist/server.js +1 -1
  15. package/dist/tailwind.ts +1 -1
  16. package/dist/types/components/HtmlBlockNode/HtmlBlockNode.d.ts +5 -0
  17. package/dist/types/components/HtmlInlineNode/HtmlInlineNode.d.ts +4 -1
  18. package/dist/types/components/InfographicBlockNode/height.d.ts +5 -0
  19. package/dist/types/components/MermaidBlockNode/height.d.ts +6 -0
  20. package/dist/types/customComponents.d.ts +9 -1
  21. package/dist/types/index.d.ts +3 -3
  22. package/dist/types/next.d.ts +12 -3
  23. package/dist/types/server-renderer/html.d.ts +1 -2
  24. package/dist/types/server-renderer/index.d.ts +3 -3
  25. package/dist/types/server.d.ts +3 -2
  26. package/dist/types/types/component-props.d.ts +3 -3
  27. package/dist/types/types.d.ts +8 -5
  28. package/dist/types/utils/customHtmlTag.d.ts +16 -0
  29. package/dist/types/utils/htmlToReact.d.ts +9 -0
  30. package/dist/types/utils/normalizeKaTeXRenderInput.d.ts +1 -0
  31. package/dist/workers/mermaidParser.worker.js +1 -1
  32. package/package.json +3 -3
  33. package/dist/Tooltip-CgreNSxF.js +0 -211
  34. package/dist/index-DzmDCKan.js +0 -89
  35. package/dist/languageIcon-CEJktwcf.js +0 -3
  36. package/dist/types/components/SoftBreakNode/SoftBreakNode.d.ts +0 -5
package/README.md CHANGED
@@ -74,6 +74,28 @@ Notes:
74
74
  - These props are forwarded to the built-in Mermaid / D2 / Infographic blocks and to custom `mermaid` / `d2` / `infographic` overrides registered with `setCustomComponents(...)`.
75
75
  - `viewportPriority` applies to those heavy nodes too, so offscreen graphs will not keep doing background work while the text stream is still updating.
76
76
 
77
+ ## Language-specific code block overrides
78
+
79
+ You can register a custom component under a fenced language key without wrapping the generic `code_block` renderer:
80
+
81
+ ```tsx
82
+ import type { NodeComponentProps } from 'markstream-react'
83
+ import { setCustomComponents } from 'markstream-react'
84
+
85
+ function EChartsBlockNode(props: NodeComponentProps<any>) {
86
+ return <div data-language={String(props.node?.language)}>{String(props.node?.code || '')}</div>
87
+ }
88
+
89
+ setCustomComponents('docs', {
90
+ echarts: EChartsBlockNode,
91
+ })
92
+ ```
93
+
94
+ Notes:
95
+ - `echarts` only catches fences whose language is `echarts`.
96
+ - Code block routing priority is exact language key -> built-in `mermaid` / `d2` / `infographic` routes -> `code_block`.
97
+ - Custom `mermaid` / `d2` / `infographic` overrides keep their specialized top-level props; other custom language keys use the normal custom component contract (`node`, `ctx`, `renderNode`, and friends).
98
+
77
99
  ## Mermaid tuning
78
100
 
79
101
  Common `mermaidProps` keys for streaming scenarios: