Skip to content

Positional model: data-marte markers, --- blocks, structural style transfer#1

Merged
aslakhellesoy merged 4 commits into
mainfrom
marte-positional
May 30, 2026
Merged

Positional model: data-marte markers, --- blocks, structural style transfer#1
aslakhellesoy merged 4 commits into
mainfrom
marte-positional

Conversation

@aslakhellesoy

@aslakhellesoy aslakhellesoy commented May 30, 2026

Copy link
Copy Markdown
Collaborator

What & why

Replaces marte's :::selector format with a positional model, adds
structural style transfer, and deploys the demo to GitHub Pages.

Markers (positional, document order)

  • data-marte boolean attribute on any HTML element, or
  • a <!-- marte --> comment before a node — which also works on components
    (an attribute on a strictly-typed component is a svelte-check error; proven).
  • A marked element is never descended into; its whole inner content is one block.

Markdown

  • Blocks separated by --- (a plain thematic break). The Nth block fills the
    Nth marker. No selectors, ids, or :::.

Inject + style transfer (build-time)

  • Leaf placeholder (h1/p/span…) → inline-rendered Markdown (no stray <p>).
  • Container placeholder (ul/li, cards…) → block HTML re-skinned onto the
    placeholder
    : class+style copied recursively, cycling sibling
    templates of the same tag for repeats (5 bullets onto 2 <li> templates →
    odd,even,odd,even,odd). Inline formatting (em/strong/a/code) passes through.
    A structural mismatch is a hard error.
  • Content is baked as real markup, so Svelte's scoped CSS applies to it.
    i18n bakes one {#if <expr> === '<locale>'} branch per locale (reactive,
    styled), replacing the old virtual-module / {@html} approach.

GitHub Pages deploy

  • Demo switched from adapter-auto to adapter-static and prerendered
    (src/routes/+layout.ts); svelte.config.js reads BASE_PATH for project-page
    serving.
  • .github/workflows/deploy-pages.yml builds with BASE_PATH=/<repo> and
    deploys via actions/deploy-pages on push to main.
  • Requires repo Settings → Pages → Source = "GitHub Actions" (can't be set
    from a workflow). Site will be https://aslakhellesoy.github.io/marte/.

Notable changes

  • Removed the virtual:marte module, selector engine, and ::: parser.
  • CLI default companion extension is now .md (was .no.md); apply bakes
    content into the .svelte; extract bootstraps data-marte markers.
  • Demo Hero rewritten to showcase markers + a style-transferred bullet list.
  • README rewritten for the positional model.

Verification

  • pnpm test (32) · pnpm check · pnpm lint · pnpm build:lib · pnpm build
  • BASE_PATH=/marte pnpm build prerenders the demo (cycled card odd/even
    classes, preserved inline <em>/<a>/<code>, scoped-CSS hashes, .nojekyll).

https://claude.ai/code/session_01LL7pW5yU4BygUoLLy9aMFt

claude added 4 commits May 30, 2026 12:20
Replace the :::selector format with positional matching:
- Markers: `data-marte` attribute (HTML elements) or `<!-- marte -->` comment
  (also works on components). Matched by document order; marked elements are
  not descended into.
- Markdown blocks separated by `---`, each rendered to HTML via marked.
- Build-time transform bakes styled markup directly (scoped CSS applies):
  leaf placeholders get inline content; container placeholders are re-skinned
  onto the placeholder structure (recursive class+style copy, cycling templates
  for repeats, fail-loudly on structural mismatch). i18n bakes {#if} branches.
- Removes the virtual module / {@html} / selector engine.
- CLI check/apply/extract updated; extract bootstraps data-marte markers.
- Full new vitest suite (35 tests). svelte-check, lint, build:lib all green.

Demo app and README still use the old syntax — updated in a follow-up.
- Demo Hero uses data-marte markers + ---/-separated Markdown, including a
  bullet list that showcases style transfer and template cycling (5 bullets
  re-skinned onto 2 styled <li> templates; scoped CSS applies).
- README rewritten for the positional model (markers, --- blocks, style
  transfer, i18n via {#if}, CLI, fail-loudly philosophy).
- Replace the initial changeset with one describing the positional model.
Style transfer only mirrors structural (block-level) elements onto the
placeholder. Inline/phrasing elements that Markdown produces inside block
content (em, strong, a, code…) now pass through untouched instead of failing
the "no matching placeholder element" check. Fixes container markers whose
Markdown contains bold/links/code (e.g. the demo's bullet list).
- Switch the demo from adapter-auto to adapter-static and prerender it
  (src/routes/+layout.ts), so it builds to a static `build/` directory.
- svelte.config.js reads BASE_PATH so the site can be served from /<repo>;
  dev and local builds default to root.
- Add .github/workflows/deploy-pages.yml: builds with BASE_PATH=/<repo>,
  uploads the artifact, and deploys via actions/deploy-pages (Pages source
  must be set to "GitHub Actions" in repo settings).
- app.html: drop the missing favicon link (was failing prerender); add
  static/.nojekyll.
@aslakhellesoy aslakhellesoy merged commit ddd9d6e into main May 30, 2026
1 check passed
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