Positional model: data-marte markers, --- blocks, structural style transfer#1
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Replaces marte's
:::selectorformat with a positional model, addsstructural style transfer, and deploys the demo to GitHub Pages.
Markers (positional, document order)
data-marteboolean attribute on any HTML element, or<!-- marte -->comment before a node — which also works on components(an attribute on a strictly-typed component is a svelte-check error; proven).
Markdown
---(a plain thematic break). The Nth block fills theNth marker. No selectors, ids, or
:::.Inject + style transfer (build-time)
<p>).placeholder:
class+stylecopied recursively, cycling siblingtemplates 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.
i18n bakes one
{#if <expr> === '<locale>'}branch per locale (reactive,styled), replacing the old virtual-module /
{@html}approach.GitHub Pages deploy
adapter-autotoadapter-staticand prerendered(
src/routes/+layout.ts);svelte.config.jsreadsBASE_PATHfor project-pageserving.
.github/workflows/deploy-pages.ymlbuilds withBASE_PATH=/<repo>anddeploys via
actions/deploy-pageson push tomain.from a workflow). Site will be
https://aslakhellesoy.github.io/marte/.Notable changes
virtual:martemodule, selector engine, and:::parser..md(was.no.md);applybakescontent into the
.svelte;extractbootstrapsdata-martemarkers.Herorewritten to showcase markers + a style-transferred bullet list.Verification
pnpm test(32) ·pnpm check·pnpm lint·pnpm build:lib·pnpm buildBASE_PATH=/marte pnpm buildprerenders the demo (cycledcard odd/evenclasses, preserved inline
<em>/<a>/<code>, scoped-CSS hashes,.nojekyll).https://claude.ai/code/session_01LL7pW5yU4BygUoLLy9aMFt