lsstdarkmatter / dark-matter-graph

Create dark matter graphics
https://lsstdarkmatter.github.io/dark-matter-graph/
MIT License
5 stars 2 forks source link

HTML formating in descriptions #44

Open kadrlica opened 6 years ago

kadrlica commented 6 years ago

@yymao is there any way to render html text in the description text? For example, I was trying to bold something by adding the <b> tag, but this didn't seem to render.

yymao commented 6 years ago

It was disabled intentionally, since I think the less than < and greater than > signs may appear quite often in the descriptions.

We can enable html, but then we need to type &lt; and &gt; for less and greater than signs.

yymao commented 6 years ago

Right now I see only one use of greater than in: https://github.com/lsstdarkmatter/dark-matter-graph/blob/a7346e5/data/data.yaml#L253

kadrlica commented 6 years ago

Definitely a good point. My first intuition is to go with the raw html; but I'll need to think about this...

yymao commented 6 years ago

Another choice is to use Markdown in the description field in the YAML file, which is certainly much easier for human to write...

yymao commented 6 years ago

In fact, how complicated do we think the description would eventually be? As the descriptions start to grow, maybe they are no longer suitable to be placed inside the yaml file.

A possibility is to have html files for each of the description. We can use the keys as the filenames and put them all under a subdirectory. The web app would then load corresponding description, similar to how it loads instructions currently.

kadrlica commented 6 years ago

I think that we will always want a brief description that can be displayed on the sidebar. I think that we may also want a more extensive summary (paragraphs of text and figures), but I think this augments rather than replaces the sidebar level quick description.

yymao commented 6 years ago

Sure. Then the question comes back to that to what extent we need to support rich formatting in the sidebar, given that they are just brief descriptions.

In this case, keeping brief descriptions pure text does not sound insane. People can still use markdown-like syntax in pure text to do emphasis.

If we do render the descriptions from markdown to HTML, then there's the question of which flavor of Markdown to use. For example, GFM is not particular science-friendly when one wants to say dark matter mass of m_DM~10 GeV to m_DM~100 GeV.