@dr-ishaan/remake-blocks 1.1.0 → 1.3.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/dist/types.d.ts CHANGED
@@ -192,6 +192,136 @@ export interface RemakeBlocksOptions {
192
192
  * or has been sanitized.
193
193
  */
194
194
  allowDangerousHtml?: boolean;
195
+ /**
196
+ * Map of aliases for callout types. Aliases let users use shorter or
197
+ * alternative names for builtin or custom callout types.
198
+ *
199
+ * Keys are the canonical type (must exist in builtins or `customCallouts`).
200
+ * Values are arrays of alias names that will resolve to the canonical type.
201
+ *
202
+ * @example
203
+ * ```ts
204
+ * aliases: {
205
+ * note: ["n", "info-note"],
206
+ * tip: ["t"],
207
+ * }
208
+ * // Now `> [!N]` and `> [!INFO-NOTE]` render as `note` callouts.
209
+ * ```
210
+ *
211
+ * @default undefined (no aliases)
212
+ */
213
+ aliases?: Record<string, string[]>;
214
+ /**
215
+ * Whether to render icons in the callout title.
216
+ *
217
+ * - `true` (default): render the icon (builtin SVG or custom icon)
218
+ * - `false`: skip the icon entirely (no `<span class="callout-icon">`)
219
+ *
220
+ * Can be overridden per-callout via `> [!NOTE]{icon=false}` syntax.
221
+ *
222
+ * @default true
223
+ */
224
+ showIndicator?: boolean;
225
+ /**
226
+ * Default icon set for builtin callout types.
227
+ *
228
+ * - `"octicon"` (default): GitHub Octicons (current behavior)
229
+ * - `"lucide"`: Lucide icons (matching rehype-callouts' Obsidian theme)
230
+ * - `"emoji"`: Emoji icons (e.g. ℹ️ for note, 💡 for tip)
231
+ * - `"none"`: No icons (equivalent to `showIndicator: false`)
232
+ *
233
+ * Custom callouts always use their configured `icon` regardless of this option.
234
+ *
235
+ * @default "octicon"
236
+ */
237
+ iconSet?: "octicon" | "lucide" | "emoji" | "none";
238
+ /**
239
+ * Visual density / appearance for callouts.
240
+ *
241
+ * - `"default"` (default): Full callout with title bar, icon, border, background.
242
+ * - `"minimal"`: Reduced padding, smaller title, no background color.
243
+ * - `"simple"`: No title bar — title appears as bold inline text above body.
244
+ * - `"hidden"`: No title, no icon, just the body content with a left border.
245
+ *
246
+ * Can be overridden per-callout via `> [!NOTE]{appearance=minimal}` syntax.
247
+ *
248
+ * @default "default"
249
+ */
250
+ appearance?: "default" | "minimal" | "simple" | "hidden";
251
+ /**
252
+ * Tag names for the callout HTML structure. Override to customize the
253
+ * output HTML elements (e.g. use `<div>` instead of `<aside>`).
254
+ *
255
+ * @default { container: "aside", title: "div", icon: "span", titleText: "span", body: "div" }
256
+ */
257
+ tags?: {
258
+ container?: string;
259
+ title?: string;
260
+ icon?: string;
261
+ titleText?: string;
262
+ body?: string;
263
+ };
264
+ /**
265
+ * Per-callout-type additional HTML attributes. Can be a static object
266
+ * applied to all callouts of that type, or a function that returns
267
+ * attributes dynamically based on the parsed callout.
268
+ *
269
+ * The returned object's keys become HTML attributes; values are strings
270
+ * (or undefined to skip). Use this to add `dir`, `style`, custom `data-*`
271
+ * attributes, etc.
272
+ *
273
+ * @example
274
+ * ```ts
275
+ * props: {
276
+ * note: { dir: "auto", "data-category": "info" },
277
+ * // or as a function:
278
+ * warning: (parsed) => ({ style: `--accent: ${parsed.collapsible ? "red" : "orange"}` }),
279
+ * }
280
+ * ```
281
+ *
282
+ * @default undefined
283
+ */
284
+ props?: Record<string, Record<string, string> | ((parsed: ParsedCallout) => Record<string, string>)>;
285
+ /**
286
+ * Custom render function (escape hatch). When provided, replaces the
287
+ * default HTML rendering entirely. Use this for full control over output.
288
+ *
289
+ * The function receives the parsed callout, the resolved config, the
290
+ * rendered body HTML, and the plugin options. It must return an HTML
291
+ * string.
292
+ *
293
+ * **Security note:** the returned HTML is injected as raw HTML. You are
294
+ * responsible for escaping user-supplied content (use the provided
295
+ * `escapeHtml` helper from the `escapeHtml` export).
296
+ *
297
+ * @example
298
+ * ```ts
299
+ * build: (parsed, config, bodyHtml, options) => {
300
+ * return `<div class="my-callout my-callout-${parsed.type}">${bodyHtml}</div>`;
301
+ * }
302
+ * ```
303
+ *
304
+ * @default undefined (use built-in renderer)
305
+ */
306
+ build?: (parsed: ParsedCallout, config: CalloutConfig | undefined, bodyHtml: string, options: Required<RemakeBlocksOptions>) => string;
307
+ /**
308
+ * v1.3.0+: Enable `:::type[Title]` directive syntax (Starlight/Docusaurus compat).
309
+ *
310
+ * When `true`, the plugin detects `:::type` blocks in markdown and renders
311
+ * them as callouts. This allows content portability with Starlight, Docusaurus,
312
+ * MkDocs Material, and other tools that use the directive syntax.
313
+ *
314
+ * Supported syntax:
315
+ * - `:::note` ... `:::` — basic callout
316
+ * - `:::note[Custom Title]` ... `:::` — with custom title
317
+ * - `:::note{fold=-}` ... `:::` — with overrides (same as `> [!NOTE]-`)
318
+ * - `::::note` ... `::::` — 4-colon variant (for nesting)
319
+ *
320
+ * The directive syntax can be used alongside the standard `> [!NOTE]` syntax.
321
+ *
322
+ * @default false (opt-in for backward compatibility)
323
+ */
324
+ enableDirectiveSyntax?: boolean;
195
325
  }
