Parse error for >>> prompt in code examples
See original GitHub issueSphinx supports docs code examples with a prompt and output, as in the example from http://www.sphinx-doc.org/en/stable/markup/code.html
>>> 1 + 1
2
Such code blocks are present in most docs files in the projects I work on, and blacken-docs
gives a “code block parse error” for those and I think skips them completely, so doesn’t work for me (and I think many other people / projects) at the moment.
There must be some code in sphinx
to parse those out, and to syntax highlight the rest of the code, so it should be possible to import and use that part of sphinx and only process the code after stripping the >>>
out.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Parse error for >>> prompt in code examples · Issue #8 - GitHub
Another issue I found is that in the projects I work on (Python projects using Sphinx) many code examples start with :: instead...
Read more >parse error on input `.' in command prompt using haskell ghci ...
I'm very new to haskell and the entire installation process was confusing to me. I downloaded power shell and then installed chocolatey and ......
Read more >What is a parse error? - Quora
A parse error is an error in a computer program that occurs while the program is being read by the computer. This type...
Read more >Errors, Parse Errors, and Warnings
When an error occurs, the Log Parser command-line executable aborts the query execution and returns the error message and the error code.
Read more >Understanding Basic Haskell Error Messages - Jan Stolarek
present code snippets that generate errors, followed by explanations and solutions. ... Parse errors indicate that the program violates Haskell syntax.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m referring to the separate pygments lexer https://pygments.org/docs/lexers/#pygments.lexers.python.PythonConsoleLexer
Another issue I found is that in the projects I work on (Python projects using Sphinx) many code examples start with
::
instead ofcode-block:: python
, and Sphinx will automatically process those as code blocks.blacken-docs
doesn’t seem to recognise those code blocks, i.e. doesn’t even try to process most code blocks.So I guess now that I understand a bit better what blacken-docs does (use just regexes), my feature request here is more: please support Python sphinx docs better, by behaving more like Sphinx.