-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
DocBook reader: Preserve callouts and xrefs in code #7389
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
base: main
Are you sure you want to change the base?
Conversation
Ideally, the AST would support rich code blocks and the dumbing down would be handled in writers but until then let’s preserve the data. |
It might be also useful to control this behaviour with a config option (extension). |
f07969d
to
7031a92
Compare
When converting DocBook documents like https://github.com/NixOS/nixpkgs/blob/c06cb69ca0dc02b37e27104ac8415c3cab173328/nixos/modules/programs/plotinus.xml#L27, these need to be dealt with manually, or too much information will be lost. Ideally, the AST would support rich code blocks and the dumbing down would be handled in writers but until then, let’s preserve the elements verbatim.
7031a92
to
88f99ed
Compare
see: jgm/pandoc#7389 for full details. @jtojnar
Can you explain the motivation for this change, and what it does? |
In NixOS manual, we have code like
docbook-xsl renders it as services.xserver.desktopManager.gnome.enable = true; We are trying to switch our documentation from DocBook to CommonMark and using pandoc for the conversion. Currently, pandoc parses the code as
since We would like it to produce the following
The I will add a test but first I would like to know if this behaviour is reasonable or if it should be optional (off-by-default extension). |
I don't really like the idea of including a string in the code block that actually isn't verbatim code. |
In our use case, the anchors are located in different files (that are But I agree that mixing code with metadata without any way to distinguish them would be ugly. Alternative would be keeping this behind an extension flag Much nicer option would be modifying the AST to support rich code blocks – this is supported by other languages than DocBook (HTML, rST). But yeah, it would be a pretty big backwards compatibility break. (Or adding |
Or maybe an extension that would keep the elements that would cause information loss as But I could even do this short term and work on the AST changes long term if you think it is a good idea. |
A pragmatic solution would be to preprocess, resolving these references, before passing to pandoc. |
When converting DocBook documents like https://github.com/NixOS/nixpkgs/blob/c06cb69ca0dc02b37e27104ac8415c3cab173328/nixos/modules/programs/plotinus.xml#L27, these need to be dealt with manually.