-
-
Notifications
You must be signed in to change notification settings - Fork 910
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
Generating documentation no longer works #1336
Comments
Is this a system specific issue or an intermittent issue and happens sometimes? BTW, Rouge looks great and would be a good replacement. |
@KapilSachdev I don't know if it's a system specific issue, but it's definitely repeatable on my machine (Mac). Previously there was an issue with using Python 3 vs. Python 2 — I believe I cleared that up, so there was a long stretch where it did work for a while. But now within the past 6 months I'd say, I've started receiving this error. |
Then the alternative would be a better way to go. However, we can also create a docker image and try to use the image for release, but that would be an overkill and also we can't be sure if it wouldn't appear in the image. |
Oh nice — do you have it working where it's swapped out in the YARD config, or were you just testing it out on something else? |
Changed the yard setup diff --git a/doc_config/yard/setup.rb b/doc_config/yard/setup.rb
index eb654f5b..381b4269 100644
--- a/doc_config/yard/setup.rb
+++ b/doc_config/yard/setup.rb
@@ -1,6 +1,6 @@
YARD::Templates::Engine.register_template_path(File.dirname(__FILE__) + '/templates')
-require 'pygments.rb'
+require 'rouge'
module YARD
module Templates
@@ -13,8 +13,7 @@ module YARD
private
def highlight_with_pygments(language, source)
- html = Pygments.highlight(source, lexer: language.to_s)
- html.sub(%r{\A<div class="highlight">\s*<pre>}, '').sub(%r{</pre>\s*</div>\Z}, '')
+ Rouge::Formatters::HTML.new.format(Rouge::Lexers::Ruby.new.lex(source))
end
end
end As the only language being used was Can you clarify what the below substitution is doing? html.sub(%r{\A<div class="highlight">\s*<pre>}, '').sub(%r{</pre>\s*</div>\Z}, '') |
@KapilSachdev Very nice, that makes sense. IIRC, Pygments was adding some additional HTML that was making it more difficult to apply CSS to the code blocks, so I got rid of that. I'm not sure if Rouge does the same thing or not. |
Ah yup, there you go, that's what it was. I knew it was something CSS-related. |
We use Pygments along with YARD to highlight source code in documentation. Unfortunately this seems to have stopped working and upon running
yard doc
(which happens automatically when creating new releases) we are getting:This seems to have been a problem for a very long time and there is no known solution.
Perhaps instead of Pygments we should switch to Rouge instead?
The text was updated successfully, but these errors were encountered: