On Wednesday, January 4, 2017 at 11:24:31 PM UTC, Noah Hall wrote:
>
> It does support custom and supports markdown as a special case - 
>
> https://github.com/eeue56/elm-server-side-renderer/blob/master/src/ServerSide/Markdown.elm
>
> However, it doesn't convert it to html on the server side. That should be 
> trivial to add - just a called to marked, but I haven't needed it yet.
>

To try it out I call a native markdown render in the 'nodeTypeToString' 
function:

        MarkdownNode record ->
            Native.Markdown.render record.model

Which calls this:

function render(model) {
        var html = marked(model.markdown, formatOptions(model.options));
        return html;
    }
 
But this differs from what gets rendered when running in the browser, as I 
took the document.createElement('div') part out:

https://github.com/evancz/elm-markdown/blob/3.0.1/src/Native/Markdown.js#L23

The Mardkown is supposed to render in a div, and that div gets a copy of 
any attributes set on the Markdown:

Markdown.toHtml [ {- These attributes here get set on the div -} ] makdown

How would you recommend handling this? 

Make the nodeTypeToString function more sophisticated so it includes the 
logic from nodeRecordToString to set the attributes on the resulting div? 

OR change decodeMarkdownNodeRecord, so that it returns a NodeType 
descirbing a div with the correct attributes set, that wraps the "custom" 
markdown NodeType as a child?

-- 
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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to