Question

I was curious to know whether or not there is something analogous to Text.color/typeface/height for the inbuilt Markdown in Elm.

Searching through the documentation the results come back positive for 'markdown' with an entry under Text. However, on the actual Text page there is nothing markdown related.

Was it helpful?

Solution

That depends a bit on what you are after.
If you're looking for a way to set the general style of a markdown block, the answer is no.
If you're looking for a way to set the style of small things like single words inside a markdown block, then the answer is soon.

Let me clarify what I mean by those answers:

Styling a markdown block in Elm

Sadly this is impossible in pure Elm. In one of the discussion on the mailing-list, Evan (the creator of Elm) mentions using bits of CSS for elm-lang.org. I quickly checked the source on github but couldn't find an example for you (sorry). Anyway, it's not recommended to rely on CSS but it's the only way at the moment. So you can use <style> tags in your markdown to do something like style the markdown block. Do be wary of leaking the style into other parts of the webpage though.

Styling individual things in a markdown block in Elm

In the upcoming release of Elm there will be a feature called markdown interpolation. Using this you can use the normal Text.color etc. on individual pieces of text and insert them into a markdown block. (The feature really goes beyond that by also allowing signals of elements to be put in there, but that's not really important for your question).
This feature has already been developed and is currently available if you are ok with compiling the Elm compiler from source. Otherwise, you'll have to wait for the next release of the compiler.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top