Skip to content
This repository was archived by the owner on Nov 12, 2026. It is now read-only.

build(deps)!: move to twig 6 - #11

Merged
adammharris merged 1 commit into
mainfrom
cc/modest-mendel-tw57ql
Oct 16, 2026
Merged

adammharris merged 1 commit into
mainfrom
cc/modest-mendel-tw57ql

Conversation

@adammharris

Copy link
Copy Markdown
Member

Moves leaf from twig-doc 4.1 to twig 6, which is pure Rust. provui builds leaf together with prov, and prov is already on twig 6 (diaryx-org/prov#12).

Changes

  • Dependencies: twig-doc = { version = "6", default-features = false }, plus the five language crates leaf opens: twig-markdown, twig-djot, twig-html, twig-asciidoc and twig-xml.
  • twig's fig feature is off. leaf never used twig::meta, and turning it off keeps the YAML, TOML, JSON and figl parsers out of leaf. As in twig 4, a document's twig: frontmatter key is ignored.
  • leaf_core::Format is now leaf's own enum (crates/leaf-core/src/format.rs). It keeps the same variants and is still #[non_exhaustive]. .twig() / From gives twig's handle. supports, supports_with, is_authorable and name pass through to twig, and it gains Display.
  • Markdown extensions: extensions are now twig 6 feature-flag masks, and editors are built with Editor::new_with_flags. leaf_math_edit::doc::editor keeps its signature, and its wasm feature pulls in twig-markdown.
  • No more Zig: removed from CI (setup-zig), the Homebrew workflow, the flake (now the rust dev shell), the Xcode Cloud post-clone script, and comments in .cargo/config.toml, the Android files, xtask/src/android.rs, the leaf-ffi safety comment and the Swift README.
  • Flake: adds allowBuiltinFetchGit = true. It was already needed for the fig-css and mermaid git dependencies.
  • Lockfiles: the separate workspaces (leaf-gpui, apps/leaf, apps/leaf-dioxus, spikes/dioxus-widget) now resolve twig 6. apps/leaf-ios, which is archived, is untouched.
  • Swift, Kotlin and web: they reach leaf only through leaf-ffi and leaf-wasm, which take the format as a string, so they need no code changes.

Behavioural change

leaf_core::Format is no longer twig::Format. Code that only names its variants is unchanged. Code that hands it to twig calls .twig(). supports_with takes a feature mask, and twig 4's other formats and methods (Commonmark, Gfm, extension lookup) are not on leaf's enum. All 874 leaf-core tests pass unchanged on twig 6.

Checks

Run locally after rebasing onto a8b196c:

  • Passed:
    • sync-versions check
    • fmt
    • clippy (-D warnings)
    • package-isolation
    • bindings check (the Swift bindings are unchanged)
    • release build of leaf-tui
    • toolchain-pin check
    • cargo check of the separate workspaces
  • leaf-tui's the_bar_hands_the_host_s_own_chords_back_to_the_host fails, because it needs a system clipboard. It fails the same way on unmodified main.
  • Not run here: the dioxus job (no GTK libraries in this environment) and wasm32. The dioxus app needed no code changes.

Left as is

  • Android minSdk stays at 29. Only the Zig library required that, so it could probably go lower, but a lower value should be tried on a device first.

Generated by Claude Code

twig 6 is pure Rust, and its core names no language: `twig::Format` is
an opaque handle a language crate (twig-markdown, twig-djot, twig-html,
twig-asciidoc, twig-xml) hands back when it registers itself, and the
Markdown extensions are named features laid over a row as a flag mask.

- `leaf_core::Format` is leaf's own enum, with the five variants leaf
  opens under the names they always had (`Markdown`, `Djot`, `Html`,
  `Asciidoc`, `Xml`), still `#[non_exhaustive]`. It was a re-export of
  twig 4's enum; `Format::twig()` (and `From<Format> for twig::Format`)
  is the handle twig is called with, and `supports`, `supports_with`
  (now a feature mask), `is_authorable` and `name` delegate to it.
- `parse_extensions` is the feature mask for a format: Markdown's five
  features, nothing for the languages that declare none.
- `leaf_math_edit::doc::editor` takes twig's handle as before and asks
  for the `math` feature where the format has one.
- twig-doc is taken without its default `fig` feature: `twig::meta`
  (frontmatter through fig, and a document's `twig:` key obeyed) is
  nothing leaf asks for, and off it brings no YAML/TOML/JSON/figl
  parser. So a document is still parsed exactly as leaf asks.
- With no Zig left, CI, the release workflow and the Xcode Cloud
  post-clone hook stop installing it, the
  flake drops the zig/cctools build steps for diaryx-nix's `rust` shell
  (and lets cargoLock fetch the lockfile's git entries by rev, which it
  already needed for fig-css), and comments about twig-sys are updated.
  Android keeps minSdk 29, which only the Zig library required.
- The gpui, Dioxus and spike workspaces' lockfiles move to twig 6 too
  (the gpui ones had not yet picked up fig-css either).

Behavioural-change: `leaf_core::Format` is no longer `twig::Format`.
  Code that names its variants is unchanged; code that hands it to twig
  calls `.twig()` (or `.into()`), and `Format::supports_with` takes a
  feature mask where it took `twig::MarkdownExtensions`. twig 4's other
  rows and methods (`Commonmark`, `Gfm`, extension lookup) are not on it.
@adammharris
adammharris merged commit 712f12e into main Oct 16, 2026
6 checks passed
@adammharris
adammharris deleted the cc/modest-mendel-tw57ql branch October 16, 2026 00:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant