-
Notifications
You must be signed in to change notification settings - Fork 567
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
html dedent for markdown export #996
Comments
Would you mind posting images and/or an example notebook with the command used to make sure problem is clear for everyone? The code which performs the translation is here and the template it uses is here. The pandoc library is used for the actual template implementation, which flows through here. How these modules interact is unfortunately not super simple, but this is a starting point to explore. The template appears to naively print the text/html without any other processing, so likely an improvement to use a filter or function that improves this behavior would be welcome. |
Seems like a reasonable request. Thanks for gathering the info and adding images. I haven't read through the code-paths involved in a while but your reasoning on where to implement sounds right. |
I noticed you tagged this with "enhancement" but it's really a bug. The Markdown generated isn't equivalent to the HTML generated, which it should be. The preserved indentation causes some HTML to be displayed as verbatim text rather than HTML to be processed and added to the DOM. This is particularly annoying if you use plotly because plotly inserts indented code into the HTML cells, and then your plotly javascript initialization call gets inserted as verbatim and never gets called. So that none of your plots show up properly. |
nbconvert doesn't dedent 'text/html' outputs, which leads to errors down the line (specifically when converting notebooks that use plotly to Markdown).
To exemplify this issue, convert any notebook that uses plotly to markdown and you'll see the plotly js code (that came from a text/html output cell output -- but was indented) is displayed as verbatim rather than executed.
Given that HTML is dedent invariant (that was awkward to write) it seems like the reader should dedent by default?
I started digging into the code, but wasn't sure where would be the best place to add this. Is this something you all would be into? I can write a pull request, I just need to know where would be a sane place for it?
The text was updated successfully, but these errors were encountered: