question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parse error for >>> prompt in code examples

See original GitHub issue

Sphinx 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:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
asottilecommented, Apr 14, 2020
1reaction
cdeilcommented, Sep 6, 2018

Another issue I found is that in the projects I work on (Python projects using Sphinx) many code examples start with :: instead of code-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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found