fastai / fastdoc

Create publication-quality books from Jupyter notebooks
https://fastai.github.io/fastdoc/
Apache License 2.0
231 stars 30 forks source link

Debug Errors Not Converting Correctly #27

Open ghost opened 2 years ago

ghost commented 2 years ago

We've run into an issue where we're trying to include debug info, e.g.,

---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)
<ipython-input-2-b2e110f6fc8f> in <module>()
----> 1 func2(1)

<ipython-input-1-d849e34d61fb> in func2(x)
      5     a = x
      6     b = x - 1
----> 7     return func1(a, b)

<ipython-input-1-d849e34d61fb> in func1(a, b)
      1 def func1(a, b):
----> 2     return a / b
      3 
      4 def func2(x):
      5     a = x

ZeroDivisionError: division by zero

in a book, but the command characters in the backend (e.g., \u001b[0m\n\u001b[0;31mZeroDivisionError...) are breaking the asciidoc conversion (and also throwing build errors, since the command characters are appearing in the adoc).

I'm basically looking for a "clean" step when converting code blocks -- any (preferably easy) way to do this?