Skip to content
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

Add an option to throw a warning when Pygments throws an ErrorToken #1565

Closed
shimizukawa opened this issue Jan 3, 2015 · 7 comments
Closed
Labels
help wanted type:enhancement enhance or introduce a new feature
Milestone

Comments

@shimizukawa
Copy link
Member

Currently, the behavior of Sphinx is to highlight the code-block as none in case the configured lexer throws an ErrorToken. It would be great if it could trigger a warning in this case as well (this could be subject to a configuration setting). It would allow spotting more easily code blocks which cannot be highlighted properly because of a mistake.
What do you think about it ?


@shimizukawa shimizukawa added type:enhancement enhance or introduce a new feature prio:low labels Jan 3, 2015
@shimizukawa shimizukawa added this to the 1.4 milestone Feb 17, 2015
@tk0miya
Copy link
Member

tk0miya commented Jan 18, 2016

I add warnings at 0329edc.
It always warns if could not parsed.

Thank you for reporting.

@stevepiercy
Copy link
Contributor

Just wanted to say thank you for this change, because it helped me catch a couple of mistakes in our docs.

@birkenfeld
Copy link
Member

Nice, thanks for the feedback!

@tk0miya
Copy link
Member

tk0miya commented Jan 24, 2016

😄

ypid added a commit to ypid/ansible-owncloud that referenced this issue Jan 24, 2016
…docs.

Playing around with Sphinx and Pygments the problem was the "hostname"
line which might be uncommon/illegal in normal ini files.

Since Sphinx 1.3.5 this becomes a warning and in the DebOps projects,
warnings are handled as errors :)
sphinx-doc/sphinx#1565

Disable ini highlighting for now.
ypid added a commit to ypid/ansible-owncloud that referenced this issue Jan 24, 2016
…docs.

Playing around with Sphinx and Pygments the problem was the "hostname"
line which might be uncommon/illegal in normal ini files.

Since Sphinx 1.3.5 this becomes a warning and in the DebOps projects,
warnings are handled as errors :)
sphinx-doc/sphinx#1565

Disable ini highlighting for now.
ypid added a commit to ypid/debops-playbooks that referenced this issue Jan 24, 2016
…docs.

Playing around with Sphinx and Pygments the problem was the "hostname"
line which might be uncommon/illegal in normal ini files.

Since Sphinx 1.3.5 this becomes a warning and in the DebOps projects,
warnings are handled as errors :)
sphinx-doc/sphinx#1565

Disable ini highlighting for now.
ben-albrecht added a commit to chapel-lang/chapel that referenced this issue Feb 21, 2016
Update Compiling.rst

In response to Brad's [comment](#3243 (comment)), I made some changes to `compiling.rst` and other bits of documentation.

To summarize:

* Put man page under the 'Compiling Chapel Programs' section
* Renamed it Chapel Man Page 
     * Can't get inline code formatting in the sidebar, and the lower case 'chpl man page' among all other capitalized titles looks off.
* Cross linked the man page from `compiling.rst`
* (Bonus point) Fixed the table formatting in `compiling.rst`

In the process of making these changes, I noticed that our Sphinx project is broken with that latest version of Sphinx (1.3.5), due to a [change that throws a warning when Pygments throws an ErrorToken](sphinx-doc/sphinx#1565). 

There were a handful of code blocks throughout the documentation that raised this error, so I corrected them to be valid Chapel code, or in some cases, made them `.. code-block:: text` when they weren't Chapel code to begin with.

[Reviewed by @ronawho @benharsh and @bradcray ]
@saulshanabrook
Copy link

Currently pygments cannot parse TypeScript with JSX syntax in it. How can I set the warn flag to true to have this not error on my build?

@tk0miya
Copy link
Member

tk0miya commented Jun 18, 2019

@saulshanabrook I just added :force: option to code directives in Sphinx-2.1.0. I believe it helps your case.
https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-code-block

@saulshanabrook
Copy link

@tk0miya Thank you! That works wonderfully.

saulshanabrook added a commit to saulshanabrook/jupyterlab that referenced this issue Jun 18, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted type:enhancement enhance or introduce a new feature
Projects
None yet
Development

No branches or pull requests

5 participants