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.
- package/README.md +22 -0
- package/dist/Tooltip-DQ6sUeEf.js +205 -0
- package/dist/customHtmlTag-BRT4eqd8.js +3 -0
- package/dist/index-DOjYeelM.js +86 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/index.px.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/markstream-react.css +1 -1
- package/dist/next.d.ts +27 -11
- package/dist/next.js +1 -1
- package/dist/server.d.ts +23 -9
- package/dist/server.js +1 -1
- package/dist/tailwind.ts +1 -1
- package/dist/types/components/HtmlBlockNode/HtmlBlockNode.d.ts +5 -0
- package/dist/types/components/HtmlInlineNode/HtmlInlineNode.d.ts +4 -1
- package/dist/types/components/InfographicBlockNode/height.d.ts +5 -0
- package/dist/types/components/MermaidBlockNode/height.d.ts +6 -0
- package/dist/types/customComponents.d.ts +9 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/next.d.ts +12 -3
- package/dist/types/server-renderer/html.d.ts +1 -2
- package/dist/types/server-renderer/index.d.ts +3 -3
- package/dist/types/server.d.ts +3 -2
- package/dist/types/types/component-props.d.ts +3 -3
- package/dist/types/types.d.ts +8 -5
- package/dist/types/utils/customHtmlTag.d.ts +16 -0
- package/dist/types/utils/htmlToReact.d.ts +9 -0
- package/dist/types/utils/normalizeKaTeXRenderInput.d.ts +1 -0
- package/dist/workers/mermaidParser.worker.js +1 -1
- package/package.json +3 -3
- package/dist/Tooltip-CgreNSxF.js +0 -211
- package/dist/index-DzmDCKan.js +0 -89
- package/dist/languageIcon-CEJktwcf.js +0 -3
- 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:
|