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

Comments

Projects
None yet
4 participants
@miili

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

This comment has been minimized.

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

This comment has been minimized.

Collaborator

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

This comment has been minimized.

miili commented Feb 21, 2018

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

@annefou

This comment has been minimized.

Collaborator

annefou commented Feb 21, 2018

Thank you so much!

@miili

This comment has been minimized.

miili commented Feb 21, 2018

Anne, you are welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment