-
Notifications
You must be signed in to change notification settings - Fork 144
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
[Tech] Consider enabling html in markdown components #675
Comments
Very interesting topic! Enabling HTML is indeed a possible solution here but I would also like us to investigate an alternative solution(s) that go something like:
The advantages of this would be:
The disadvantages are:
In addition to the things you mention above, here's some things I thought before we might like to do in HTML/some extension of markdown:
A very rough dump of notes I made beforeSomething else I wondered about before and we might like to consider in future is whether we could extend markdown syntax to make it easier for people to do things that might be common in VizX but are not so easy to do in pure markdown. A bit like this way of specifying a form. Let’s wait and see what people try to do with the cards and then see if there’s common difficulties that we might be able to resolve. I can confirm that dcc.Markdown only supports commonmark and not Github flavoured markdown (GFM), and so our docstring is correct. Actually I wonder if at some point we should make our own custom Look at GFM (specification GitHub Flavored Markdown Spec) for allowing HTML also. See https://community.plotly.com/t/how-to-use-dcc-link-in-dcc-markdown-for-high-performance-links/66781 Could parse markdown using miyuchina/mistletoe: A fast, extensible and spec-compliant Markdown parser in pure Python. and then edit in Python rather than making custom markdown plugin. https://community.plotly.com/t/dash-mistletoe-a-customizable-markdown-parser/70456
Also very interestingL: https://pypi.org/project/dash-down/ The
|
I'll outline my thoughts here for us to discuss properly:
With the new header and footer arguments being enabled, we want to allow users to add more information to their charts. Currently, doing everything in pure Markdown feels cumbersome because many tasks are either impossible or not straightforward to implement. Here are some limitations where enabling HTML would be beneficial:
1. Customising fonts (e.g. apply coloring, apply different font-sizes, etc)
Markdown does not support text coloring: Markdown Font Color
However, I believe text coloring is an essential feature that HTML could easily solve. Here are some visual examples of why I'd like to be able to color fonts within Markdown. It's mainly to emphasize a narrative within the visualization or even replace a legend. Remember, AgGrid and DataTable do not come with an embedded color scale legend natively if you apply cell coloring. With AgGrid, there's a workaround by installing a third-party library, but I haven't explored a solution for DataTable yet. Enabling font colors in the footer could easily address this without requiring another library or a hacky solution. I also often see colors used in subtitles to emphasize certain data points.
:
While coloring is the most crucial argument for me, other considerations include applying custom font families, sizes, text alignments etc, which are either only possible via HTML or just simpler to do.
2. Apply CSS styling
This one is normally simpler to do in HTML as you can provide classNames or inline styles directly, which is simpler to do for CSS beginners. However, as soon as someone wants to style something with pure markdown - it is possible, but they have to know CSS selectors really well. They have to know the hierarchies and have to know how to selectively target elements in their hierarchy (p, h1, h2, img) if they do not want to apply it to all.
For me either of this works, but I am wondering how intuitive this actually is for CSS beginners and whether they even need more sophisticated styling. Or if we can assume that people who would like more sophisticated styling are automatically familiar with CSS?
3. Embedding interactive elements (e.g. buttons)
This actually seems fine in both markdown and HTML. For example, to create a button that proceeds to a link when clicked, use the following format:
[![Get it on SERVICE](https://gist.github.com/cxmeel/0dbc95191f239b631c3874f4ccf114e2/raw/SERVICE.svg)](https://example.com/...)
However, positioning it and styling it properly requires point 2) applying CSS via selectors.
The text was updated successfully, but these errors were encountered: