markstream-angular 0.0.5 → 0.0.7
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/dist/README.md +117 -0
- package/dist/fesm2022/markstream-angular.mjs +10490 -0
- package/dist/fesm2022/markstream-angular.mjs.map +1 -0
- package/dist/index.css +1363 -1
- package/dist/index.d.ts +1490 -0
- package/package.json +17 -12
- package/dist/index.js +0 -8620
- package/dist/types/index.d.ts +0 -6
- package/dist/types/markstream-angular/src/components/AdmonitionNode/AdmonitionNode.component.d.ts +0 -11
- package/dist/types/markstream-angular/src/components/BlockquoteNode/BlockquoteNode.component.d.ts +0 -9
- package/dist/types/markstream-angular/src/components/CheckboxNode/CheckboxNode.component.d.ts +0 -5
- package/dist/types/markstream-angular/src/components/CodeBlockNode/CodeBlockNode.component.d.ts +0 -143
- package/dist/types/markstream-angular/src/components/CodeBlockNode/HtmlPreviewFrame.component.d.ts +0 -12
- package/dist/types/markstream-angular/src/components/D2BlockNode/D2BlockNode.component.d.ts +0 -52
- package/dist/types/markstream-angular/src/components/DefinitionListNode/DefinitionListNode.component.d.ts +0 -11
- package/dist/types/markstream-angular/src/components/DynamicNodeHost/DynamicNodeHost.component.d.ts +0 -16
- package/dist/types/markstream-angular/src/components/EmojiNode/EmojiNode.component.d.ts +0 -5
- package/dist/types/markstream-angular/src/components/EmphasisNode/EmphasisNode.component.d.ts +0 -8
- package/dist/types/markstream-angular/src/components/FallbackComponent/FallbackComponent.component.d.ts +0 -14
- package/dist/types/markstream-angular/src/components/FootnoteAnchorNode/FootnoteAnchorNode.component.d.ts +0 -7
- package/dist/types/markstream-angular/src/components/FootnoteNode/FootnoteNode.component.d.ts +0 -9
- package/dist/types/markstream-angular/src/components/FootnoteReferenceNode/FootnoteReferenceNode.component.d.ts +0 -7
- package/dist/types/markstream-angular/src/components/HardBreakNode/HardBreakNode.component.d.ts +0 -2
- package/dist/types/markstream-angular/src/components/HeadingNode/HeadingNode.component.d.ts +0 -10
- package/dist/types/markstream-angular/src/components/HighlightNode/HighlightNode.component.d.ts +0 -8
- package/dist/types/markstream-angular/src/components/HtmlBlockNode/HtmlBlockNode.component.d.ts +0 -10
- package/dist/types/markstream-angular/src/components/HtmlInlineNode/HtmlInlineNode.component.d.ts +0 -10
- package/dist/types/markstream-angular/src/components/ImageNode/ImageNode.component.d.ts +0 -7
- package/dist/types/markstream-angular/src/components/InfographicBlockNode/InfographicBlockNode.component.d.ts +0 -71
- package/dist/types/markstream-angular/src/components/InlineCodeNode/InlineCodeNode.component.d.ts +0 -17
- package/dist/types/markstream-angular/src/components/InsertNode/InsertNode.component.d.ts +0 -8
- package/dist/types/markstream-angular/src/components/LinkNode/LinkNode.component.d.ts +0 -25
- package/dist/types/markstream-angular/src/components/ListItemNode/ListItemNode.component.d.ts +0 -9
- package/dist/types/markstream-angular/src/components/ListNode/ListNode.component.d.ts +0 -11
- package/dist/types/markstream-angular/src/components/MathBlockNode/MathBlockNode.component.d.ts +0 -17
- package/dist/types/markstream-angular/src/components/MathInlineNode/MathInlineNode.component.d.ts +0 -18
- package/dist/types/markstream-angular/src/components/MermaidBlockNode/MermaidBlockNode.component.d.ts +0 -91
- package/dist/types/markstream-angular/src/components/NestedRenderer/NestedRenderer.component.d.ts +0 -33
- package/dist/types/markstream-angular/src/components/NodeOutlet/NodeOutlet.component.d.ts +0 -31
- package/dist/types/markstream-angular/src/components/NodeRenderer/NodeRenderer.component.d.ts +0 -161
- package/dist/types/markstream-angular/src/components/ParagraphNode/ParagraphNode.component.d.ts +0 -25
- package/dist/types/markstream-angular/src/components/PreCodeNode/PreCodeNode.component.d.ts +0 -9
- package/dist/types/markstream-angular/src/components/ReferenceNode/ReferenceNode.component.d.ts +0 -5
- package/dist/types/markstream-angular/src/components/StrikethroughNode/StrikethroughNode.component.d.ts +0 -8
- package/dist/types/markstream-angular/src/components/StrongNode/StrongNode.component.d.ts +0 -8
- package/dist/types/markstream-angular/src/components/SubscriptNode/SubscriptNode.component.d.ts +0 -8
- package/dist/types/markstream-angular/src/components/SuperscriptNode/SuperscriptNode.component.d.ts +0 -8
- package/dist/types/markstream-angular/src/components/TableNode/TableNode.component.d.ts +0 -29
- package/dist/types/markstream-angular/src/components/TextNode/TextNode.component.d.ts +0 -19
- package/dist/types/markstream-angular/src/components/TextNode/streamingTextState.d.ts +0 -2
- package/dist/types/markstream-angular/src/components/ThematicBreakNode/ThematicBreakNode.component.d.ts +0 -2
- package/dist/types/markstream-angular/src/components/VmrContainerNode/VmrContainerNode.component.d.ts +0 -8
- package/dist/types/markstream-angular/src/components/shared/diagram-height.d.ts +0 -9
- package/dist/types/markstream-angular/src/components/shared/node-helpers.d.ts +0 -176
- package/dist/types/markstream-angular/src/components/shared/node-outlet-helpers.d.ts +0 -10
- package/dist/types/markstream-angular/src/components/shared/render-window.d.ts +0 -18
- package/dist/types/markstream-angular/src/components/shared/rich-block-helpers.d.ts +0 -6
- package/dist/types/markstream-angular/src/components/shared/safe-attrs.directive.d.ts +0 -11
- package/dist/types/markstream-angular/src/components/shared/smooth-streaming-scope.d.ts +0 -5
- package/dist/types/markstream-angular/src/customComponents.d.ts +0 -9
- package/dist/types/markstream-angular/src/enhanceRenderedHtml.d.ts +0 -22
- package/dist/types/markstream-angular/src/hydrateCustomTagContent.d.ts +0 -2
- package/dist/types/markstream-angular/src/i18n/useSafeI18n.d.ts +0 -4
- package/dist/types/markstream-angular/src/index.d.ts +0 -77
- package/dist/types/markstream-angular/src/markstream-angular.component.d.ts +0 -2
- package/dist/types/markstream-angular/src/optional/d2.d.ts +0 -17
- package/dist/types/markstream-angular/src/optional/infographic.d.ts +0 -13
- package/dist/types/markstream-angular/src/optional/katex.d.ts +0 -9
- package/dist/types/markstream-angular/src/optional/mermaid.d.ts +0 -27
- package/dist/types/markstream-angular/src/optional/monaco.d.ts +0 -18
- package/dist/types/markstream-angular/src/parseNestedMarkdownToNodes.d.ts +0 -19
- package/dist/types/markstream-angular/src/renderMarkdownHtml.d.ts +0 -30
- package/dist/types/markstream-angular/src/sanitizeHtmlContent.d.ts +0 -2
- package/dist/types/markstream-angular/src/sanitizeSvg.d.ts +0 -2
- package/dist/types/markstream-angular/src/services/smooth-markdown-stream.service.d.ts +0 -33
- package/dist/types/markstream-angular/src/tooltip/singletonTooltip.d.ts +0 -3
- package/dist/types/markstream-angular/src/types/monaco.d.ts +0 -65
- package/dist/types/markstream-angular/src/utils/languageIcon.d.ts +0 -6
- package/dist/types/markstream-angular/src/utils/normalizeKaTeXRenderInput.d.ts +0 -1
- package/dist/types/markstream-angular/src/workers/katexCdnWorker.d.ts +0 -20
- package/dist/types/markstream-angular/src/workers/katexRenderer.worker.d.ts +0 -0
- package/dist/types/markstream-angular/src/workers/katexWorkerClient.d.ts +0 -35
- package/dist/types/markstream-angular/src/workers/mermaidCdnWorker.d.ts +0 -15
- package/dist/types/markstream-angular/src/workers/mermaidParser.worker.d.ts +0 -1
- package/dist/types/markstream-angular/src/workers/mermaidWorkerClient.d.ts +0 -15
package/dist/README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# markstream-angular — Angular streaming Markdown renderer for AI chat
|
|
2
|
+
|
|
3
|
+
Angular 20+ standalone component for streaming Markdown: AI chat, LLM token streams, SSE/WebSocket output, incomplete Markdown states, long documents, Mermaid, KaTeX, Monaco code blocks, D2, infographic blocks, custom HTML tags, and cross-framework playground parity.
|
|
4
|
+
|
|
5
|
+
## When to use it
|
|
6
|
+
|
|
7
|
+
Use `markstream-angular` when Markdown streams from an LLM, SSE, or WebSocket into an Angular 20+ standalone app.
|
|
8
|
+
For short static Markdown, a completed-document Markdown renderer or a simpler parser is usually enough.
|
|
9
|
+
|
|
10
|
+
## Status
|
|
11
|
+
|
|
12
|
+
This package is currently alpha. Treat it as a streaming Markdown integration surface to evaluate in your Angular app, not as the most stable package in the Markstream family. Check npm and the [Angular guide](https://markstream.simonhe.me/guide/angular-quick-start) for the latest API maturity.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pnpm add markstream-angular @angular/core @angular/common
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Optional peer dependencies:
|
|
21
|
+
|
|
22
|
+
- `stream-monaco` for Monaco-powered code blocks
|
|
23
|
+
- `mermaid` for Mermaid diagrams
|
|
24
|
+
- `katex` for math rendering
|
|
25
|
+
- `@terrastruct/d2` for D2 diagrams
|
|
26
|
+
- `@antv/infographic` for infographic blocks
|
|
27
|
+
|
|
28
|
+
Install only the peers your output actually needs. Plain Markdown does not require Mermaid, KaTeX, Monaco, D2, or Infographic.
|
|
29
|
+
|
|
30
|
+
Example:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pnpm add stream-monaco mermaid katex @terrastruct/d2 @antv/infographic
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Quick Start
|
|
37
|
+
|
|
38
|
+
Import the stylesheet once in your Angular app entry:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import 'markstream-angular/index.css'
|
|
42
|
+
import 'katex/dist/katex.min.css'
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Use the standalone component directly:
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { Component, signal } from '@angular/core'
|
|
49
|
+
import { bootstrapApplication } from '@angular/platform-browser'
|
|
50
|
+
import { MarkstreamAngularComponent } from 'markstream-angular'
|
|
51
|
+
|
|
52
|
+
@Component({
|
|
53
|
+
selector: 'app-root',
|
|
54
|
+
standalone: true,
|
|
55
|
+
imports: [MarkstreamAngularComponent],
|
|
56
|
+
template: `
|
|
57
|
+
<markstream-angular
|
|
58
|
+
[content]="markdown()"
|
|
59
|
+
[final]="true"
|
|
60
|
+
[codeBlockStream]="true"
|
|
61
|
+
/>
|
|
62
|
+
`,
|
|
63
|
+
})
|
|
64
|
+
class AppComponent {
|
|
65
|
+
readonly markdown = signal(`# Hello Angular
|
|
66
|
+
|
|
67
|
+
- streaming markdown
|
|
68
|
+
- code blocks
|
|
69
|
+
- Mermaid / KaTeX / D2`)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
bootstrapApplication(AppComponent)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## TypeScript
|
|
76
|
+
|
|
77
|
+
`markstream-angular` exports the same public props/context helpers you use at runtime:
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
import type {
|
|
81
|
+
AngularRenderContext,
|
|
82
|
+
CodeBlockMonacoOptions,
|
|
83
|
+
CustomComponentMap,
|
|
84
|
+
MarkstreamAngularComponentProps,
|
|
85
|
+
NodeRendererProps,
|
|
86
|
+
} from 'markstream-angular'
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Workers
|
|
90
|
+
|
|
91
|
+
KaTeX and Mermaid can use the same off-thread worker path as the React/Vue packages:
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
import { setKaTeXWorker, setMermaidWorker } from 'markstream-angular'
|
|
95
|
+
import KatexWorker from 'markstream-angular/workers/katexRenderer.worker?worker'
|
|
96
|
+
import MermaidWorker from 'markstream-angular/workers/mermaidParser.worker?worker'
|
|
97
|
+
|
|
98
|
+
setKaTeXWorker(new KatexWorker())
|
|
99
|
+
setMermaidWorker(new MermaidWorker())
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Playground
|
|
103
|
+
|
|
104
|
+
In this monorepo:
|
|
105
|
+
|
|
106
|
+
- Angular playground: `pnpm play:angular`
|
|
107
|
+
- Angular regression lab: `http://127.0.0.1:4175/test`
|
|
108
|
+
- Angular version sandbox: `http://127.0.0.1:4175/test-sandbox`
|
|
109
|
+
|
|
110
|
+
Current development is aligned with `markstream-react` / `markstream-vue2` for:
|
|
111
|
+
|
|
112
|
+
- node-component renderer structure
|
|
113
|
+
- streaming code block behavior
|
|
114
|
+
- shared `/test` fixtures and cross-framework comparison
|
|
115
|
+
- KaTeX / Mermaid worker integration
|
|
116
|
+
|
|
117
|
+
Issue tracker and source: [Simon-He95/markstream-vue](https://github.com/Simon-He95/markstream-vue)
|