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
Arbitrary code block doesn't receive syntax highlighting #815
Comments
Seems like it might be an issue with the RDoc or markdown libraries you are using (not sure if you are using rdoc or markdown here). I can't directly see the generated markup but my guess is (based on the different styling) it's missing a container that is helping YARD detect it as a source block. Either that or YARD is trying to parse this as Ruby and the internal Ruby parser is failing. Basically YARD itself is deferring this decision to either your markup formatter or Ruby's syntax parser (ripper), so if either of those fail, YARD falls back to "not Ruby code" and doesn't highlight. Not sure which one of these is failing. |
To clarify, the file in question is called README.rdoc and everything should be parsed as RDoc by YARD |
Just adding a "This happened to me" notice. I'm using markdown as the markup, and I had an example snippet of code the was not color lexing. But there was a clue in the way it was output. ... The beginning of several lines within the {...} block (and at the end for the closing curly,) were not lined up correctly. Sure enough, checking the code,..there were tabs at the line beginnings instead of spaces. I now realized that you cannot just cut & paste code snippets from webpages without "cleaning" them. |
@Hubro - did you figure out a solution for this? I see something similar:
The resulting HTML: https://gist.github.com/thomthom/bb182ae6b3b3c01ae7fd |
@thomthom Sorry no, I think I just gave up and moved on assuming it would probably be fixed in the future. |
@thomthom I can't reproduce that behavior on 0.8.7.6 or master. What markup format and provider are you using? Seems to work with rdoc v4.2.0 as the RDoc markup provider, i.e., with no flags passed to |
I'm running YARD from master, using simply |
Mind you, I just ran |
Sure enough - that was it. I guess I was under the presumption that installing YARD (or any gem) would cause the needed dependencies to update. |
@thomthom YARD doesn't take any dependencies on markup libraries because RubyGems has no concept of "optional dependencies". YARD only needs That said, even if we listed rdoc as a dependency, YARD is technically compatible with rdoc all the way back to 2.x, so that's the dependency we would have listed ( |
Marking this as closed since the issue is due to a regression in rdoc. |
A snippet of my rdoc:
It renders like this:
If I remove the loop, it renders correctly:
Is this a bug, or am I doing something wrong?
The text was updated successfully, but these errors were encountered: