@jay-framework/markdown 0.22.2 → 0.24.0
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/agent-kit/designer/markdown-usage.md +70 -2
- package/dist/contracts/markdown-pages.jay-contract +5 -1
- package/dist/index.client.js +3587 -1812
- package/dist/index.d.ts +20 -6
- package/dist/index.js +183 -34
- package/package.json +9 -9
|
@@ -30,6 +30,40 @@ The component provides these ViewState fields (all slow phase):
|
|
|
30
30
|
|
|
31
31
|
SEO head tags (`<title>`, `<meta description>`, `og:title`, etc.) are injected automatically from frontmatter.
|
|
32
32
|
|
|
33
|
+
#### Images in markdown
|
|
34
|
+
|
|
35
|
+
Images referenced in markdown files (``) are handled automatically:
|
|
36
|
+
|
|
37
|
+
**Default (zero-config):** Images alongside `.md` files in the content directory are copied to the project's `public/` folder and URLs are rewritten to serve them as static assets. No props needed.
|
|
38
|
+
|
|
39
|
+
**CDN hosting (with mediaMap):** For optimized delivery, provide a `mediaMap` prop pointing to a YAML file that maps filenames to CDN URLs:
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<script type="application/jay-headless" ...>
|
|
43
|
+
contentDir: ./content
|
|
44
|
+
mediaMap: ./media-map.yaml
|
|
45
|
+
</script>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The mapping file supports `srcset` for responsive images:
|
|
49
|
+
|
|
50
|
+
```yaml
|
|
51
|
+
# media-map.yaml — generated by an upload script
|
|
52
|
+
'diagram.png':
|
|
53
|
+
src: 'https://cdn.example.com/w_800/diagram.webp'
|
|
54
|
+
width: 800
|
|
55
|
+
height: 600
|
|
56
|
+
srcset:
|
|
57
|
+
- url: 'https://cdn.example.com/w_400/diagram.webp'
|
|
58
|
+
width: 400
|
|
59
|
+
- url: 'https://cdn.example.com/w_800/diagram.webp'
|
|
60
|
+
width: 800
|
|
61
|
+
- url: 'https://cdn.example.com/w_1200/diagram.webp'
|
|
62
|
+
width: 1200
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Mapped images render with `srcset`, `sizes`, `width`, `height`, and `loading="lazy"`. Unmapped images fall back to the default local serving. The mapping file is typically generated by an external upload script — not hand-written.
|
|
66
|
+
|
|
33
67
|
### markdown-content — Static inline renderer
|
|
34
68
|
|
|
35
69
|
Renders a markdown string at build time. Use for static content embedded in a page.
|
|
@@ -147,8 +181,7 @@ graph LR
|
|
|
147
181
|
<div class="md-mermaid">
|
|
148
182
|
<pre class="md-mermaid-source">
|
|
149
183
|
graph LR
|
|
150
|
-
A[Start] --> B[End]</pre
|
|
151
|
-
>
|
|
184
|
+
A[Start] --> B[End]</pre>
|
|
152
185
|
</div>
|
|
153
186
|
```
|
|
154
187
|
|
|
@@ -161,6 +194,41 @@ graph LR
|
|
|
161
194
|
| `.md-mermaid-source` | `<pre>` | Raw mermaid source (client fallback only) |
|
|
162
195
|
| `.md-mermaid-error` | `<pre>` | Error message when rendering fails |
|
|
163
196
|
|
|
197
|
+
### Theming mermaid diagrams
|
|
198
|
+
|
|
199
|
+
SVG diagrams use CSS custom properties for all colors. Set `--bg` and `--fg` on `.md-mermaid svg` to control the color scheme:
|
|
200
|
+
|
|
201
|
+
```css
|
|
202
|
+
.md-mermaid svg {
|
|
203
|
+
--bg: var(--color-surface);
|
|
204
|
+
--fg: var(--color-text);
|
|
205
|
+
font-family: inherit;
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
The SVG internally derives all colors from `--bg` and `--fg`:
|
|
210
|
+
|
|
211
|
+
| Variable | Derived from | Controls |
|
|
212
|
+
| ---------------- | ------------------- | ------------------------ |
|
|
213
|
+
| `--_text` | `--fg` | Node labels, actor names |
|
|
214
|
+
| `--_line` | `--fg` 50% + `--bg` | Edges, lifelines |
|
|
215
|
+
| `--_arrow` | `--fg` 85% + `--bg` | Arrow heads |
|
|
216
|
+
| `--_node-fill` | `--fg` 3% + `--bg` | Node backgrounds |
|
|
217
|
+
| `--_node-stroke` | `--fg` 20% + `--bg` | Node borders |
|
|
218
|
+
| `--_group-fill` | `--bg` | Subgraph backgrounds |
|
|
219
|
+
|
|
220
|
+
Override individual variables for fine control:
|
|
221
|
+
|
|
222
|
+
```css
|
|
223
|
+
.md-mermaid svg {
|
|
224
|
+
--bg: #0a0a0a;
|
|
225
|
+
--fg: #e4e4e7;
|
|
226
|
+
--accent: #8b5cf6; /* arrow color */
|
|
227
|
+
--surface: #1a1a2e; /* node fill */
|
|
228
|
+
--border: #333; /* node stroke */
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
164
232
|
## Theme CSS
|
|
165
233
|
|
|
166
234
|
Import a theme in your project CSS:
|
|
@@ -4,7 +4,11 @@ description: Renders a directory of markdown files as routable pages
|
|
|
4
4
|
props:
|
|
5
5
|
- name: contentDir
|
|
6
6
|
kind: required
|
|
7
|
-
description: Path to markdown directory (relative to
|
|
7
|
+
description: Path to markdown directory (relative to project root)
|
|
8
|
+
|
|
9
|
+
- name: mediaMap
|
|
10
|
+
kind: optional
|
|
11
|
+
description: Path to YAML file mapping image filenames to CDN URLs with srcset
|
|
8
12
|
|
|
9
13
|
params:
|
|
10
14
|
- name: slug
|