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
Syntax highlighting does not work with fenced (~~~) code blocks #537
Comments
We have a lot of code in ```bash blocks that stopped working as of 2.2.2. Same issue or new issue? |
Same issue. pygments.rb was upgraded which handles syntax highlighting. I will look into why it's not working as expected. The existing code highlighting unit tests all pass so test coverage has to improve. |
@sol Gollum has never supported the |
@sol Is the |
@bootstraponline I don't think so. But you can look at e.g. Pandoc's Users Guide. What about just ignoring all but the first class name? I think that is what GFM does. The thing why I want more classes is that I want to extract code pieces to test/verify them. So I may have things like |
@sol Thanks for the link. I'll update the code to use just the first class name and ignore everything else. |
Gollum 2.2.4 has been released on RubyGems and includes this feature. Let me know if it works as expected. |
@bootstraponline It works already pretty well. Thanks for that! "Fences" of arbitrary length do not work yet. They are useful, if you want to write a code block that itself contains markdown, e.g.:
The relevant parts of Pandoc's User's Guide (emphasis added):
...
In addition, the live preview does not handle it correctly, yet. Both issues are not very critical for me. I think arbitrary length delimiters are a good idea. I don't care at all about the live preview. And thanks again for implementing it in the first place, it already solves my use case :) |
Thanks for pointing out the details for tilde fenced code blocks. I will look into implementing arbitrary length tilde fences for Gollum. I opened #546 about better support in live preview. I don't think that's worth fixing in live preview unless someone plans on using it because the ``` syntax always works correctly. @sol This doesn't work for you in live preview? It works for me. There are other examples which break though.
|
@bootstraponline Yes, this simple example works. I just realized that the actual parser is now more permissive than what is used for live preview. But I don't think it's a big issue. |
The parser is the same, both use sundown. The extraction code is a bit different now that |
Perhaps I should have reported it separately, but as of 2.2.9 ```bash blocks still don't work like they did with 2.2.1. |
More than 3 tildes can be used. The code block must end with the same amount of tildes used to open the code block. Fix gollum#537 http://johnmacfarlane.net/pandoc/README.html#delimited-code-blocks
If I use something like
I would like to get syntax highlighting for Haskell code.
My motivation to use this over
is that it is compatible with other software, and it allows me to add several classes to a single code block (e.g.
~~~ {.haskell .literate}
).BTW: GFM and GitHub's README renderer do the right thing here.
The text was updated successfully, but these errors were encountered: