@brett_lamy/docstream 0.6.0 → 0.6.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 CHANGED
@@ -32,6 +32,10 @@ Import the package CSS once near your app entrypoint:
32
32
  import "@brett_lamy/docstream/styles.css"
33
33
  ```
34
34
 
35
+ The stylesheet provides heading hierarchy and consistent spacing for the
36
+ `DocsRenderer`, `MarkdownContent`, and streaming render paths. Host CSS can
37
+ override those defaults through the normal cascade.
38
+
35
39
  If your TypeScript app checks CSS side-effect imports, include Vite's standard environment declaration or an equivalent CSS module declaration:
36
40
 
37
41
  ```ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brett_lamy/docstream",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "GitBook-aware readonly markdown and AI stream renderer.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -376,7 +376,11 @@ function isReactLanguage(language: string | null): boolean {
376
376
 
377
377
  function Blocks({ blocks, inline, liveRenderer, sourceRenderer }: { blocks: Block[]; inline?: boolean } & Renderers) {
378
378
  return (
379
- <div className={inline ? "docs-blocks-inline" : undefined} style={inline ? { display: "inline" } : undefined}>
379
+ <div
380
+ data-docstream-blocks=""
381
+ className={inline ? "docs-blocks-inline" : undefined}
382
+ style={inline ? { display: "inline" } : undefined}
383
+ >
380
384
  {blocks.map((b, i) => (
381
385
  <BlockView key={i} block={b} liveRenderer={liveRenderer} sourceRenderer={sourceRenderer} />
382
386
  ))}
package/src/styles.css CHANGED
@@ -68,44 +68,87 @@
68
68
  white-space: pre-wrap;
69
69
  }
70
70
 
71
+ :is([data-docstream], .docs-article) {
72
+ color: var(--foreground, #18181b);
73
+ line-height: 1.65;
74
+ font-size: 15.5px;
75
+ }
76
+
71
77
  .docs-article {
72
78
  max-width: 760px;
73
79
  margin: 0 auto;
74
80
  padding: 48px 32px 120px;
75
- line-height: 1.65;
76
- font-size: 15.5px;
77
81
  }
78
82
 
79
- .docs-article > div > * + * {
80
- margin-top: 0.85em;
83
+ :is([data-docstream], .docs-article) [data-docstream-blocks] > * {
84
+ margin-block: 0;
85
+ }
86
+
87
+ :is([data-docstream], .docs-article) [data-docstream-blocks] > * + * {
88
+ margin-block-start: 0.9em;
89
+ }
90
+
91
+ :is([data-docstream], .docs-article) :is(h1, h2, h3, h4, h5, h6) {
92
+ color: inherit;
93
+ display: block;
94
+ font-family: inherit;
95
+ font-weight: 650;
96
+ line-height: 1.25;
97
+ margin-block: 1.6em 0.45em;
98
+ text-wrap: pretty;
99
+ }
100
+
101
+ :is([data-docstream], .docs-article) [data-docstream-blocks] > :is(h1, h2, h3, h4, h5, h6) {
102
+ margin-block-start: 1.6em;
103
+ }
104
+
105
+ :is([data-docstream], .docs-article) [data-docstream-blocks] > :first-child:is(h1, h2, h3, h4, h5, h6) {
106
+ margin-block-start: 0;
81
107
  }
82
108
 
83
- .docs-article h1 {
109
+ :is([data-docstream], .docs-article) h1 {
84
110
  font-size: 2.2em;
85
111
  font-weight: 700;
86
- margin-top: 0.6em;
87
112
  }
88
113
 
89
- .docs-article h2 {
114
+ :is([data-docstream], .docs-article) h2 {
90
115
  font-size: 1.5em;
91
- font-weight: 650;
92
- margin-top: 1.4em;
116
+ font-weight: 675;
93
117
  padding-bottom: 0.2em;
94
118
  border-bottom: 1px solid var(--border, #e4e4e7);
95
119
  }
96
120
 
97
- .docs-article h3 {
121
+ :is([data-docstream], .docs-article) h3 {
98
122
  font-size: 1.2em;
99
123
  font-weight: 600;
100
- margin-top: 1.1em;
101
124
  }
102
125
 
103
- .docs-article a {
126
+ :is([data-docstream], .docs-article) h4 {
127
+ font-size: 1.08em;
128
+ font-weight: 600;
129
+ }
130
+
131
+ :is([data-docstream], .docs-article) h5 {
132
+ font-size: 1em;
133
+ font-weight: 600;
134
+ }
135
+
136
+ :is([data-docstream], .docs-article) h6 {
137
+ font-size: 0.92em;
138
+ font-weight: 600;
139
+ letter-spacing: 0.02em;
140
+ }
141
+
142
+ :is([data-docstream], .docs-article) p {
143
+ margin-block: 0;
144
+ }
145
+
146
+ :is([data-docstream], .docs-article) a {
104
147
  color: var(--gb-primary);
105
148
  text-decoration: underline;
106
149
  }
107
150
 
108
- .docs-article code {
151
+ :is([data-docstream], .docs-article) code {
109
152
  background: var(--gb-muted);
110
153
  border-radius: 4px;
111
154
  padding: 0.15em 0.35em;
@@ -113,12 +156,12 @@
113
156
  font-family: ui-monospace, Menlo, monospace;
114
157
  }
115
158
 
116
- .docs-article ul {
159
+ :is([data-docstream], .docs-article) ul {
117
160
  list-style: disc;
118
161
  padding-left: 1.5em;
119
162
  }
120
163
 
121
- .docs-article ol {
164
+ :is([data-docstream], .docs-article) ol {
122
165
  list-style: decimal;
123
166
  padding-left: 1.5em;
124
167
  }
@@ -148,24 +191,24 @@
148
191
  margin: 0;
149
192
  }
150
193
 
151
- .docs-article blockquote {
194
+ :is([data-docstream], .docs-article) blockquote {
152
195
  border-left: 3px solid var(--gb-border);
153
196
  padding-left: 1em;
154
197
  color: var(--gb-muted-foreground);
155
198
  }
156
199
 
157
- .docs-article hr {
200
+ :is([data-docstream], .docs-article) hr {
158
201
  border: none;
159
202
  border-top: 1px solid var(--gb-border);
160
203
  margin: 2em 0;
161
204
  }
162
205
 
163
- .docs-article figure img {
206
+ :is([data-docstream], .docs-article) figure img {
164
207
  border-radius: 12px;
165
208
  max-width: 100%;
166
209
  }
167
210
 
168
- .docs-article figcaption {
211
+ :is([data-docstream], .docs-article) figcaption {
169
212
  text-align: center;
170
213
  font-size: 13px;
171
214
  color: var(--gb-muted-foreground);