nix-community.nixvim/docs/fix-links/default.nix
Matt Sturgeon 7f29e4b2ae
docs/fix-links: init
The README/CONTRIBUTING files are authored with GitHub in mind, but we
want to re-use them for the docs website.

Replace the existing simple substitution with a pandoc AST-based filter.
2025-02-13 18:05:54 +00:00

33 lines
675 B
Nix

{
lib,
runCommand,
pandoc,
githubUrl ? "https://github.com/nix-community/nixvim/blob/main/",
docsUrl ? "https://nix-community.github.io/nixvim/",
}:
src:
runCommand (src.name or (builtins.baseNameOf src))
{
inherit src;
bindings =
lib.generators.toLua
{
asBindings = true;
}
{
inherit githubUrl docsUrl;
};
filter = ./filter.lua;
nativeBuildInputs = [ pandoc ];
}
''
echo "$bindings" > filter.lua
cat $filter >> filter.lua
pandoc \
--output $out \
--from markdown \
--to markdown-raw_attribute \
--lua-filter filter.lua \
$src
''