@xynogen/pix-display 0.9.0 → 0.10.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xynogen/pix-display",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Pi core extension — inline chips, thinking blocks, and framed code rendering",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/src/directives.ts CHANGED
@@ -54,6 +54,8 @@ const MAX_BAR_LABEL = 20;
54
54
  const MAX_V_COL = 10;
55
55
  const ATTR = /(\w+)=(?:"((?:[^"\\]|\\.)*)"|([^\s"}]+))/g;
56
56
  const FENCE = /^\s*(```|~~~)/;
57
+ // /loop's own control directive: the model writes it, the reader never needs to see it.
58
+ const LOOP_DIRECTIVE = /^[ \t]*::loop\[/;
57
59
  const MIN_CARD = 16;
58
60
  const MAX_CHART = 72;
59
61
  // NBSP pads the axis gutter: Markdown would strip or code-block leading spaces.
@@ -423,7 +425,8 @@ export function renderCards(cards: readonly Card[], width: number): string[] {
423
425
 
424
426
  export function renderDirectives(markdown: string, width: number): string {
425
427
  // Cheap pre-check: most replies have no directive, link or path at all.
426
- if (!/::(?:card|bar|stacked|image)|:[a-z]+\[|https?:\/\/|\w\//.test(markdown)) return markdown;
428
+ if (!/::(?:card|bar|stacked|image|loop)|:[a-z]+\[|https?:\/\/|\w\//.test(markdown))
429
+ return markdown;
427
430
  const out: string[] = [];
428
431
  let fenced = false;
429
432
  let cards: Card[] = [];
@@ -441,6 +444,8 @@ export function renderDirectives(markdown: string, width: number): string {
441
444
  parts = [];
442
445
  };
443
446
  for (const line of markdown.split("\n")) {
447
+ // ::loop[...] is /loop's control channel for the model, not reader content.
448
+ if (!fenced && LOOP_DIRECTIVE.test(line)) continue;
444
449
  // Lines right after a card, up to a blank line or the next block directive, are
445
450
  // its body; a fence in the body stays whole.
446
451
  const last = cards.at(-1);