refactor(presets): simplify mermaid error parser (#49)

* feat: add `mermaid` preset

Problem: no built-in support for compiling mermaid diagrams via `mmdc`.

Solution: add a `mermaid` preset that compiles `.mmd` files to SVG and
parses `Parse error on line N` diagnostics from stderr. Add
`mermaid-cli` to the nix dev shell.

* refactor(presets): simplify `mermaid` error parser

Problem: the inline `mermaid` error_parser looped over every line and
used the `Parse error on line N:` header as the message, losing the
useful `Expecting ..., got ...` token detail.

Solution: extract `parse_mermaid` alongside the other parse functions,
use a single `output:match` (mermaid's JISON parser stops at the first
error), and surface the `Expecting ..., got ...` line as the message.

* ci: format

* ci: format
This commit is contained in:
Barrett Ruth 2026-03-05 12:05:34 -05:00 committed by GitHub
parent 8c9847e321
commit 00caad18bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 15 deletions

View file

@ -19,7 +19,8 @@
{
formatter = forEachSystem (pkgs: pkgs.nixfmt-tree);
devShells = forEachSystem (pkgs:
devShells = forEachSystem (
pkgs:
let
devTools = [
(pkgs.luajit.withPackages (
@ -50,6 +51,7 @@
pkgs.mermaid-cli
];
};
});
}
);
};
}