-
Notifications
You must be signed in to change notification settings - Fork 505
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
details markdown not rendering properly in voila like it does in jupyter lab #640
Comments
Hi @afonit did you ever find a workaround for this? I am running into the same thing (using the |
@jakemiller649 , no solution/workaround yet, that I have seen. |
Hopefully this will be fixed by #846 |
@afonit which version of JupyterLab is / was it? With the latest |
@jtpio , thanks for pointing out that does not work within 3.x. When I posted the issue it was in 2.x. I will open a ticket in the jupyterlab github tracker as that would be a regression. I just upgraded to 3.x from 2.x to test, and I also show it not rendering: |
ok thanks for checking 👍 And feel free to open a new issue in https://github.com/jupyterlab/jupyterlab if you think this is indeed a regression. |
just posted it: jupyterlab/jupyterlab#10171 |
In case anyone else in the future stumbles onto this issue (before it's solved, of course), my hacky workaround is:
from IPython.core.display import HTML
class HideText:
_he = 0 # each instance of this will need its own unique DIV name, otherwise it doesn't work
def __init__(self, text_to_hide, button_text="Details"):
self.formatted_html = (
"""
<p>👉 <a onclick="ShowOrHide_%d()">%s</a></p>
<div id="myDIV_%d" STYLE="display:none">
%s
</div>
<script>
function ShowOrHide_%d(){
var x = document.getElementById("myDIV_%d");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}
</script>
""" % (HideText._he, button_text, HideText._he, text_to_hide, HideText._he, HideText._he)
)
HideText._he += 1
def show(self):
return HTML(self.formatted_html) Then use a code block each time you need to hide something, e.g.: text_to_hide = """<p>It tolls for:</p>
<ul>
<li>thee</li>
<li>that other guy</li>
<li>thy momma and thy daddy</li>
</ul>
"""
HideText(
text_to_hide=text_to_hide,
button_text="And therefore never send to know for whom the bell tolls"
).show() |
A much simpler workaround (as for the JupyterLab bug): just remove the indentation and add some new lines:
|
This is now fixed upstream in marked (markedjs/marked#2052); you might want to bump marked to 2.0.4. |
If I use this markdown in jupyterlab:
I get this:
And when expanded I get this:
But when I render this with voila, I get the below:
The text was updated successfully, but these errors were encountered: