Skip to content

Commit 5edff75

Browse files
authored
docs: add code, cjk, math, and mermaid to @source (#430)
* docs: update Tailwind CSS setup instructions to include additional Streamdown modules in README.md * docs: update FAQ to include additional Streamdown module sources in globals.css * docs: update Tailwind CSS configuration to include additional Streamdown module sources in getting-started.mdx * docs: update migration guide to include additional Streamdown module sources in globals.css * docs: update Tailwind CSS configuration in SKILL.md to include additional Streamdown module sources * chore: add changeset for @source documentation updates * docs: update README to include optional Streamdown plugin installation instructions * docs: update FAQ to include instructions for optional Streamdown plugins in globals.css * docs: update Tailwind CSS configuration in getting-started.mdx to clarify optional plugin integration * docs: add Tailwind CSS configuration instructions for @streamdown/code plugin * docs: update migration guide to include plugin source path instructions for Tailwind CSS * docs: add Tailwind CSS integration instructions for @streamdown/cjk plugin * docs: add Tailwind CSS integration instructions for @streamdown/math plugin * docs: add Tailwind CSS integration instructions for @streamdown/mermaid plugin * docs: update the changeset * docs: update Tailwind CSS configuration instructions for clarity * docs: update links for plugin documentation
1 parent 67c4f45 commit 5edff75

File tree

10 files changed

+102
-1
lines changed

10 files changed

+102
-1
lines changed

.changeset/all-rabbits-mate.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"streamdown": minor
3+
---
4+
5+
Clarified Tailwind `@source` configuration for Streamdown and optional plugins.
6+
Updated documentation to keep the global `@source` for core `streamdown` only, move plugin `@source` guidance to plugin docs with examples, and add a caveat to include plugin entries only if installed.

apps/website/content/docs/faq.mdx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@ Add a `@source` directive to your `globals.css` file with the path to Streamdown
6464
@source "../node_modules/streamdown/dist/*.js";
6565
```
6666

67+
If you install optional plugins, add their matching `@source` lines only for packages you've installed. See the plugin pages for exact paths and examples:
68+
69+
- Code: [/docs/plugins/code](/docs/plugins/code)
70+
- CJK: [/docs/plugins/cjk](/docs/plugins/cjk)
71+
- Math: [/docs/plugins/math](/docs/plugins/math)
72+
- Mermaid: [/docs/plugins/mermaid](/docs/plugins/mermaid)
73+
74+
Example: to include the code plugin, add this to `globals.css` (adjust the relative path as needed):
75+
76+
```css title="globals.css"
77+
@source "../node_modules/@streamdown/code/dist/*.js";
78+
```
79+
6780
### Tailwind v3
6881

6982
Add Streamdown to your `content` array in `tailwind.config.js`:

apps/website/content/docs/getting-started.mdx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ Add the following CSS source directive to your `globals.css` or main CSS file:
5050

5151
The path must be relative from your CSS file to the `node_modules` folder containing `streamdown`. In a standard Next.js project where `globals.css` lives in `app/`, the default path above should work.
5252

53+
If you install optional plugins, add their matching `@source` lines only for packages you've installed. See the plugin pages for exact paths and examples:
54+
55+
- Code: [/docs/plugins/code](/docs/plugins/code)
56+
- CJK: [/docs/plugins/cjk](/docs/plugins/cjk)
57+
- Math: [/docs/plugins/math](/docs/plugins/math)
58+
- Mermaid: [/docs/plugins/mermaid](/docs/plugins/mermaid)
59+
60+
Example: to include the code plugin, add this to `globals.css` (adjust the relative path as needed):
61+
62+
```css title="globals.css"
63+
@source "../node_modules/@streamdown/code/dist/*.js";
64+
```
65+
5366
### Animation styles
5467

5568
If you're using the built-in `animated` prop for streaming animation, import the animation CSS in your app:

apps/website/content/docs/migrate.mdx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,19 @@ Streamdown uses Tailwind CSS for styling. Add the source path so Tailwind picks
125125
@source "../node_modules/streamdown/dist/*.js";
126126
```
127127

128+
Add plugin `@source` lines only for packages you have installed. For exact paths and examples, see the plugin pages:
129+
130+
- Code: [/docs/plugins/code](/docs/plugins/code)
131+
- CJK: [/docs/plugins/cjk](/docs/plugins/cjk)
132+
- Math: [/docs/plugins/math](/docs/plugins/math)
133+
- Mermaid: [/docs/plugins/mermaid](/docs/plugins/mermaid)
134+
135+
Example (add to `globals.css`):
136+
137+
```css
138+
@source "../node_modules/@streamdown/code/dist/*.js";
139+
```
140+
128141
**Tailwind v3** — add to your `tailwind.config.js`:
129142

130143
```js title="tailwind.config.js"

apps/website/content/docs/plugins/cjk.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ The `@streamdown/cjk` plugin improves handling of CJK (Chinese, Japanese, Korean
2121
npm install @streamdown/cjk
2222
```
2323

24+
## Tailwind CSS (v4)
25+
26+
If you use Tailwind v4, add this to your `globals.css` only when `@streamdown/cjk` is installed:
27+
28+
```css title="globals.css"
29+
@source "../node_modules/@streamdown/cjk/dist/*.js";
30+
```
31+
32+
Adjust the path for monorepos so it points to the correct `node_modules` location.
33+
2434
## Usage
2535

2636
```tsx title="chat.tsx" lineNumbers

apps/website/content/docs/plugins/code.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ The `@streamdown/code` plugin provides syntax highlighting for code blocks using
2222
npm install @streamdown/code
2323
```
2424

25+
## Tailwind CSS (v4)
26+
27+
If you use Tailwind v4, add this to your `globals.css` only when `@streamdown/code` is installed:
28+
29+
```css title="globals.css"
30+
@source "../node_modules/@streamdown/code/dist/*.js";
31+
```
32+
33+
Adjust the path for monorepos so it points to the correct `node_modules` location.
34+
2535
## Usage
2636

2737
```tsx

apps/website/content/docs/plugins/math.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ The `@streamdown/math` plugin renders mathematical expressions using [KaTeX](htt
2222
npm install @streamdown/math
2323
```
2424

25+
## Tailwind CSS (v4)
26+
27+
If you use Tailwind v4, add this to your `globals.css` only when `@streamdown/math` is installed:
28+
29+
```css title="globals.css"
30+
@source "../node_modules/@streamdown/math/dist/*.js";
31+
```
32+
33+
Adjust the path for monorepos so it points to the correct `node_modules` location.
34+
2535
## Usage
2636

2737
```tsx title="chat.tsx" lineNumbers

apps/website/content/docs/plugins/mermaid.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ The `@streamdown/mermaid` plugin renders [Mermaid](https://mermaid.js.org/) diag
2222
npm install @streamdown/mermaid
2323
```
2424

25+
## Tailwind CSS (v4)
26+
27+
If you use Tailwind v4, add this to your `globals.css` only when `@streamdown/mermaid` is installed:
28+
29+
```css title="globals.css"
30+
@source "../node_modules/@streamdown/mermaid/dist/*.js";
31+
```
32+
33+
Adjust the path for monorepos so it points to the correct `node_modules` location.
34+
2535
## Usage
2636

2737
```tsx title="chat.tsx" lineNumbers

packages/streamdown/README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ Then, update your Tailwind `globals.css` to include the following so that Tailwi
3636

3737
The path must be relative from your CSS file to the `node_modules` folder containing `streamdown`. In a standard Next.js project where `globals.css` lives in `app/`, the default path above should work.
3838

39+
If you install optional Streamdown plugins, add their matching `@source` lines from the relevant plugin docs (`/docs/plugins/code`, `/docs/plugins/cjk`, `/docs/plugins/math`, `/docs/plugins/mermaid`). Only include plugin `@source` entries for packages that are actually installed.
40+
41+
Example:
42+
43+
```css
44+
@source "../node_modules/@streamdown/code/dist/*.js";
45+
```
46+
47+
3948
### Monorepo setup
4049

4150
In a monorepo (npm workspaces, Turbo, pnpm, etc.), dependencies are typically hoisted to the root `node_modules`. You need to adjust the relative path to point there:
@@ -54,7 +63,7 @@ monorepo/
5463
@source "../../../node_modules/streamdown/dist/*.js";
5564
```
5665

57-
Adjust the number of `../` segments based on where your CSS file lives relative to the root `node_modules`.
66+
Adjust the number of `../` segments based on where your CSS file lives relative to the root `node_modules`. If you install Streamdown plugins, add their respective `@source` entries only when those packages are installed.
5867

5968
## Usage
6069

skills/streamdown/SKILL.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ npm install @streamdown/code @streamdown/mermaid @streamdown/math @streamdown/cj
3636
@source "../node_modules/streamdown/dist/*.js";
3737
```
3838

39+
Add plugin `@source` lines **only for packages you have installed** (omitting uninstalled plugins avoids Tailwind errors). See plugin pages for exact paths:
40+
- Code: `@source "../node_modules/@streamdown/code/dist/*.js";`
41+
- CJK: `@source "../node_modules/@streamdown/cjk/dist/*.js";`
42+
- Math: `@source "../node_modules/@streamdown/math/dist/*.js";`
43+
- Mermaid: `@source "../node_modules/@streamdown/mermaid/dist/*.js";`
44+
45+
3946
**Tailwind v3** — add to `tailwind.config.js`:
4047
```js
4148
module.exports = {

0 commit comments

Comments
 (0)