Skip to content

Add opt-in structural devices and an iconic device demo - #97

Merged
jlevy merged 19 commits into
claude/pensive-brahmagupta-wfm2xufrom
claude/kpress-v040-devices
Dec 3, 2026
Merged

jlevy merged 19 commits into
claude/pensive-brahmagupta-wfm2xufrom
claude/kpress-v040-devices

Conversation

@jlevy

@jlevy jlevy commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

KPress stack #100 · Layer 2 of 8
Previous layer #96 · Next layer #98 · Whole-stack guide and latest build

KPress renders labeled blocks and inline devices, with decorative Lucide masks, native folds, and page-scoped assets. The demo has structural, iconic, and plain Markdown pages. The browser check builds and serves that example and exercises a mask and native fold at a narrow width.

The final review added regressions for generator-backed sanitization allowlists, catalog-owned inline markup, linked fold labels, and fragment navigation into closed folds.

PR #98 replaces the intermediate authoring syntax with paired <k-block> tags and keeps the final module designs beside their packages.

{
  "softschema": {
    "contract": "metabrowser.collection:Collection/v1",
    "envelope": "collection",
    "status": "enforced"
  },
  "collection": {
    "comparison": {
      "merge_base": "56d4bbb3cdf84d6a1a58ecfb5c671a63d8fced14",
      "head": "de875eeee3c7b8557f1e64b4b1c4970ca408088d"
    },
    "items": [
      {
        "title": "Renderer seam and module boundary",
        "note": "Check that only parsed, rendered device syntax records usage. Review the shared alpha contract in the design layer.",
        "references": [
          {
            "pull": 96
          },
          {
            "path": "src/kpress/format/modules.py"
          },
          {
            "path": "src/kpress/devices/module.py"
          }
        ]
      },
      {
        "title": "Labels, icons, and fold fallback",
        "note": "Check decorative icon placement, the initial fold state, fragment navigation into closed folds, and the expanded fallback for titles that contain links.",
        "references": [
          {
            "path": "src/kpress/format/static/modules/devices/device-icons.css"
          },
          {
            "path": "src/kpress/format/static/modules/devices/fold.js"
          }
        ]
      },
      {
        "title": "Standalone examples",
        "note": "The structural page shows nesting and inline use. The icon page shows the shared vocabulary. The plain page supplies the unused-module control.",
        "references": [
          {
            "path": "examples/modules/README.md"
          },
          {
            "path": "examples/modules/content/icons.md"
          },
          {
            "path": "examples/modules/content/index.md"
          }
        ]
      },
      {
        "title": "Testing",
        "note": "All six hosted CI jobs passed on this revision, including the Python matrix and browser suite. The focused regressions also passed locally. High-contrast rendering and PDF pagination remain graduation checks.",
        "references": [
          {
            "path": "tests/test_playwright_modules.py"
          },
          {
            "path": "tests/modules/test_devices_publish.py"
          },
          {
            "path": "tests/js/device-fold.test.js"
          },
          {
            "path": "tests/test_reader_markdown_parity.py"
          }
        ]
      }
    ]
  }
}

RenderOptions.modules (YAML: format.modules) lets an opt-in module register Markdown
syntax on the per-render parser, record usage facts from parsed syntax, add trusted
markup after sanitization, and contribute page-scoped assets only to documents that
used it. With no modules, or an enabled module a document does not use, output is
byte-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L5kBhCB4ov4f4pDq8Am3VT
Labeled structural blocks (::: device <kind> [title]) with a general kind catalog,
vetted Lucide icons as CSS masks, a fixed tone palette, host kinds as data,
host data attributes, diagnostics, and device_markdown for dialect adapters.
Assets load only on pages that render a device. The alpha surface is pinned in
kpress.devices.contract and documented in docs/modules/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L5kBhCB4ov4f4pDq8Am3VT
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

