-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
Add highlighting support for specific markdown code chunks using fenced_code_attributes
syntax
#143
Comments
I'd be open to including a patched version of markdown.xml in skylighting. |
Inline code in markdown can start/end with any number of backticks. |
So I had a quick look at how we could improve support for inline code on several line. It is not straightforward and not guaranteed with success as I am no KDE syntax file expert. This PR is really about detecting other code block with class attributes inside markdown code block. Can we consider a PR only for this above and maybe open an issue for the other idea if you really want this Pandoc syntax to be supported ? |
Maybe it's a separate issue, if the current highlighting doesn't support this either. |
I initially submitted here because I though this markdown syntax with fenced code class and attributes was Pandoc specific. If you think this could be submitted in upstream KDE syntax-highlighting, then I am happy to open a PR there. Is this syntax possible in markdown that KDE would be interested ? |
I see. Yes, it may be pandoc-specific. PHP Markdown Extra supports something similar, but only with |
That is my thoughts and why I did not PR into KDE - not sure how to justify to them this addition and especially not sure how it could impact there tools. I am only testing with Pandoc when doing such changes (mainly because I don't have the full KDE build tools and was not successful in installing such environment). Do you want me to try anyway and post the link here so that you can comment there too ? |
I think it's worth a try. After all, pandoc is a commonly used program, and some other processors may also accept this way of specifying a syntax. (I see that Maruku does, for example.) A number of others will parse this as a code block but not recognize the syntax properly, but I don't think anyone is likely to use
for any OTHER purpose. |
Ok thanks. I'll try a PR there then, and report back. |
Let me show example of the use case behing this:
If you were to include in a document a verbatim code chunks to show how to include a fenced code block with attributes and class, you would write something like this in a
.md
documentCurently we would convert to HTML using
to get
The code chunk with Markdown syntax using
```{}
is not highlighted as the other one.For Quarto (https://quarto.org/), we have made some adjustments into
markdown.xml
to support this syntax. So we can pass the new syntax definition file to Pandocwhich will give us this
where bot code chunks are treated the same.
For now, we bundle this file into Quarto to be passed to Pandoc during conversion as this is important for us because we leverage the code block syntax with attributes from Pandoc, and we have a special syntax for code chunk engine that use the same
```{}
syntax;I am opening the suggestion to add such adjustements to the markdown syntax highlight file in this repo directly and not in KDE because I believe it is quite Pandoc's Markdown specific on the syntax and KDE repo would not be the place, and because I also noticed that you aare lready patching the
markdown.xml
file using https://github.com/jgm/skylighting/blob/master/skylighting-core/xml/markdown.xml.patchDo you think this could be a good place to add such patch ? Are you interesting in this highlighting support ?
Or that it would be better into KDE repo directly even if this is quite specific (unless it is not maybe ?) ?
Otherwise, we could keep it bundle in our tool but this would leave us with a fork of the
markdown.xml
and we thought it could be of interest to be accessible more generally.Thanks for reading.
The text was updated successfully, but these errors were encountered: