feature: svekyll preprocessor architecture #19

Open
xrd wants to merge 4 commits from feature/svekyll-preprocessor into main
Owner

Goals

Replace current model (entire post body = single Svelte component) with a preprocessor approach.

Design

  • Use <!-- sprinkyll:svelte -->...<!-- /sprinkyll:svelte --> as Svelte block delimiters
  • Remove sprinkyll: type: "svekyll" frontmatter requirement
  • Support multiple Svelte blocks per post
  • Markdown processes normally through Hugo, Svelte blocks compile and inline separately

Architecture

  1. Parse markdown, extract Svelte blocks
  2. Replace blocks with placeholder shortcodes
  3. Process remaining markdown through Hugo
  4. Compile each Svelte block independently
  5. Inline compiled bundles at placeholder locations

Benefits

  • Inspectable intermediate files
  • Selective stage execution
  • Cleaner separation of markdown and Svelte concerns
## Goals Replace current model (entire post body = single Svelte component) with a preprocessor approach. ### Design - Use `<!-- sprinkyll:svelte -->...<!-- /sprinkyll:svelte -->` as Svelte block delimiters - Remove `sprinkyll: type: "svekyll"` frontmatter requirement - Support multiple Svelte blocks per post - Markdown processes normally through Hugo, Svelte blocks compile and inline separately ### Architecture 1. Parse markdown, extract Svelte blocks 2. Replace blocks with placeholder shortcodes 3. Process remaining markdown through Hugo 4. Compile each Svelte block independently 5. Inline compiled bundles at placeholder locations ### Benefits - Inspectable intermediate files - Selective stage execution - Cleaner separation of markdown and Svelte concerns
The template main.js hardcoded 'svekyll-app' as the Svelte mount target,
but Hugo shortcodes generate IDs like 'svekyll-app-{slug}'. This caused
the Svelte app to fail mounting with:

  Uncaught TypeError: can't access property '$$', i is undefined

Instead of a generic wildcard fallback (which would break with multiple
Svelte apps on one page), sprinkyll now replaces a SPRINKYLL_TARGET_ID
placeholder in main.js with the correct slug-specific ID at build time.

This ensures each svekyll bundle mounts to its own container element,
supporting multiple Svelte apps per page.
Goals:
- Replace current model (entire post body = single Svelte component)
- New preprocessor approach: parse markdown, extract Svelte blocks, compile independently
- Use <!-- sprinkyll:svelte -->...<!-- /sprinkyll:svelte --> as delimiters
- Remove sprinkyll: type: "svekyll" frontmatter requirement
- Support multiple Svelte blocks per post
- Markdown processes normally through Hugo, Svelte blocks compile and inline separately

Architecture:
1. Parse markdown, extract Svelte blocks
2. Replace blocks with placeholder shortcodes
3. Process remaining markdown through Hugo
4. Compile each Svelte block independently
5. Inline compiled bundles at placeholder locations

Benefits:
- Inspectable intermediate files
- Selective stage execution
- Cleaner separation of markdown and Svelte concerns
- Add preprocessor module to extract <!-- sprinkyll:svelte --> blocks from markdown
- Replace old svekyll model (entire post = single Svelte component) with preprocessor
- Each Svelte block is compiled independently and inlined via Hugo shortcode
- No longer requires sprinkyll: type: "svekyll" frontmatter
- Builder now processes all .md files looking for sprinkyll:svelte markers
- Hugo shortcode updated to use block ID and inline assets from static/sprinkyll/{id}/
- main.js uses wildcard selector for mounting to any sprinkyll-{id} container
- Fix shortcode braces: Zig's fmt.allocPrint treats {{ as escape for literal {,
  so concatenate braces separately to produce {{< >}} syntax
- Remove debug logging from preprocessor and builder
- Verify end-to-end build works with mixed-svelte.md test post
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feature/svekyll-preprocessor:feature/svekyll-preprocessor
git switch feature/svekyll-preprocessor

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff feature/svekyll-preprocessor
git switch feature/svekyll-preprocessor
git rebase main
git switch main
git merge --ff-only feature/svekyll-preprocessor
git switch feature/svekyll-preprocessor
git rebase main
git switch main
git merge --no-ff feature/svekyll-preprocessor
git switch main
git merge --squash feature/svekyll-preprocessor
git switch main
git merge --ff-only feature/svekyll-preprocessor
git switch main
git merge feature/svekyll-preprocessor
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
svekyll/sprinkyll!19
No description provided.