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

Markdown example does not work with myst_parser>=0.18 #3

Closed
Alexboiboi opened this issue Sep 30, 2022 · 1 comment
Closed

Markdown example does not work with myst_parser>=0.18 #3

Alexboiboi opened this issue Sep 30, 2022 · 1 comment

Comments

@Alexboiboi
Copy link

The example from https://github.com/widgetti/reacton#markdown-component-example does not work with myst_parser>=0.18 since the to_html function has been removed from the python api (see https://github.com/executablebooks/MyST-Parser/blob/28725fceb8e1e117cb247b06a267f82c501ce527/CHANGELOG.md#breaking-changes)

One solution:

@reacton.component
def Markdown(md: str):
    from markdown_it.renderer import RendererHTML
    from myst_parser.config.main import MdParserConfig
    from myst_parser.parsers.mdit import create_md_parser
    md_parser = create_md_parser(MdParserConfig(), RendererHTML)
    html = md_parser.render(md)
    return w.HTML(value=html)

BR, Alex

@maartenbreddels
Copy link
Contributor

(FYI, sorry for the late reply, just noticed I didn't get GH notifications from the repo)

I just fixed this in af8b6e0 , and also included a Markdown example at:

Markdown example live with Jupyter lite
Markdown component and editor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants