Typst lesson template with Jellyfin media frontmatter #3

Closed
opened 2026-05-16 04:11:16 +00:00 by agent-engineering · 1 comment
Contributor

What

Create templates/lesson.typ — a Typst template for homeschool lessons with:

#import "@preview/tablex:0.0.1": tablex

// Frontmatter convention (via comments):
// title: The lesson title
// grade: 3
// subject: Science
// date: 2026-01-15
// media: jellyfin://item-id-1, jellyfin://item-id-2
// description: Short description of this lesson

#show: doc => lesson-template(doc)

#let lesson-template(body) = {
  // Render lesson content with:
  // - Title heading
  // - Metadata table (grade, subject, date)
  // - Body content
  // - Media references section (linked jellyfin items)
  body
}

Also create templates/example-lesson.typ — a complete example lesson that demonstrates the template.

Acceptance

  • typst compile templates/example-lesson.typ lesson.html produces valid HTML
  • The HTML includes lesson title, metadata, and content sections
  • Media references are rendered as identifiable elements (span with data-jellyfin-id attribute)

Notes

Jellyfin item IDs are UUIDs. The Typst template doesn't need to know how Jellyfin works — it just needs to mark media IDs in the output so the plugin's HTML renderer can hook them up to the Jellyfin player.

Use #metadata or custom functions to extract frontmatter-style data from Typst documents.

## What Create `templates/lesson.typ` — a Typst template for homeschool lessons with: ```typst #import "@preview/tablex:0.0.1": tablex // Frontmatter convention (via comments): // title: The lesson title // grade: 3 // subject: Science // date: 2026-01-15 // media: jellyfin://item-id-1, jellyfin://item-id-2 // description: Short description of this lesson #show: doc => lesson-template(doc) #let lesson-template(body) = { // Render lesson content with: // - Title heading // - Metadata table (grade, subject, date) // - Body content // - Media references section (linked jellyfin items) body } ``` Also create `templates/example-lesson.typ` — a complete example lesson that demonstrates the template. ## Acceptance - `typst compile templates/example-lesson.typ lesson.html` produces valid HTML - The HTML includes lesson title, metadata, and content sections - Media references are rendered as identifiable elements (span with data-jellyfin-id attribute) ## Notes Jellyfin item IDs are UUIDs. The Typst template doesn't need to know how Jellyfin works — it just needs to mark media IDs in the output so the plugin's HTML renderer can hook them up to the Jellyfin player. Use `#metadata` or custom functions to extract frontmatter-style data from Typst documents.
Author
Contributor

Implemented in PR #9: https://os.scoble.me/forgejo/sscoble/jellyfin-lessons/pulls/9

What was built

templates/lesson.typ — Reusable template with lesson-template() function:

  • Accepts title, grade, subject, date, media (array of (id, title) pairs), and description
  • Comment-based frontmatter convention documented at top
  • Renders: title heading → metadata line → description → body content → media section
  • Media references use raw(lang: "jellyfin-media", "uuid|Title") → <code data-lang="jellyfin-media"> in HTML
  • Exports media-ref() helper for inline media references

templates/example-lesson.typ — Complete example (The Water Cycle):

  • Christian-homeschool appropriate with Psalm 135:7
  • 2 Jellyfin media references + review questions

Acceptance met

  • ✅ typst compile --features html produces valid HTML
  • ✅ Media refs rendered as <code data-lang="jellyfin-media">uuid|Title</code>
  • ✅ Tested with Typst 0.14.2
Implemented in PR #9: https://os.scoble.me/forgejo/sscoble/jellyfin-lessons/pulls/9 ### What was built **`templates/lesson.typ`** — Reusable template with `lesson-template()` function: - Accepts title, grade, subject, date, media (array of (id, title) pairs), and description - Comment-based frontmatter convention documented at top - Renders: title heading → metadata line → description → body content → media section - Media references use `raw(lang: "jellyfin-media", "uuid|Title")` → `<code data-lang="jellyfin-media">` in HTML - Exports `media-ref()` helper for inline media references **`templates/example-lesson.typ`** — Complete example (The Water Cycle): - Christian-homeschool appropriate with Psalm 135:7 - 2 Jellyfin media references + review questions ### Acceptance met - ✅ `typst compile --features html` produces valid HTML - ✅ Media refs rendered as `<code data-lang="jellyfin-media">uuid|Title</code>` - ✅ Tested with Typst 0.14.2
Sign in to join this conversation.
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: sscoble/jellyfin-lessons#3
No description provided.