-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Markdown to Docbook pandoc conversion loses information about language in fenced code block #125511
Comments
Yeah, I am aware of this. Pandoc only supports languages that it has syntax highlighting for and Nix is not one of them. Also, unfortunately, KDE’s syntax highlighting lists nix as file extension for bash. I have opened jgm/pandoc#7241 ( diff --git a/doc/Makefile b/doc/Makefile
index 7affbb0bb51..fd1deaac711 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -92,6 +92,7 @@ functions/library/generated: doc-support/result
pandoc $^ -t docbook \
--extract-media=media \
--lua-filter=$(PANDOC_LUA_FILTERS_DIR)/diagram-generator.lua \
+ --syntax-definition=$(PANDOC_NIX_SYNTAX_DEFINITION) \
-f markdown+smart \
| cat > $@
@@ -100,5 +101,6 @@ functions/library/generated: doc-support/result
--top-level-division=chapter \
--extract-media=media \
--lua-filter=$(PANDOC_LUA_FILTERS_DIR)/diagram-generator.lua \
+ --syntax-definition=$(PANDOC_NIX_SYNTAX_DEFINITION) \
-f markdown+smart \
| cat > $@
diff --git a/doc/default.nix b/doc/default.nix
index 25389fa2da7..3916b383e88 100644
--- a/doc/default.nix
+++ b/doc/default.nix
@@ -19,6 +19,10 @@ in pkgs.stdenv.mkDerivation {
makeFlags = [
"PANDOC_LUA_FILTERS_DIR=${pkgs.pandoc-lua-filters}/share/pandoc/filters"
+ "PANDOC_NIX_SYNTAX_DEFINITION=${pkgs.fetchurl {
+ url = "https://gitlab.com/rycee/presentations/-/raw/da77a89576fe8eed2a8b4f73e29b31895d45c98f/2019-12-cph-nur/nix-syntax.xml";
+ sha256 = "4ITrkuxNI0jmTsBToMt7OKoRiZQevGlDMPZgjiJtvEw=";
+ }}"
];
postPatch = '' Though I remember there were other issues. |
Another method would be sending https://gitlab.com/rycee/presentations/-/raw/da77a89576fe8eed2a8b4f73e29b31895d45c98f/2019-12-cph-nur/nix-syntax.xml upstream to KDE. And maybe removing nix from the list of file extensions for bash: |
Update the pinned channel in `md-to-db`, which bumps the Pandoc version, which fixes NixOS#125511 maybe.
We are using Pandoc to convert our Markdown documentation to Docbook, and the fenced code blocks all get converted to have the language as bash like:
I haven't looked into it yet, but it seems like a bug with Pandoc or with how we are configuring it.
cc @andir @jtojnar
The text was updated successfully, but these errors were encountered: