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

Comments

@miili
Copy link

@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
Copy link
Contributor

@rgaiacs 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
Contributor

@annefou 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 miili commented Feb 21, 2018

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

@annefou
Copy link
Contributor

@annefou annefou commented Feb 21, 2018

Thank you so much!

@miili
Copy link
Author

@miili miili commented Feb 21, 2018

Anne, you are welcome.

fmichonneau added a commit to fmichonneau/python-novice-inflammation that referenced this issue Oct 13, 2020
maxim-belkin added a commit that referenced this issue Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants