@dr-ishaan/remake-blocks 1.4.1 → 1.4.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.
- package/README.md +241 -98
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,35 +1,71 @@
|
|
|
1
|
-
# remake-blocks
|
|
1
|
+
# @dr-ishaan/remake-blocks
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Astro 6 + remark plugin for rendering GitHub-style callouts (admonitions), enhanced blockquotes, and disclosure widgets in Markdown content — **27 first-class types + 4 themes + inline callouts + directive syntax + safe-by-default HTML escaping + Lucide/emoji icon sets**.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Each directive maps 1:1 to its own unique visual identity, SVG icon, color palette, and CSS class. No alias resolution.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
### Callout types & syntax
|
|
12
|
+
- **27 built-in callout types** — GFM standard (5) + Obsidian core (10) + promoted aliases (12)
|
|
12
13
|
- **GitHub admonition syntax** — `> [!NOTE]`, `> [!TIP]`, `> [!WARNING]`, etc.
|
|
13
|
-
- **
|
|
14
|
+
- **Directive syntax** — `:::note[Title]` ... `:::` (Starlight/Docusaurus compat, opt-in)
|
|
15
|
+
- **MkDocs admonition syntax** — `!!! note`, `??? note`, `???+ note` (MkDocs Material compat, opt-in)
|
|
16
|
+
- **Custom titles** — `> [!WARNING] Deprecated API`
|
|
14
17
|
- **Collapsible callouts** — `> [!FAQ]-` (collapsed) and `> [!TIP]+` (expanded)
|
|
15
|
-
- **Disclosure widgets** — `> [!] Title` creates a plain collapsible block
|
|
18
|
+
- **Disclosure widgets** — `> [!] Title` creates a plain collapsible block
|
|
16
19
|
- **Accordion grouping** — consecutive `[!]` blocks auto-group into an accordion
|
|
17
20
|
- **Tree view** — nested `[!]` blocks get depth indicators
|
|
18
21
|
- **Custom callout types** — define your own with icon, color, and CSS class
|
|
19
|
-
- **
|
|
20
|
-
|
|
22
|
+
- **Configurable aliases** — `aliases: { note: ["n"] }` for short names
|
|
23
|
+
|
|
24
|
+
### Themes & styling
|
|
25
|
+
- **4 swappable CSS themes** — github, obsidian, vitepress, docusaurus
|
|
26
|
+
- **Inline callouts** — `{inline}` floats left, `{inline-end}` floats right (responsive)
|
|
27
|
+
- **Appearance variants** — `{appearance=minimal}`, `{appearance=hidden}`, etc.
|
|
28
|
+
- **Icon sets** — octicon (default), lucide, emoji, none
|
|
29
|
+
- **Per-callout named icon** — `{icon="rocket"}` uses a specific Lucide icon
|
|
30
|
+
- **Enhanced blockquotes** — rounded left accent line, darker text, auto-styled
|
|
31
|
+
- **i18n label customization** — `labels: { note: "注意" }` for localized titles
|
|
32
|
+
- **Dark mode** — automatic via `prefers-color-scheme` + manual via `data-theme` attribute
|
|
21
33
|
- **Auto CSS injection** — styles injected into every page by default
|
|
22
|
-
- **
|
|
23
|
-
|
|
34
|
+
- **CSS custom properties** — full `var()` system for easy customization
|
|
35
|
+
|
|
36
|
+
### Accessibility (WCAG-compliant)
|
|
37
|
+
- **`role="note"`** for ALL callout types (no `role="alert"` on static content — WCAG fix)
|
|
38
|
+
- **`aria-labelledby`** linking container → title id
|
|
39
|
+
- **`aria-hidden="true"`** on all decorative icons
|
|
40
|
+
- **`dir="auto"`** on container + title (RTL/Unicode support)
|
|
41
|
+
- **`data-collapsible`** attribute on all callout containers
|
|
42
|
+
- **Semantic HTML** — `<aside>` for non-collapsible, `<details>`/`<summary>` for collapsible
|
|
43
|
+
- **Zero JavaScript** for callouts — native HTML5 (collapsibles use `<details>`/`<summary>`)
|
|
44
|
+
- **axe-core verified** — 0 critical/serious violations across all 27 types
|
|
45
|
+
|
|
46
|
+
### Security (safe-by-default)
|
|
47
|
+
- **HTML escaping** — raw HTML in markdown body is escaped by default
|
|
48
|
+
- **`allowDangerousHtml` opt-in** — set `true` only if you trust your markdown source
|
|
49
|
+
- **`className`/`color` escaping** — prevents attribute breakout from config values
|
|
50
|
+
- **Custom callout config validation** — missing fields use defaults, no crashes
|
|
51
|
+
- **rehype-sanitize schema** — shipped as `sanitize-schema.json` for strict pipelines
|
|
52
|
+
- **Directive attribute security** — event handlers (`on*`) and `style` blocked
|
|
53
|
+
|
|
54
|
+
### Power-user features
|
|
55
|
+
- **`tags` option** — override container/title/body element names
|
|
56
|
+
- **`props` option** — per-type static or dynamic HTML attributes (function form)
|
|
57
|
+
- **`build()` escape hatch** — full custom render function for total output control
|
|
58
|
+
- **Directive attributes** — `:::note[Title]{#id .class key="value"}` (remark-directive compat)
|
|
59
|
+
- **Exported helpers** — `escapeHtml`, `escapeAttribute`, `sanitizeColor` for `build()` authors
|
|
24
60
|
- **Print-optimized** — clean print styles
|
|
25
|
-
- **
|
|
61
|
+
- **Single dependency** — only `unist-util-visit`
|
|
26
62
|
|
|
27
63
|
---
|
|
28
64
|
|
|
29
65
|
## Install
|
|
30
66
|
|
|
31
67
|
```bash
|
|
32
|
-
npm install remake-blocks
|
|
68
|
+
npm install @dr-ishaan/remake-blocks
|
|
33
69
|
```
|
|
34
70
|
|
|
35
71
|
## Quick Start (Astro)
|
|
@@ -37,7 +73,7 @@ npm install remake-blocks
|
|
|
37
73
|
```js
|
|
38
74
|
// astro.config.mjs
|
|
39
75
|
import { defineConfig } from "astro/config";
|
|
40
|
-
import remakeBlocks from "remake-blocks/astro";
|
|
76
|
+
import remakeBlocks from "@dr-ishaan/remake-blocks/astro";
|
|
41
77
|
|
|
42
78
|
export default defineConfig({
|
|
43
79
|
integrations: [remakeBlocks()],
|
|
@@ -62,7 +98,7 @@ Then use callouts in any Markdown or MDX file:
|
|
|
62
98
|
```js
|
|
63
99
|
import { unified } from "unified";
|
|
64
100
|
import remarkParse from "remark-parse";
|
|
65
|
-
import { remarkRemakeBlocks } from "remake-blocks";
|
|
101
|
+
import { remarkRemakeBlocks } from "@dr-ishaan/remake-blocks";
|
|
66
102
|
import remarkRehype from "remark-rehype";
|
|
67
103
|
import rehypeStringify from "rehype-stringify";
|
|
68
104
|
|
|
@@ -133,47 +169,77 @@ Consecutive `[!]` blocks are automatically grouped into an accordion. Nested `[!
|
|
|
133
169
|
|
|
134
170
|
## Syntax
|
|
135
171
|
|
|
136
|
-
###
|
|
172
|
+
### Blockquote callouts (primary syntax)
|
|
137
173
|
|
|
138
174
|
```markdown
|
|
139
175
|
> [!NOTE]
|
|
140
176
|
> Content goes here.
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
### Custom Title
|
|
144
177
|
|
|
145
|
-
```markdown
|
|
146
178
|
> [!WARNING] Breaking Change
|
|
147
179
|
> The v2 API has been deprecated.
|
|
180
|
+
|
|
181
|
+
> [!FAQ]-
|
|
182
|
+
> Click to reveal the answer.
|
|
183
|
+
|
|
184
|
+
> [!TIP]+
|
|
185
|
+
> This starts expanded but can be collapsed.
|
|
148
186
|
```
|
|
149
187
|
|
|
150
|
-
###
|
|
188
|
+
### Directive syntax (Starlight/Docusaurus compat)
|
|
189
|
+
|
|
190
|
+
Opt-in via `enableDirectiveSyntax: true`:
|
|
151
191
|
|
|
152
192
|
```markdown
|
|
153
|
-
|
|
154
|
-
|
|
193
|
+
:::note
|
|
194
|
+
Basic callout.
|
|
195
|
+
:::
|
|
196
|
+
|
|
197
|
+
:::note[Custom Title]
|
|
198
|
+
With title.
|
|
199
|
+
:::
|
|
200
|
+
|
|
201
|
+
:::warning{fold=-}
|
|
202
|
+
Collapsed callout.
|
|
203
|
+
:::
|
|
204
|
+
|
|
205
|
+
:::note[Title]{#my-id .custom-class data-type="example"}
|
|
206
|
+
With full directive attributes.
|
|
207
|
+
:::
|
|
155
208
|
```
|
|
156
209
|
|
|
157
|
-
###
|
|
210
|
+
### MkDocs admonition syntax (MkDocs Material compat)
|
|
211
|
+
|
|
212
|
+
Opt-in via `enableMkDocsSyntax: true`:
|
|
158
213
|
|
|
159
214
|
```markdown
|
|
160
|
-
|
|
161
|
-
|
|
215
|
+
!!! note
|
|
216
|
+
Non-collapsible callout (4-space indented body).
|
|
217
|
+
|
|
218
|
+
??? note
|
|
219
|
+
Collapsed callout.
|
|
220
|
+
|
|
221
|
+
???+ note
|
|
222
|
+
Expanded collapsible callout.
|
|
223
|
+
|
|
224
|
+
!!! note "Custom Title"
|
|
225
|
+
With custom title.
|
|
162
226
|
```
|
|
163
227
|
|
|
164
|
-
###
|
|
228
|
+
### Per-callout overrides
|
|
229
|
+
|
|
230
|
+
Use `{key=value}` syntax after the directive:
|
|
165
231
|
|
|
166
232
|
```markdown
|
|
167
|
-
> [!
|
|
168
|
-
>
|
|
169
|
-
>
|
|
170
|
-
>
|
|
171
|
-
>
|
|
172
|
-
> -
|
|
173
|
-
>
|
|
233
|
+
> [!NOTE]{icon=false} — hide icon for this callout
|
|
234
|
+
> [!NOTE]{icon="rocket"} — use a specific Lucide icon
|
|
235
|
+
> [!NOTE]{appearance=minimal} — minimal appearance variant
|
|
236
|
+
> [!NOTE]{appearance=hidden} — no title, no icon
|
|
237
|
+
> [!NOTE]{inline} — float left (responsive)
|
|
238
|
+
> [!NOTE]{inline-end} — float right (responsive)
|
|
239
|
+
> [!NOTE]{icon=false inline appearance=minimal} — multiple overrides
|
|
174
240
|
```
|
|
175
241
|
|
|
176
|
-
### Disclosure
|
|
242
|
+
### Disclosure widgets
|
|
177
243
|
|
|
178
244
|
```markdown
|
|
179
245
|
> [!] Section Title
|
|
@@ -193,56 +259,71 @@ Consecutive `[!]` blocks are automatically grouped into an accordion. Nested `[!
|
|
|
193
259
|
```js
|
|
194
260
|
// astro.config.mjs
|
|
195
261
|
import { defineConfig } from "astro/config";
|
|
196
|
-
import remakeBlocks from "remake-blocks/astro";
|
|
262
|
+
import remakeBlocks from "@dr-ishaan/remake-blocks/astro";
|
|
197
263
|
|
|
198
264
|
export default defineConfig({
|
|
199
265
|
integrations: [
|
|
200
266
|
remakeBlocks({
|
|
201
|
-
//
|
|
202
|
-
injectStyles: true,
|
|
203
|
-
|
|
204
|
-
//
|
|
205
|
-
|
|
267
|
+
// ── Core ──────────────────────────────────────────────
|
|
268
|
+
injectStyles: true, // auto-inject CSS (default: true)
|
|
269
|
+
enhanceBlockquotes: true, // style regular blockquotes (default: true)
|
|
270
|
+
dataCalloutType: true, // add data-callout-type attribute (default: true)
|
|
271
|
+
allowDangerousHtml: false, // ⚠️ safe-by-default HTML escaping (default: false)
|
|
206
272
|
|
|
207
|
-
//
|
|
273
|
+
// ── Callout classes ──────────────────────────────────
|
|
208
274
|
calloutClass: "callout",
|
|
209
|
-
|
|
210
|
-
// CSS class for callout title (default: "callout-title")
|
|
211
275
|
calloutTitleClass: "callout-title",
|
|
212
|
-
|
|
213
|
-
// CSS class for callout body (default: "callout-body")
|
|
214
276
|
calloutBodyClass: "callout-body",
|
|
215
277
|
|
|
216
|
-
//
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
//
|
|
222
|
-
//
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
//
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
278
|
+
// ── Disclosure widgets ───────────────────────────────
|
|
279
|
+
enableDisclosures: true, // enable [!] syntax (default: true)
|
|
280
|
+
enableAccordion: true, // auto-group consecutive [!] (default: true)
|
|
281
|
+
enableTreeView: true, // nested [!] tree view (default: true)
|
|
282
|
+
|
|
283
|
+
// ── Alternative syntaxes (opt-in) ────────────────────
|
|
284
|
+
enableDirectiveSyntax: false, // :::note[Title] syntax (default: false)
|
|
285
|
+
enableMkDocsSyntax: false, // !!! note / ??? note syntax (default: false)
|
|
286
|
+
|
|
287
|
+
// ── Visual options ───────────────────────────────────
|
|
288
|
+
showIndicator: true, // show icons globally (default: true)
|
|
289
|
+
iconSet: "octicon", // "octicon" | "lucide" | "emoji" | "none"
|
|
290
|
+
appearance: "default", // "default" | "minimal" | "simple" | "hidden"
|
|
291
|
+
|
|
292
|
+
// ── i18n labels ──────────────────────────────────────
|
|
293
|
+
labels: {
|
|
294
|
+
note: "注意",
|
|
295
|
+
tip: "ヒント",
|
|
296
|
+
warning: "警告",
|
|
297
|
+
},
|
|
298
|
+
|
|
299
|
+
// ── Aliases ──────────────────────────────────────────
|
|
300
|
+
aliases: {
|
|
301
|
+
note: ["n"],
|
|
302
|
+
tip: ["t"],
|
|
303
|
+
},
|
|
304
|
+
|
|
305
|
+
// ── Power-user options ───────────────────────────────
|
|
306
|
+
tags: { // override HTML element names
|
|
307
|
+
container: "aside",
|
|
308
|
+
title: "div",
|
|
309
|
+
body: "div",
|
|
310
|
+
},
|
|
311
|
+
props: { // per-type HTML attributes (static or function)
|
|
312
|
+
note: { "data-category": "info" },
|
|
313
|
+
warning: (parsed) => ({ "data-severity": parsed.collapsible ? "collapsible" : "static" }),
|
|
314
|
+
},
|
|
315
|
+
build: (parsed, config, bodyHtml, options) => { // full custom render
|
|
316
|
+
return `<div class="my-callout">${bodyHtml}</div>`;
|
|
317
|
+
},
|
|
318
|
+
|
|
319
|
+
// ── Custom callout types ─────────────────────────────
|
|
239
320
|
customCallouts: [
|
|
240
321
|
{
|
|
241
|
-
type: "
|
|
242
|
-
icon: "
|
|
243
|
-
className: "callout-
|
|
244
|
-
defaultTitle: "
|
|
245
|
-
color: "#
|
|
322
|
+
type: "machine-learning",
|
|
323
|
+
icon: "🧠",
|
|
324
|
+
className: "callout-ml",
|
|
325
|
+
defaultTitle: "Machine Learning",
|
|
326
|
+
color: "#7c3aed",
|
|
246
327
|
backgroundColor: "#f5f3ff",
|
|
247
328
|
},
|
|
248
329
|
],
|
|
@@ -253,6 +334,32 @@ export default defineConfig({
|
|
|
253
334
|
|
|
254
335
|
---
|
|
255
336
|
|
|
337
|
+
## Themes
|
|
338
|
+
|
|
339
|
+
4 swappable CSS themes are available. Import the one you want:
|
|
340
|
+
|
|
341
|
+
```js
|
|
342
|
+
// Default (github) — auto-injected when injectStyles: true
|
|
343
|
+
import "@dr-ishaan/remake-blocks/styles.css";
|
|
344
|
+
|
|
345
|
+
// Or pick a specific theme:
|
|
346
|
+
import "@dr-ishaan/remake-blocks/theme/github.css"; // GitHub style
|
|
347
|
+
import "@dr-ishaan/remake-blocks/theme/obsidian.css"; // Obsidian style
|
|
348
|
+
import "@dr-ishaan/remake-blocks/theme/vitepress.css"; // VitePress style
|
|
349
|
+
import "@dr-ishaan/remake-blocks/theme/docusaurus.css"; // Docusaurus style
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
Each theme includes:
|
|
353
|
+
- Full light + dark mode (`prefers-color-scheme` + `data-theme` attribute)
|
|
354
|
+
- All 27 callout types with per-type colors
|
|
355
|
+
- Enhanced blockquote styling (rounded left accent line)
|
|
356
|
+
- Disclosure widget styling (card with rounded left accent line)
|
|
357
|
+
- Accordion + tree view styling
|
|
358
|
+
- Inline callout CSS (responsive)
|
|
359
|
+
- Print-optimized styles
|
|
360
|
+
|
|
361
|
+
---
|
|
362
|
+
|
|
256
363
|
## Security: Safe-by-Default
|
|
257
364
|
|
|
258
365
|
By default, **raw HTML in markdown is HTML-escaped** before being placed in callout bodies. This prevents XSS attacks from untrusted markdown content.
|
|
@@ -286,14 +393,30 @@ Only set `allowDangerousHtml: true` if:
|
|
|
286
393
|
1. You fully trust your markdown source, **AND**
|
|
287
394
|
2. You have sanitized the markdown with a tool like `rehype-sanitize`
|
|
288
395
|
|
|
396
|
+
### rehype-sanitize schema
|
|
397
|
+
|
|
398
|
+
A compatible sanitize schema is shipped for strict security pipelines:
|
|
399
|
+
|
|
400
|
+
```js
|
|
401
|
+
import schema from "@dr-ishaan/remake-blocks/sanitize-schema.json";
|
|
402
|
+
import rehypeSanitize from "rehype-sanitize";
|
|
403
|
+
|
|
404
|
+
// In your pipeline:
|
|
405
|
+
const processor = unified()
|
|
406
|
+
.use(remarkParse)
|
|
407
|
+
.use(remarkRemakeBlocks)
|
|
408
|
+
.use(remarkRehype, { allowDangerousHtml: true })
|
|
409
|
+
.use(rehypeSanitize, schema)
|
|
410
|
+
.use(rehypeStringify);
|
|
411
|
+
```
|
|
412
|
+
|
|
289
413
|
### Custom Callout Config Validation
|
|
290
414
|
|
|
291
415
|
Custom callout configurations are validated and normalized:
|
|
292
416
|
- Missing fields are filled with safe defaults (no crash)
|
|
293
417
|
- `null` or non-object entries are skipped
|
|
294
|
-
-
|
|
295
|
-
- `
|
|
296
|
-
- `color` is validated against a safe CSS color pattern (hex, rgb, hsl, var(), named, etc.); invalid values fall back to a default gray
|
|
418
|
+
- `className` is HTML-escaped (prevents attribute breakout)
|
|
419
|
+
- `color` is validated against a safe CSS color pattern; invalid values fall back to gray
|
|
297
420
|
|
|
298
421
|
---
|
|
299
422
|
|
|
@@ -321,15 +444,24 @@ If a custom callout's `type` matches a built-in, the built-in is overridden.
|
|
|
321
444
|
|
|
322
445
|
---
|
|
323
446
|
|
|
324
|
-
##
|
|
447
|
+
## i18n Label Customization
|
|
325
448
|
|
|
326
|
-
|
|
449
|
+
Override default titles for any callout type — useful for non-English documentation:
|
|
327
450
|
|
|
328
451
|
```js
|
|
329
|
-
|
|
330
|
-
|
|
452
|
+
remakeBlocks({
|
|
453
|
+
labels: {
|
|
454
|
+
note: "注意",
|
|
455
|
+
tip: "ヒント",
|
|
456
|
+
warning: "警告",
|
|
457
|
+
caution: "危険",
|
|
458
|
+
important: "重要",
|
|
459
|
+
},
|
|
460
|
+
})
|
|
331
461
|
```
|
|
332
462
|
|
|
463
|
+
Works with all 27 builtin types, custom callout types, and all 3 syntaxes (blockquote, directive, MkDocs).
|
|
464
|
+
|
|
333
465
|
---
|
|
334
466
|
|
|
335
467
|
## Dark Mode
|
|
@@ -373,9 +505,10 @@ See `styles.css` for the complete list of CSS custom properties.
|
|
|
373
505
|
Each callout renders as:
|
|
374
506
|
|
|
375
507
|
```html
|
|
376
|
-
<aside class="callout callout-note" data-callout-type="note"
|
|
377
|
-
|
|
378
|
-
|
|
508
|
+
<aside class="callout callout-note" data-callout-type="note" data-collapsible="false"
|
|
509
|
+
role="note" aria-labelledby="callout-note-1" dir="auto">
|
|
510
|
+
<div class="callout-title" style="color:#0969da" id="callout-note-1" dir="auto">
|
|
511
|
+
<span class="callout-icon" style="color:#0969da" aria-hidden="true">
|
|
379
512
|
<!-- SVG icon -->
|
|
380
513
|
</span>
|
|
381
514
|
<span class="callout-title-text">Note</span>
|
|
@@ -389,9 +522,10 @@ Each callout renders as:
|
|
|
389
522
|
Collapsible callouts use `<details>`/`<summary>`:
|
|
390
523
|
|
|
391
524
|
```html
|
|
392
|
-
<details class="callout callout-faq collapsible" data-callout-type="faq"
|
|
393
|
-
|
|
394
|
-
|
|
525
|
+
<details class="callout callout-faq collapsible" data-callout-type="faq" data-collapsible="true"
|
|
526
|
+
role="note" aria-labelledby="callout-faq-1" dir="auto">
|
|
527
|
+
<summary class="callout-title" style="color:#b45309" id="callout-faq-1" dir="auto">
|
|
528
|
+
<span class="callout-icon" style="color:#b45309" aria-hidden="true"><!-- SVG --></span>
|
|
395
529
|
<span class="callout-title-text">FAQ</span>
|
|
396
530
|
</summary>
|
|
397
531
|
<div class="callout-body">
|
|
@@ -402,11 +536,27 @@ Collapsible callouts use `<details>`/`<summary>`:
|
|
|
402
536
|
|
|
403
537
|
---
|
|
404
538
|
|
|
539
|
+
## Exported Helpers
|
|
540
|
+
|
|
541
|
+
For users who supply a custom `build()` render function:
|
|
542
|
+
|
|
543
|
+
```js
|
|
544
|
+
import { escapeHtml, escapeAttribute, sanitizeColor } from "@dr-ishaan/remake-blocks";
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
| Helper | Description |
|
|
548
|
+
|--------|-------------|
|
|
549
|
+
| `escapeHtml(str)` | Escapes `& < > " '` to HTML entities |
|
|
550
|
+
| `escapeAttribute(str)` | Same as `escapeHtml`, for attribute values |
|
|
551
|
+
| `sanitizeColor(value, fallback)` | Validates CSS color; returns fallback if dangerous |
|
|
552
|
+
|
|
553
|
+
---
|
|
554
|
+
|
|
405
555
|
## Caveats
|
|
406
556
|
|
|
407
557
|
### Strikethrough (`~~text~~`) requires `remark-gfm`
|
|
408
558
|
|
|
409
|
-
The plugin's body serializer handles `<del>` nodes correctly, but `remark-parse` alone does **not** enable GFM strikethrough. To use `~~strikethrough~~` syntax in callout bodies, add `remark-gfm
|
|
559
|
+
The plugin's body serializer handles `<del>` nodes correctly, but `remark-parse` alone does **not** enable GFM strikethrough. To use `~~strikethrough~~` syntax in callout bodies, add `remark-gfm`:
|
|
410
560
|
|
|
411
561
|
```js
|
|
412
562
|
import remarkGfm from "remark-gfm";
|
|
@@ -419,14 +569,7 @@ export default defineConfig({
|
|
|
419
569
|
|
|
420
570
|
### Horizontal rule after directive becomes a setext H2
|
|
421
571
|
|
|
422
|
-
In CommonMark,
|
|
423
|
-
|
|
424
|
-
```markdown
|
|
425
|
-
> [!NOTE]
|
|
426
|
-
> ---
|
|
427
|
-
```
|
|
428
|
-
|
|
429
|
-
is interpreted as a setext H2 heading ("[!NOTE]" with `---` underline), **not** as a callout with a thematic break body. To get a thematic break in the body, add a blank line before `---`:
|
|
572
|
+
In CommonMark, `> [!NOTE]\n> ---` is interpreted as a setext H2 heading, **not** as a callout with a thematic break body. Add a blank line before `---`:
|
|
430
573
|
|
|
431
574
|
```markdown
|
|
432
575
|
> [!NOTE]
|
|
@@ -439,7 +582,7 @@ is interpreted as a setext H2 heading ("[!NOTE]" with `---` underline), **not**
|
|
|
439
582
|
|
|
440
583
|
### Tables and other GFM features require `remark-gfm`
|
|
441
584
|
|
|
442
|
-
GFM-only features like tables, autolinks, and task list items require the `remark-gfm` plugin.
|
|
585
|
+
GFM-only features like tables, autolinks, and task list items require the `remark-gfm` plugin.
|
|
443
586
|
|
|
444
587
|
---
|
|
445
588
|
|
|
@@ -450,7 +593,7 @@ The remark plugin can be used independently of the Astro integration:
|
|
|
450
593
|
```js
|
|
451
594
|
import { unified } from "unified";
|
|
452
595
|
import remarkParse from "remark-parse";
|
|
453
|
-
import { remarkRemakeBlocks } from "remake-blocks";
|
|
596
|
+
import { remarkRemakeBlocks } from "@dr-ishaan/remake-blocks";
|
|
454
597
|
|
|
455
598
|
const processor = unified()
|
|
456
599
|
.use(remarkParse)
|
|
@@ -460,7 +603,7 @@ const processor = unified()
|
|
|
460
603
|
A backward-compatible alias `remarkCalloutBlocks` is also exported:
|
|
461
604
|
|
|
462
605
|
```js
|
|
463
|
-
import { remarkCalloutBlocks } from "remake-blocks";
|
|
606
|
+
import { remarkCalloutBlocks } from "@dr-ishaan/remake-blocks";
|
|
464
607
|
```
|
|
465
608
|
|
|
466
609
|
---
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dr-ishaan/remake-blocks",
|
|
3
|
-
"version": "1.4.
|
|
4
|
-
"description": "Astro 6 + remark plugin
|
|
3
|
+
"version": "1.4.2",
|
|
4
|
+
"description": "Astro 6 + remark plugin — 27 callout types, 4 themes, disclosure widgets, inline callouts, directive syntax, MkDocs syntax, i18n labels, safe-by-default XSS escaping, WCAG accessibility, Lucide/emoji icons",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|