Skip to content

Discussion: YAML frontmatter support at the top of .jaw files #62

Description

@dishmint

Summary

Should JAW support a YAML frontmatter block at the top of .jaw files (delimited by ---), the way Markdown tooling does? This issue is to discuss whether it's worth adding.

Motivation

A frontmatter block could carry file-level metadata that doesn't belong in the body — e.g.:

---
title: Vector Add
author: ...
version: 1
tags: [math, vectors]
---

Today the only metadata mechanism is decorators (#name / #name:value), which attach to a variable, step, or function rather than to the file as a whole.

Why this might not be necessary

JAW already has a Markdown story:

  • Fenced ```jaw blocks are recognized inside Markdown via the injection grammar (editors/vscode/syntaxes/jaw-markdown-injection.json), and samples/markdown.md demonstrates it.
  • Markdown already supports YAML frontmatter natively, and most Markdown toolchains parse it.

So anyone who wants file-level YAML metadata alongside JAW can author a .md file with a frontmatter block and embed their JAW in a fenced block — no changes to the JAW spec/parser required. Adding a second, JAW-native frontmatter syntax risks duplicating a capability that the Markdown path already covers.

Questions to resolve

  • Is there a concrete use case that the .jaw-in-Markdown path does not cover?
  • If we add it, where does the work land — lexer/parser (jaw-parse), grammar (jaw-grammar.md), the TextMate grammar, and the LSP would all need to account for a leading --- block.
  • Do we want metadata to be semantically meaningful (consumed by the LSP/tooling) or purely informational?
  • Does this overlap or conflict with the existing decorator system?

Proposed default

Lean toward not adding native YAML frontmatter to .jaw and instead documenting the "use a .md file with frontmatter + a fenced jaw block" pattern as the recommended way to attach file-level metadata — unless a use case the Markdown path can't serve comes up here.


Filed by Claude (Claude Code) on behalf of @dishmint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions