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
[DOCS] Sphinx 4.x.y compatibility fixes #11420
Conversation
# Sphinx 2.1.0 is the oldest version that accepts a lexer class in add_lexer() | ||
sphinx>=2.1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this because b_docs
job is failing. Apparently there is an ancient version of Sphinx (v1.8.5) already installed in the image.
5eff7b5
to
1ee64f4
Compare
This needs more work. Looks like |
Lexer problem reported in |
Looks good, but I think the test extractor needs to be updated. |
…r shell and text snippets
…pygments-lexer-solidity
1ee64f4
to
98c4830
Compare
Extractor fixed in #11565. This PR is now based on it. I'll mark it as reviewable once the dependency is merged. |
Depends on #11565.
Sphinx 4.0.0 has been released recently and deprecated some of the older features. Now
scripts/docs.sh
fails for me locally on that version. This PR adds some minor tweaks to make our docs work with both Sphinx 3 and Sphinx 4:add_stylesheet()
has long been deprecated.add_css_file()
is the replacement (AttributeError: 'Sphinx' object has no attribute 'add_stylesheet' sphinx-doc/sphinx#7747). This has exposed a bug in our lexer. See details below.add_lexer()
used to accept both a class and an instance. Starting with Sphinx 4 it only accepts a lexer class.robots.txt
to.gitignore
. This is unrelated to Sphinx update and should have been done in script to automate updates to robots.txt (v2) #11317.Bug in
pygments-lexer-solidity
add_lexer()
has a weird quirk:WARNING: Could not lex literal_block as "Solidity". Highlighting skipped.
) and highlighting is completely disabled for the buggy code snippet.This has exposed a bug in pygments-lexer-solidity. The lexer apparently has problems handling
assembly
blocks that are followed by other Solidity instructions (but extra instructions before them are fine). Note for example the red outline in one of the examples in our current docs:The error goes away only if I remove the
return
statement or theassembly
block. We have 3 snippets like this. The snippets look fine to me and do compile so it must be a bug in the lexer rather than in the snippet.I originally wanted to use theEDIT: Weird, it only works locally. I did need:force:
option of thecode-block
directive to suppress these errors until the lexer is fixed. But it turns out that switching from::
tocode-block
was enough to suppress them.:force:
to make it build in CI.