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

Create markdown widget #2428

Closed
choldgraf opened this issue Jun 2, 2019 · 3 comments
Closed

Create markdown widget #2428

choldgraf opened this issue Jun 2, 2019 · 3 comments
Labels
feature request resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.

Comments

@choldgraf
Copy link

I would like to create a "Tab" widget where each tab contains markdown that I've generated. I saw that there is an HTML widget, but I didn't see something similar for a Markdown widget. Is this possible in ipywidgets?

E.g., I'd like to do something like:

tab_contents = ['# Heading 1\nMy awesome page', '# Heading 2\nMy awesome second page']
children = [widgets.<MarkdownWidgetIfItExists>(content=content) for content in tab_contents]
tab = widgets.Tab()
tab.children = children
for i in range(len(children)):
    tab.set_title(i, str(i))
tab
@SylvainCorlay
Copy link
Member

At the moment, there is not widget to render markdown.

However, the HTMLMath widget renders Mathjax equations

from ipywidgets import HTMLMath
HTMLMath(value='$\int f(s) ds$')

@SylvainCorlay SylvainCorlay changed the title Is it possible to display markdown inside of widgets? Create markdown widget Jun 2, 2019
@DanielAristidou
Copy link

something as simple as

import markdown 
from ipywidgets import HTML

html = markdown.markdown("""# Markdown""")
HTML(html) 

should work.

@choldgraf
Copy link
Author

I'm closing this because I think @DanielAristidou 's suggestion works nicely!

@lock lock bot added the resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label May 21, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature request resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

No branches or pull requests

3 participants