Pitfall, worked example, definition, notation, and key point join the built-in
catalog, each with a distinct Lucide glyph vendored from the same pinned commit
(28 icons in all; device-icons.css stays under 3 KB compressed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L5kBhCB4ov4f4pDq8Am3VT
A heading token whose meta carries kpress_heading_id keeps that id, and every
authored id is reserved before slugging, so an ordinary heading with the same
text gets a numbered suffix instead of a duplicate id. Definitions entries use
this to keep published glossary anchors on their headings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L5kBhCB4ov4f4pDq8Am3VT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L5kBhCB4ov4f4pDq8Am3VT
From the ojoshe adoption:
- Sanitizer: a data-* name a host also lists in extra_attributes was stripped from
  standard tags (device aside/div) in sanitized mode. data-* names stay allowed by
  prefix, matching the sanitizer audit.
- device_markdown takes anchor, classes, and host data-* attrs and validates the
  attribute line (device_attribute_line), raising instead of emitting a line the
  attrs syntax cannot parse.
- An unparsable attribute line before a device fence reports
  invalid_device_attributes instead of silently rendering as text.
- device_blocks(markdown) lists the devices KPress would render, so adapters can
  skip them without parsing Markdown themselves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L5kBhCB4ov4f4pDq8Am3VT
…butes

Flowmark joins a device fence with adjacent lines and an attribute line onto the
fence. The guide now shows blank lines around fences and between the attribute
line and the fence (which attrs already accepts), and invalid_device_attributes
also covers an attribute line one blank line above the fence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L5kBhCB4ov4f4pDq8Am3VT
From the Paper 1 adoption: a title replaced the kind's label, so the passage's role
was lost in print and to screen readers once the decorative icon was gone. The label
now always shows the kind, then ': ' and the title in sentence case (new hooks
kpress-device-kind, -separator, -title). Titles wrap under the kind on narrow
screens, and the icon stays on the first line instead of centering on the block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L5kBhCB4ov4f4pDq8Am3VT
@jlevy
jlevy removed this pull request from stack #99 December 2, 2026 03:08
@jlevy
jlevy changed the base branch from main to claude/pensive-brahmagupta-wfm2xu December 2, 2026 03:08
@jlevy
jlevy added this pull request to stack #100 December 2, 2026 03:08
claude and others added 8 commits December 2, 2026 03:08
- '::: device note- Title' starts closed and 'note+' starts open. The server renders
  every device expanded (no-JS, print, PDF); modules/devices/fold.js, loaded only on
  pages with a folded device, moves the label into a native toggle button with
  aria-expanded/aria-controls and hides a closed body. Print shows it again.
- '[text]{device=tip}' renders an inline device, such as a callout in a list item:
  an icon in the tone's accent before the text and a visually hidden kind label, with
  the span's inline Markdown kept. Plain attribute spans are unaffected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L5kBhCB4ov4f4pDq8Am3VT
@jlevy jlevy changed the title feat: opt-in module seam and the kpress.devices alpha module Add opt-in structural devices and an iconic device demo Dec 2, 2026

@jlevy jlevy left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review A (senior engineering review, round 1) · head de875ee · base claude/pensive-brahmagupta-wfm2xu at 56d4bbb
Reviewer: strong tier, requested gpt-6-astra at xhigh · Channel: formal review
Coverage: 65-file layer. 55 files inspected or audited; peripheral files inventoried.
Tests run: Reviewed 55 of 65 changed files or their machine checks. The device test file was sampled and peripheral docs were inventoried. Icon generator check passed.

  • A1 · Low — An interrupted icon CSS regeneration can truncate the previous complete file. Use the existing atomic output helper. Generator

@jlevy jlevy left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review B (security review, round 1) · head de875ee · base claude/pensive-brahmagupta-wfm2xu at 56d4bbb
Reviewer: strong tier, requested gpt-6-astra at xhigh · Channel: formal review
Coverage: 65-file layer. 55 files inspected or audited; peripheral files inventoried.
Tests run: Read-only inspection of trust handling, reserved attributes, fold DOM, and all 28 SVGs.

No security findings. Style and icon choices stay within the catalog and authored HTML goes through the configured sanitizer.

@jlevy jlevy left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review C (correctness review, round 1) · head de875ee · base claude/pensive-brahmagupta-wfm2xu at 56d4bbb
Reviewer: strong tier, requested gpt-6-astra at xhigh · Channel: formal review
Coverage: 65-file layer. 55 files inspected or audited; peripheral files inventoried.
Tests run: Pinned-object rendering probes reproduced unresolved title footnotes. Existing tests protect fold semantics and native anchor navigation.

  • C1 · Medium — Device titles are parsed during HTML rendering, after footnote finalization. The title note stays literal in this layer, then becomes a broken footnote link in the shared paired-tag layer. Parse title inlines with the surrounding document before footnote collection. Title renderer

jlevy commented Dec 3, 2026

Copy link
Copy Markdown
Owner Author

Dispositions for review A at de875ee

  • A1: fixed in 6661679. The icon generator uses the shared atomic writer. The generated stylesheet still matches the SVG inputs. Bead kpr-4fkc.

jlevy commented Dec 3, 2026

Copy link
Copy Markdown
Owner Author

Dispositions for review C at de875ee

  • C1: fixed in 6661679. Device titles enter the document’s inline pass and retain link references, previews, and reading-order footnotes. Verified by the focused renderer test and by both module orders. Bead kpr-q9vw.

@jlevy
jlevy merged commit 0a8b6ba into main Dec 3, 2026
6 checks passed
@jlevy
jlevy deleted the claude/kpress-v040-devices branch December 3, 2026 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants