r-markdown-cli 0.1.0 → 0.1.2

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.
@@ -0,0 +1,321 @@
1
+ # Rich Markdown Blocks (v0.2)
2
+
3
+ These are the blocks supported by the current renderer (`packages/blocks-core`).
4
+ Use the smallest set that conveys meaning. Prefer plain Markdown for narrative.
5
+
6
+ Identifiers (block names, slider variable names) are case-sensitive.
7
+ Attribute order does not matter; positional arguments come immediately after the
8
+ block name.
9
+
10
+ ## chart
11
+
12
+ Compact data visualization. Each line is `{label} {value} [{value2} ...]`.
13
+ Values are space-separated. Multi-value rows become multi-series.
14
+
15
+ ```rmd
16
+ :::chart bar title="P99 latency (ms)" emphasis=primary
17
+ TokenBucket 23
18
+ LeakyBucket 19
19
+ SlidingWindow 41
20
+ :::
21
+ ```
22
+
23
+ Types (positional, required): `bar`, `line`, `pie`, `scatter`, `radar`, `area`,
24
+ `donut`, `heatmap`. `pie` requires single value per row.
25
+
26
+ Attributes:
27
+
28
+ | name | values | default | notes |
29
+ |---|---|---|---|
30
+ | `title` | string | empty | chart title |
31
+ | `x` / `y` / `y2` | string | null | axis labels (use `y2` for dual axis) |
32
+ | `legend` | `top` / `bottom` / `left` / `right` / `none` | `bottom` | legend position |
33
+ | `tooltip` | `true` / `false` | `true` | hover tooltip |
34
+ | `emphasis` | `primary` / `secondary` / `none` | `none` | theme-controlled accent |
35
+
36
+ Multi-series example:
37
+
38
+ ```rmd
39
+ :::chart area title="Revenue vs MAU" y="Revenue($M)" y2="MAU(K)" legend=top
40
+ Q1_2025 120 40
41
+ Q2_2025 150 45
42
+ Q3_2025 180 60
43
+ Q4_2025 240 85
44
+ :::
45
+ ```
46
+
47
+ ## grid
48
+
49
+ Multi-column layout. Cells separated by `---` on their own line.
50
+
51
+ ```rmd
52
+ :::grid 3
53
+ ### Option A
54
+ Fast, simple.
55
+ ---
56
+ ### Option B
57
+ Flexible, heavier.
58
+ ---
59
+ ### Option C
60
+ Safe, slower.
61
+ :::
62
+ ```
63
+
64
+ Positional: column count (1–12) or comma-separated responsive breakpoints
65
+ (e.g. `1,2,4` for mobile/tablet/desktop).
66
+
67
+ Attributes:
68
+
69
+ | name | values | default | notes |
70
+ |---|---|---|---|
71
+ | `gap` | `sm` / `md` / `lg` | `md` | column spacing |
72
+ | `layout` | `default` / `masonry` | `default` | masonry uses CSS columns (no JS) |
73
+
74
+ `grid` cannot nest inside another `grid`. Maximum 12 cells.
75
+
76
+ ## callout
77
+
78
+ Emphasized note, decision, or warning.
79
+
80
+ ```rmd
81
+ :::callout tip title="Recommendation"
82
+ Pick token bucket for burst-friendly traffic.
83
+ :::
84
+ ```
85
+
86
+ Positional kind: `info` / `tip` / `warning` / `danger` / `success`.
87
+ Optional `title` attribute.
88
+
89
+ ## slider
90
+
91
+ Reader-adjustable number with optional range/log/marks. Pair with `export`.
92
+
93
+ ```rmd
94
+ :::slider name=capacity min=10 max=1000 step=10 default=200 unit=req
95
+ :::
96
+ ```
97
+
98
+ Range slider (two values):
99
+
100
+ ```rmd
101
+ :::slider name=qps_range label="QPS window" min=10 max=1000 step=10 default=100,500 scale=log marks=10,100,500,1000
102
+ :::
103
+ ```
104
+
105
+ Required: `name` (matches `^[a-zA-Z_][a-zA-Z0-9_]*$`), `min`, `max` (`max > min`).
106
+
107
+ Attributes:
108
+
109
+ | name | type | default | notes |
110
+ |---|---|---|---|
111
+ | `step` | number > 0 | `1` | |
112
+ | `default` | number or `n,m` | `min` | range slider when comma value |
113
+ | `unit` | string | empty | suffix shown after value |
114
+ | `label` | string | name | display label |
115
+ | `scale` | `linear` / `log` / `pow` | `linear` | |
116
+ | `marks` | comma-separated numbers | empty | discrete snap points |
117
+
118
+ Slider names must be unique per document. Block body must be empty.
119
+
120
+ ## export
121
+
122
+ Copy/export template. References slider values with `{{name}}` and supports
123
+ `{{name | int}}` formatting.
124
+
125
+ ```rmd
126
+ :::export label="Copy config" format=text
127
+ rate_limiter:
128
+ capacity: {{capacity | int}}
129
+ refill_rate: {{refill_rate | int}}
130
+ :::
131
+ ```
132
+
133
+ Attributes:
134
+
135
+ | name | values | default | notes |
136
+ |---|---|---|---|
137
+ | `label` | string | `复制` | button text |
138
+ | `format` | `text` / `markdown` / `json` | `text` | clipboard MIME |
139
+
140
+ Unknown variables render as `[未定义:name]` and warn in the console.
141
+
142
+ ## flow
143
+
144
+ Directed flow with linear and branching paths.
145
+
146
+ ```rmd
147
+ :::flow direction=lr
148
+ Design -> Review -> Canary -> Full rollout
149
+ Canary -> Incident -> Rollback
150
+ :::
151
+ ```
152
+
153
+ Each line: `Node -> Node -> ...`. Same-name nodes merge.
154
+ `direction`: `lr` (default) or `tb`.
155
+
156
+ ## diff
157
+
158
+ Unified-diff style. `+` add, `-` remove, leading space context.
159
+ `@注: ...` adds an inline note (placed at end of `+`/`-` line).
160
+
161
+ ```rmd
162
+ :::diff lang=python title="Limiter change"
163
+ - @rate_limit(window=60, max=100)
164
+ + @token_bucket(capacity=200, refill=50) @注: adds burst protection
165
+ :::
166
+ ```
167
+
168
+ ## tabs
169
+
170
+ Multiple views in one area. `@label` on its own line starts a panel.
171
+
172
+ ```rmd
173
+ :::tabs default=Summary
174
+ @Summary
175
+ Plain-language explanation.
176
+ @Details
177
+ Implementation details.
178
+ :::
179
+ ```
180
+
181
+ Cannot nest inside another `tabs`.
182
+
183
+ ## timeline
184
+
185
+ Vertical or horizontal sequence of dated events.
186
+
187
+ ```rmd
188
+ :::timeline
189
+ @ 2026-01-01 [title="Kickoff"] [status="success"]
190
+ Initial planning done, team formed.
191
+
192
+ @ 2026-03-15 [title="v0.1"] [status="success"]
193
+ Core parser shipped.
194
+
195
+ @ 2026-05-10 [title="v0.2"] [status="pending"]
196
+ Advanced blocks + masonry grid.
197
+ :::
198
+ ```
199
+
200
+ Each item begins with `@ {time} [title="..."] [status="..."]` on its own line.
201
+ Body is normal Markdown until the next `@`.
202
+
203
+ `status`: `success` / `warning` / `danger` / `pending` / `default`.
204
+ `direction`: `vertical` (default) or `horizontal`.
205
+
206
+ ## kanban
207
+
208
+ Columns of cards. `@ {column title}` on its own line starts a column.
209
+
210
+ ```rmd
211
+ :::kanban
212
+ @ Todo
213
+ - [ ] Write the report
214
+ - [ ] Run perf tests
215
+
216
+ @ In progress
217
+ - [x] Update parser
218
+ - [x] Refactor theme
219
+
220
+ @ Done
221
+ * All conformance tests pass
222
+ * Carousel uses pure CSS
223
+ :::
224
+ ```
225
+
226
+ Use lists (Markdown task lists or bullets) for cards.
227
+
228
+ ## details
229
+
230
+ Collapsible block. Wraps a native `<details>`.
231
+
232
+ ```rmd
233
+ :::details title="Architecture changelog" open=true
234
+ 1. Parser: custom rule dispatch on top of markdown-it.
235
+ 2. Validator: 20+ new rules for new tree shapes.
236
+ 3. Renderer: pure HTML output, no React/Vue dependency.
237
+ :::
238
+ ```
239
+
240
+ Attributes:
241
+
242
+ | name | values | default |
243
+ |---|---|---|
244
+ | `title` | string | empty |
245
+ | `open` | `true` / `false` | `false` |
246
+
247
+ ## carousel
248
+
249
+ Touch / scroll-snap carousel. Cells separated by `---`.
250
+
251
+ ```rmd
252
+ :::carousel autoplay=true interval=4000
253
+ ### Slide 1
254
+ First content
255
+ ---
256
+ ### Slide 2
257
+ Second content
258
+ ---
259
+ ### Slide 3
260
+ Third content
261
+ :::
262
+ ```
263
+
264
+ Attributes:
265
+
266
+ | name | values | default |
267
+ |---|---|---|
268
+ | `autoplay` | `true` / `false` | `false` |
269
+ | `interval` | number (ms) | `3000` |
270
+
271
+ ## embed
272
+
273
+ Embed external media (video, map, app). Theme-controlled aspect ratio.
274
+
275
+ ```rmd
276
+ :::embed type=video id="https://www.youtube.com/embed/XXXX" aspect-ratio="16/9"
277
+ :::
278
+ ```
279
+
280
+ Attributes:
281
+
282
+ | name | values | default |
283
+ |---|---|---|
284
+ | `type` | `video` / `map` / `iframe` | `unknown` |
285
+ | `id` | URL or external id | empty |
286
+ | `aspect-ratio` | `16/9` / `4/3` / etc. | null |
287
+
288
+ Block body is ignored.
289
+
290
+ ## math
291
+
292
+ LaTeX math block. Renderer outputs as math container; the active theme decides
293
+ whether to typeset (KaTeX/MathJax) or fall back to monospace.
294
+
295
+ ```rmd
296
+ :::math
297
+ \mathcal{L} = \sum_{i=1}^{N} \left( y_i \log(\hat{y}_i) + (1-y_i) \log(1-\hat{y}_i) \right)
298
+ :::
299
+ ```
300
+
301
+ ## Choosing Blocks
302
+
303
+ | Goal | Suggested blocks |
304
+ |---|---|
305
+ | Compare options | `grid` + `chart` + `callout` |
306
+ | Explain a PR | `diff` + `tabs` + `callout` |
307
+ | Tunable prototype | `slider` + `export` |
308
+ | Release / workflow | `flow` + `callout` + `timeline` |
309
+ | Status report | `chart` + `timeline` + `kanban` |
310
+ | Research brief | `chart` + `grid` + `callout` + `details` |
311
+ | Long doc with collapsible appendix | `details` + `tabs` |
312
+ | Visual gallery / showcase | `carousel` + `grid masonry` |
313
+ | Math / formal explanation | `math` + `callout` |
314
+
315
+ ## Don't
316
+
317
+ - Don't add CSS, color, pixel, or font attributes — they belong to the theme.
318
+ - Don't nest `grid` in `grid`, or `tabs` in `tabs`.
319
+ - Don't put body content inside `:::slider` or `:::embed`.
320
+ - Don't invent new positional arguments beyond what's listed here.
321
+ - Don't use experimental block names that aren't in this file.