Dataframe HTML tags showing up in exported README
Related to https://github.com/fastai/nbdev/issues/474
Rendered readme on Github: https://github.com/rxavier/poniard/blob/experiment/nbdev/README.md index.ipynb: https://github.com/rxavier/poniard/blob/experiment/nbdev/nbs/index.ipynb
Basically, "raw output" dataframes (for example, when a method simply returns a dataframe, like get_results in this example) get this added before the actual table in markdown:
<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; }
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
Meanwhile, dataframes rendered with display(HTML(df.to_html())) (which shows after setup in this example) display fine.
Quarto HTML docs render any of these fine.
Edit: I implemented an ugly temporary fix by using directives and ipython's display:
#| output: false
obj.method_that_outputs_a_df()
#| echo: false
from ipython import display, HTML
df = obj.method_that_outputs_a_df()
display(HTML(df.to_html()))
Is this still an issue? I can't find the <style> tags in your current README.md
Yeah, it is. I implemented an ugly fix with directives and ipython display.
I'll fix the issue so the urls point to an earlier version where it can be seen.
Hey I have this same issue on the readme of this project which is generated from the notebook in nbs/index.ipynb. The issue is that when I print a dataframe, the HTML tags for the style do show up in the readme.
Did you have any success in fixing this? I can still see the tags in your readme @rxavier
Hi @Attol8. The tags you're seeing in my readme are not related to the issue I reported here. I fixed this specific issue with the workaround in my first post
@rxavier-ml understood thanks! Fixed the issue with your method, I believe it should be the default for nbdev readmes