196
326
  /**
197
327
  * Options for the `remake-blocks` Astro integration.
@@ -225,6 +355,13 @@ export interface ParsedCallout {
225
355
  collapsibleOpen: boolean;
226
356
  /** Whether this is a disclosure widget (plain collapsible, no color/icon) */
227
357
  isDisclosure: boolean;
358
+ /** Per-callout overrides parsed from `{key=value}` syntax. v1.2.0+. */
359
+ overrides?: {
360
+ icon?: boolean;
361
+ appearance?: "default" | "minimal" | "simple" | "hidden";
362
+ /** v1.3.0+: inline floating behavior. `inline` floats left, `inline-end` floats right. */
363
+ inline?: "inline" | "inline-end";
364
+ };
228
365
  }
229
366
  /**
230
367
  * Configuration map used internally for O(1) callout type lookup.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAE1B,MAAM,GACN,KAAK,GACL,WAAW,GACX,SAAS,GACT,SAAS,GAET,UAAU,GACV,MAAM,G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;;;;;;;;;;;;;;;;OAoBG;IACH,KAAK,CAAC,EAAE,CACN,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,aAAa,GAAG,SAAS,EACjC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,QAAQ,CAAC,mBAAmB,CAAC,KACnC,MAAM,CAAC;IAEZ;;;;;;;;;;;;;;;;OAgBG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAMD;;;;;GAKG;AACH,MAAM,WAAW,wBAAyB,SAAQ,mBAAmB;IACnE;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAMD;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,kEAAkE;IAClE,IAAI,EAAE,WAAW,GAAG,YAAY,CAAC;IACjC,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,yCAAyC;IACzC,WAAW,EAAE,OAAO,CAAC;IACrB,yEAAyE;IACzE,eAAe,EAAE,OAAO,CAAC;IACzB,6EAA6E;IAC7E,YAAY,EAAE,OAAO,CAAC;IACtB,uEAAuE;IACvE,SAAS,CAAC,EAAE;QACV,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,UAAU,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;QACzD,0FAA0F;QAC1F,MAAM,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;KAClC,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,GAAG,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dr-ishaan/remake-blocks",
3
- "version": "1.1.0",
4
- "description": "Astro 6 + remark plugin for GitHub-style callouts (admonitions), enhanced blockquotes, and disclosure widgets — 27 first-class types + safe-by-default HTML escaping",
3
+ "version": "1.3.0",
4
+ "description": "Astro 6 + remark plugin for GitHub-style callouts (admonitions), enhanced blockquotes, and disclosure widgets — 27 first-class types + 4 themes + inline callouts + directive syntax + safe-by-default HTML escaping + Lucide/emoji icon sets",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -15,7 +15,12 @@
15
15
  "./astro": {
16
16
  "import": "./dist/astro.js",
17
17
  "types": "./dist/astro.d.ts"
18
- }
18
+ },
19
+ "./theme/github.css": "./dist/theme/github.css",
20
+ "./theme/obsidian.css": "./dist/theme/obsidian.css",
21
+ "./theme/vitepress.css": "./dist/theme/vitepress.css",
22
+ "./theme/docusaurus.css": "./dist/theme/docusaurus.css",
23
+ "./sanitize-schema.json": "./dist/sanitize-schema.json"
19
24
  },
20
25
  "files": [
21
26
  "dist/",
@@ -23,7 +28,7 @@
23
28
  "LICENSE"
24
29
  ],
25
30
  "scripts": {
26
- "build": "tsc && cp src/styles.css dist/styles.css && cp src/accordion.js dist/accordion.js",
31
+ "build": "tsc && cp src/themes/github.css dist/styles.css && mkdir -p dist/theme && cp src/themes/*.css dist/theme/ && cp src/accordion.js dist/accordion.js && cp src/sanitize-schema.json dist/sanitize-schema.json",
27
32
  "dev": "tsc --watch",
28
33
  "test": "node --experimental-vm-modules tests/test-exhaustive.mts",
29
34
  "prepublishOnly": "npm run build"
@@ -46,7 +51,16 @@
46
51
  "obsidian-callout",
47
52
  "remake-blocks",
48
53
  "security",
49
- "xss-safe"
54
+ "xss-safe",
55
+ "multi-theme",
56
+ "obsidian-theme",
57
+ "vitepress-theme",
58
+ "docusaurus-theme",
59
+ "inline-callouts",
60
+ "directive-syntax",
61
+ "lucide-icons",
62
+ "emoji-icons",
63
+ "rehype-sanitize"
50
64
  ],
51
65
  "license": "MIT",
52
66
  "author": "dr-ishaan <adi.ishaan@proton.me>",