nix-community.nixvim/docs/fix-links/default.nix
Matt Sturgeon 977b7a9fa3
docs/fix-links: pandoc markdown -> gfm
We are essentially writing GFM e.g. inline HTML comments and GFM alerts.
So tell pandoc to parse/render as such. This resolves issues such as:
`> [!TIP]` being escaped to `> \[!TIP\]`.
2025-02-24 21:14:16 +00:00

33 lines
651 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 gfm \
--to gfm \
--lua-filter filter.lua \
$src
''