mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-20 16:15:43 +02:00
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\]`.
33 lines
651 B
Nix
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
|
|
''
|