ci/treefmt: add markdown-code-runner
This was run as a test in `doc/tests/check-nix-code-blocks.nix` before, but its DX can be improved: By including it in `treefmt` we get better error reporting and auto-fixing, as well as running it on *all* markdown files (including READMEs etc.) for free.
This commit is contained in:
@@ -75,6 +75,23 @@ let
|
||||
includes = [ "*" ];
|
||||
priority = 1;
|
||||
};
|
||||
|
||||
# TODO: Upstream this into treefmt-nix eventually:
|
||||
# https://github.com/numtide/treefmt-nix/issues/387
|
||||
settings.formatter.markdown-code-runner = {
|
||||
command = pkgs.lib.getExe pkgs.markdown-code-runner;
|
||||
options =
|
||||
let
|
||||
config = pkgs.writers.writeTOML "markdown-code-runner-config" {
|
||||
presets.nixfmt = {
|
||||
language = "nix";
|
||||
command = [ (pkgs.lib.getExe pkgs.nixfmt) ];
|
||||
};
|
||||
};
|
||||
in
|
||||
[ "--config=${config}" ];
|
||||
includes = [ "*.md" ];
|
||||
};
|
||||
};
|
||||
fs = pkgs.lib.fileset;
|
||||
nixFilesSrc = fs.toSource {
|
||||
|
||||
Reference in New Issue
Block a user