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

Correct Syntax highlighting for Tracebacks #472

Open
miili opened this issue Feb 20, 2018 · 5 comments
Open

Correct Syntax highlighting for Tracebacks #472

miili opened this issue Feb 20, 2018 · 5 comments
Assignees
Labels
status:in progress Contributor working on issue

Comments

@miili
Copy link

miili commented Feb 20, 2018

Would be nice to have correct syntax highlighting on the SWC material.
Pygments supports these as pytb.

http://pygments.org/docs/lexers/#pygments.lexers.python.PythonTracebackLexer

@rgaiacs
Copy link
Contributor

rgaiacs commented Feb 20, 2018

We are using https://kramdown.gettalong.org/syntax_highlighter/rouge.html. I think that, for example, https://github.com/swcarpentry/python-novice-inflammation/blob/gh-pages/_episodes/07-errors.md if you change

~~~
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-1-70bd89baa4df> in <module>()
      6     print(ice_creams[3])
      7
----> 8 favorite_ice_cream()

<ipython-input-1-70bd89baa4df> in favorite_ice_cream()
      4         "vanilla",                                                                    "strawberry"
      5     ]
----> 6     print(ice_creams[3])
      7
      8 favorite_ice_cream()

IndexError: list index out of range
~~~
{: .error}

to

~~~
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-1-70bd89baa4df> in <module>()
      6     print(ice_creams[3])
      7
----> 8 favorite_ice_cream()

<ipython-input-1-70bd89baa4df> in favorite_ice_cream()
      4         "vanilla",                                                                    "strawberry"
      5     ]
----> 6     print(ice_creams[3])
      7
      8 favorite_ice_cream()

IndexError: list index out of range
~~~
{: .error .language-python}

you might get the desired output.

@annefou
Copy link

annefou commented Feb 21, 2018

Yes I just tried it and indeed we would have syntax highlighting for errors and outputs by replacing:
{: .error}
by
{: .error .language-python}

and
{: .output}
by
{: .output .language-python}

That would be a great contribution to the lesson. Would you do that @miili ?

@miili
Copy link
Author

miili commented Feb 21, 2018

Can do, for at least the Error lesson! Take me as assigned.

@annefou
Copy link

annefou commented Feb 21, 2018

Thank you so much!

@miili
Copy link
Author

miili commented Feb 21, 2018

Anne, you are welcome.

@fmichonneau fmichonneau added status:in progress Contributor working on issue and removed work-in-progress labels Jun 8, 2018
fmichonneau pushed a commit to fmichonneau/python-novice-inflammation that referenced this issue Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:in progress Contributor working on issue
Projects
None yet
Development

No branches or pull requests

4 participants