When server side rendering Html I am trying to figure out why markdown 
processing is not working right. It fails to wrap a line of text in a 
<p>aragraph. So I tried this program:

import Html exposing (text)
import Markdown

main =
 let 
   d = Debug.log "test" (Markdown.toHtml [] "test")
   d1 = Debug.log "test2" (Html.p [] [ Html.text "test" ])
 in
  Markdown.toHtml [] "test"

I was surprised that Markdown.toHtml does not produce an Html node as I was 
expecting, but something with type = "custom" instead. Here is the console 
output:

test2: { type = "node", tag = "p", facts = {}, children = { 0 = { type = 
"text", text = "test" } }, namespace = <internal structure>, 
descendantsCount = 1 }

test: { type = "custom", facts = {}, model = { options = { githubFlavored = 
Just { tables = False, breaks = False }, defaultHighlighting = Nothing, 
sanitize = False, smartypants = False }, markdown = "test" }, impl = { 
render = <function:render>, diff = <function:diff> } }

I guess this invokes the https://github.com/chjj/marked javascript markdown 
processor somehow from the details in the "custom" Html model. Does that 
mean that marked needs to be included as a javascript library on the page - 
or does Native elm code somehow pull it in?

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to