Skip to content

Proposal 0022: inline formatting in notes - #159

Merged
dubadub merged 2 commits into
mainfrom
proposal/0022-note-formatting
Nov 28, 2026
Merged

dubadub merged 2 commits into
mainfrom
proposal/0022-note-formatting

Conversation

@dubadub

@dubadub dubadub commented Nov 13, 2026

Copy link
Copy Markdown
Member

Summary

  • Allow three inline Markdown constructs inside > notes: emphasis (*text*, _text_), strong emphasis (**text**, __text__) and links ([text](destination)). Emphasis and links follow the CommonMark 0.31.2 rules; everything else Markdown defines (lists, headings, code, images, HTML) stays plain text.
  • Notes only. Steps, metadata, section names and ingredient notes are read as before.
  • The parser reads the formatting, so applications need no Markdown library. A parsed note becomes a list of type: text runs with optional strong, emphasis and link properties; joining the value of every run gives the plain text.
  • A backslash keeps the meaning it already has in cooklang-rs (the next character is plain text), with one added rule: an escaped character never opens or closes formatting.
  • Defines which link destinations applications may make active (http, https, mailto, and paths inside the recipe collection), and how a path to a .cook file opens that recipe.

Motivation

The > marker was borrowed from Markdown and people expect a little more of it to work. Today **Make ahead:** shows its asterisks, and a note cannot give a link readable text or point to another recipe. Letting each application run its own Markdown library would give different results per app and interpret far more than intended (a note starting with * becomes a list).

Addresses discussion #138 for notes, and the notes half of #82. Links in steps stay with #111 (0013), which should reuse the same syntax and link property if it goes ahead.

Things worth a reviewer's attention

  • Run shape. Flat runs with flags, not a nested tree and not one item type per kind of formatting. Both alternatives are discussed in the proposal.
  • Both * and _. The cases that change their reading unintentionally (several footnote marks in one paragraph, a name wrapped in underscores, multiplication written as 2*250 g) are listed under "Backward compatibility", each with its escape.
  • Comments run first. -- inside a destination and link text starting with - are read as comments, as they are today; the proposal documents the escapes.
  • Canonical tests. They do not cover notes at present, so the proposal adds a notes key to test results.

Rendered proposal

@dubadub
dubadub marked this pull request as draft November 14, 2026 20:05
@dubadub
dubadub marked this pull request as ready for review November 14, 2026 21:07
@Plommonsorbet

Copy link
Copy Markdown

I like this and agree with it as written. One thing I would add while the note model is open: comments should be preserved in the recipe model, since today cooklang-rs drops them before the model and a recipe that is parsed, scaled and written back loses every comment the author wrote.

@dubadub

dubadub commented Nov 28, 2026

Copy link
Copy Markdown
Member Author

Good point. Comments are dropped everywhere, not only in notes: a full line, the end of a step, a section line, inside component braces and in the YAML frontmatter. So any parse-and-write round trip loses them. I've opened cooklang/cooklang-rs#168 to keep them in the parsed recipe, so Cooklang-to-Cooklang output preserves them. It has a reproduction, the places where the parser drops comments, and the open questions: opt-in or on by default, the canonical tests, the bindings, and how comments inside notes fit with the runs this proposal introduces.

@dubadub
dubadub merged commit 8a263a4 into main Nov 28, 2026
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