@cube-drone/marquee-html-renderer 0.2.0 → 0.4.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/render.js CHANGED
@@ -315,6 +315,19 @@ function directive(name, attrs, nodes, ctx) {
315
315
  }
316
316
  case "table":
317
317
  return renderTable(attrs, nodes, ctx);
318
+ case "center":
319
+ case "right":
320
+ case "left":
321
+ // The <center> tag, back from the dead in directive clothing - plus
322
+ // its siblings: right for symmetry, left as the un-aligner (useful
323
+ // only inside the other two, which is exactly when you want it).
324
+ // Physical directions, deliberately: predictable beats logical.
325
+ return `<div class="mq-${name}">${inner}</div>`;
326
+ case "spoiler":
327
+ // The block form of the [spoiler] span: hide a whole region (an image,
328
+ // a paragraph) behind the same blur, same reveal-on-hover. Reuses the
329
+ // mq-spoiler class - the CSS is element-agnostic.
330
+ return `<div class="mq-spoiler mq-spoiler-block" tabindex="0">${inner}</div>`;
318
331
  }
319
332
  // Unknown vocabulary: a container renders its children with an affordance
320
333
  // that something wrapped them; a leaf renders the inert placeholder.
@@ -389,6 +402,13 @@ function span(name, attrs, nodes, ctx) {
389
402
  return `<small>${inner}</small>`;
390
403
  case "big":
391
404
  return `<big>${inner}</big>`; // obsolete and eternal, like <font>
405
+ case "spoiler":
406
+ // The content is present and never eaten - just blurred, revealed on
407
+ // hover/focus (the static renderer has no JS to gate a click). An
408
+ // interactive renderer turns the same class into click-to-reveal.
409
+ // Degrades, like everything, to readable content: no stylesheet means
410
+ // a visible spoiler, which beats a hidden one.
411
+ return `<span class="mq-spoiler" tabindex="0">${inner}</span>`;
392
412
  case "size": {
393
413
  const value = attrs["size"];
394
414
  if (value !== undefined && /^[1-7]$/.test(value)) {
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@cube-drone/marquee-html-renderer",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Reference static HTML renderer for the Marquee markup language",
5
5
  "license": "MPL-2.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/cube-drone/marqueemarkup.git",
9
- "directory": "ts/html_renderer"
9
+ "directory": "ts/marquee-html-renderer"
10
10
  },
11
11
  "type": "module",
12
12
  "engines": {
@@ -35,12 +35,12 @@
35
35
  "prepack": "npm run build"
36
36
  },
37
37
  "dependencies": {
38
- "@cube-drone/marquee-parser": "^0.2.0"
38
+ "@cube-drone/marquee-parser": "^0.4.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@cube-drone/marquee-css": "^0.2.0",
42
- "@cube-drone/marquee-fonts": "^0.2.0",
43
- "@cube-drone/marquee-turbolink": "^0.2.0",
41
+ "@cube-drone/marquee-css": "^0.4.0",
42
+ "@cube-drone/marquee-fonts": "^0.4.0",
43
+ "@cube-drone/marquee-turbolink": "^0.4.0",
44
44
  "@types/node": "^24.0.0",
45
45
  "typescript": "^5.9.0"
46
46
  }
package/src/render.ts CHANGED
@@ -349,6 +349,19 @@ function directive(name: string, attrs: Attrs, nodes: Node[], ctx: Ctx): string
349
349
  }
350
350
  case "table":
351
351
  return renderTable(attrs, nodes, ctx);
352
+ case "center":
353
+ case "right":
354
+ case "left":
355
+ // The <center> tag, back from the dead in directive clothing - plus
356
+ // its siblings: right for symmetry, left as the un-aligner (useful
357
+ // only inside the other two, which is exactly when you want it).
358
+ // Physical directions, deliberately: predictable beats logical.
359
+ return `<div class="mq-${name}">${inner}</div>`;
360
+ case "spoiler":
361
+ // The block form of the [spoiler] span: hide a whole region (an image,
362
+ // a paragraph) behind the same blur, same reveal-on-hover. Reuses the
363
+ // mq-spoiler class - the CSS is element-agnostic.
364
+ return `<div class="mq-spoiler mq-spoiler-block" tabindex="0">${inner}</div>`;
352
365
  }
353
366
  // Unknown vocabulary: a container renders its children with an affordance
354
367
  // that something wrapped them; a leaf renders the inert placeholder.
@@ -425,6 +438,13 @@ function span(name: string, attrs: Attrs, nodes: Node[], ctx: Ctx): string {
425
438
  return `<small>${inner}</small>`;
426
439
  case "big":
427
440
  return `<big>${inner}</big>`; // obsolete and eternal, like <font>
441
+ case "spoiler":
442
+ // The content is present and never eaten - just blurred, revealed on
443
+ // hover/focus (the static renderer has no JS to gate a click). An
444
+ // interactive renderer turns the same class into click-to-reveal.
445
+ // Degrades, like everything, to readable content: no stylesheet means
446
+ // a visible spoiler, which beats a hidden one.
447
+ return `<span class="mq-spoiler" tabindex="0">${inner}</span>`;
428
448
  case "size": {
429
449
  const value = attrs["size"];
430
450
  if (value !== undefined && /^[1-7]$/.test(value)) {