@brett_lamy/docstream 0.3.0 → 0.3.1
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 +0 -80
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -10,10 +10,7 @@ GitBook-aware markdown rendering for React applications and AI streaming surface
|
|
|
10
10
|
- Streaming-friendly `GitbookStreamdown` component inspired by `vercel/streamdown`.
|
|
11
11
|
- Parser and serializer for round-tripping supported GitBook syntax.
|
|
12
12
|
- Syntax-highlighted code blocks through `lowlight`.
|
|
13
|
-
- Optional live React/JSX/TSX previews powered by the almost-node runtime.
|
|
14
|
-
- A complete virtual-filesystem helper for multi-file React demos.
|
|
15
13
|
- GitBook block support for hints, tabs, expandables, steppers, embeds, content refs, columns, figures, tables, math, dividers, updates, and OpenAPI operations.
|
|
16
|
-
- Embed blocks render YouTube/direct video URLs through the built-in `VideoEmbed` and public Loop QA task, journey, exploration, or test-run URLs through `ReplayPreview`.
|
|
17
14
|
- CSS exported as a stable package entrypoint so host apps can theme with CSS variables or shadcn-style design tokens.
|
|
18
15
|
|
|
19
16
|
## Installation
|
|
@@ -70,62 +67,6 @@ export function Preview() {
|
|
|
70
67
|
}
|
|
71
68
|
```
|
|
72
69
|
|
|
73
|
-
## Run React and JSX demos
|
|
74
|
-
|
|
75
|
-
Install `@agent-wasm/core` in the host app and serve its service worker through
|
|
76
|
-
the Vite plugin:
|
|
77
|
-
|
|
78
|
-
```ts
|
|
79
|
-
import { almostnodePlugin } from "@agent-wasm/core/vite"
|
|
80
|
-
|
|
81
|
-
export default defineConfig({
|
|
82
|
-
plugins: [almostnodePlugin()],
|
|
83
|
-
})
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
`ReactDemo` creates the complete file tree in almost-node, starts its Vite
|
|
87
|
-
server, and renders the resulting app in a preview iframe. The file map can
|
|
88
|
-
contain any number of files:
|
|
89
|
-
|
|
90
|
-
```tsx
|
|
91
|
-
import { ReactDemo } from "@brett_lamy/docstream"
|
|
92
|
-
|
|
93
|
-
const files = {
|
|
94
|
-
"/src/main.jsx": `
|
|
95
|
-
import React from "react"
|
|
96
|
-
import { createRoot } from "react-dom/client"
|
|
97
|
-
import App from "./App.jsx"
|
|
98
|
-
createRoot(document.getElementById("root")).render(<App />)
|
|
99
|
-
`,
|
|
100
|
-
"/src/App.jsx": `
|
|
101
|
-
import Card from "./Card.jsx"
|
|
102
|
-
export default function App() { return <Card title="Hello" /> }
|
|
103
|
-
`,
|
|
104
|
-
"/src/Card.jsx": `
|
|
105
|
-
export default function Card({ title }) { return <button>{title}</button> }
|
|
106
|
-
`,
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
<ReactDemo files={files} entry="/src/main.jsx" />
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
For lower-level integrations, `createAlmostNodeFilesystem(files)` creates a
|
|
113
|
-
`VirtualFS`, while `createAlmostNodeWorkspace(files)` creates a container and
|
|
114
|
-
populates its complete filesystem so callers can run shell commands, npm, or
|
|
115
|
-
Vite themselves.
|
|
116
|
-
|
|
117
|
-
Single-file live code blocks opt in explicitly so ordinary documentation
|
|
118
|
-
snippets remain inert:
|
|
119
|
-
|
|
120
|
-
````md
|
|
121
|
-
{% code language="jsx" live="true" entry="/src/main.jsx" %}
|
|
122
|
-
```jsx
|
|
123
|
-
import { createRoot } from "react-dom/client"
|
|
124
|
-
createRoot(document.getElementById("root")).render(<h1>Hello</h1>)
|
|
125
|
-
```
|
|
126
|
-
{% endcode %}
|
|
127
|
-
````
|
|
128
|
-
|
|
129
70
|
## Markdown Helper Component
|
|
130
71
|
|
|
131
72
|
`MarkdownContent` parses and renders a markdown string in one step:
|
|
@@ -138,25 +79,6 @@ export function Preview({ markdown }: { markdown: string }) {
|
|
|
138
79
|
}
|
|
139
80
|
```
|
|
140
81
|
|
|
141
|
-
## Video and Replay QA embeds
|
|
142
|
-
|
|
143
|
-
`embed` blocks accept direct `.mp4`, `.webm`, and `.ogg` assets, YouTube URLs,
|
|
144
|
-
and public Loop QA project URLs. Loop QA project URLs are converted to the
|
|
145
|
-
chrome-free `/p/...` route automatically:
|
|
146
|
-
|
|
147
|
-
```md
|
|
148
|
-
{% embed url="https://loop-qa.replay.io/projects/project-id/journeys/journey-id" /%}
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
The replay component is also available directly when a document needs a
|
|
152
|
-
custom source or native rrweb events:
|
|
153
|
-
|
|
154
|
-
```tsx
|
|
155
|
-
import { ReplayPreview } from "@brett_lamy/docstream"
|
|
156
|
-
|
|
157
|
-
<ReplayPreview source="https://loop-qa.replay.io/projects/project-id/tasks/task-id" />
|
|
158
|
-
```
|
|
159
|
-
|
|
160
82
|
## GitBook Syntax
|
|
161
83
|
|
|
162
84
|
The parser supports normal Markdown plus GitBook-style block tags.
|
|
@@ -236,8 +158,6 @@ You can also resolve paths yourself with `resolveAsset`.
|
|
|
236
158
|
- `GitbookStreamdown`: Parses and renders markdown for read-only stream output.
|
|
237
159
|
- `DocsRenderer`: Renders a parsed `DocumentNode`.
|
|
238
160
|
- `MarkdownContent`: Parses and renders a markdown string.
|
|
239
|
-
- `ReplayPreview` / `ReplayEmbed`: Embeds public Loop QA pages or plays CORS-enabled rrweb event data.
|
|
240
|
-
- `VideoEmbed`: Renders direct video assets or hosted video players.
|
|
241
161
|
- `OpenApiOperation`: Renders a parsed OpenAPI operation block.
|
|
242
162
|
|
|
243
163
|
### Parser and Serializer
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brett_lamy/docstream",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "GitBook-aware readonly markdown and AI stream renderer.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -56,9 +56,8 @@
|
|
|
56
56
|
"react": ">=18",
|
|
57
57
|
"@agent-wasm/core": ">=0.4.0"
|
|
58
58
|
},
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
}
|
|
59
|
+
"repository": {
|
|
60
|
+
"type": "git",
|
|
61
|
+
"url": "git+https://github.com/BLamy/docstream.git"
|
|
63
62
|
}
|
|
64
63
|
}
|