superset icon indicating copy to clipboard operation
superset copied to clipboard

Elements of markdown not supported by Text layout Element

Open xavier-GitHub76 opened this issue 1 year ago • 2 comments

Hello,

with Superset 3.1.1 (and previous), the layout element "Text" does not support markdown syntax for: • syntax highlighting of code blocks • the borders of a table

Screenshot

image

Markdown

The markdown source is joined source.md

Regards

xavier-GitHub76 avatar Apr 29 '24 06:04 xavier-GitHub76

I think we use the python markdown lib, on the main branch that's currently markdown==3.6. We would support what they support, and while our requirements/base.txt pins the lib at a specific version, you're free to upgrade to another version ahead of the pinned one. Our pyproject.toml says "markdown>=3.0", meaning you can pip upgrade markdown in your local builds

mistercrunch avatar Apr 30 '24 01:04 mistercrunch

Much of this can be styled as well, so you can (re)add the borders on tables and things like that with dashboard css templates. There are a few examples here.

rusackas avatar Apr 30 '24 04:04 rusackas

See their changelog here -> https://python-markdown.github.io/changelog/ . If there are features you'd like to see in Superset around markdown support, it has to go through that library.

mistercrunch avatar Apr 30 '24 15:04 mistercrunch

Thanks for yours responses.

I test a markdown file with the library :

import markdown

with open("my_markdown.md", "r", encoding="utf-8") as input_file:
    text = input_file.read()
html = markdown.markdown(text, extensions=['tables', 'fenced_code'])

with open("my_markdown_output.html", "w", encoding="utf-8", errors="xmlcharrefreplace") as output_file:
    output_file.write(html)

The rendering is identical to that of Superset. For visual customization, I'll look at the CSS. Thanks again

xavier-GitHub76 avatar May 06 '24 10:05 xavier-GitHub76

image

xavier-GitHub76 avatar May 06 '24 10:05 xavier-GitHub76