I have an elm-spa based application which has two pages.
One page uses elm-css
with Html.Styled
- I’ve successful edited my app to use elm-css
- it’s when I tried filling one page with markdown text that I hit this problem.
One page has markdown content. I’ve used pablohirafuji/elm-markdown
to parse the data to Html
(with Markdown.toHtml
).
Have I gone down the wrong route?
I think elm-spa
would really like one Html
to be used by all pages. I would too
In UI.elm
I think the line Html.main_ [] children
is where one type is required.
So the specific question: how to use pablohirafuji/elm-markdown
with elm-spa/elm-css
?
Or, a more general question: how to use get markdown parsed and used within an `elm-spa/elm-css’ application?
module UI exposing (h1, layout)
import Gen.Route as Route exposing (Route)
import Html.Styled as Html exposing (Html)
import Html.Styled.Attributes as Attributes
layout : List (Html msg) -> List (Html msg)
layout children =
let
viewLink : String -> Route -> Html msg
viewLink label route =
Html.a [ Attributes.href (Route.toHref route) ] [ Html.text label ]
in
[ Html.div [ Attributes.class "container" ]
[ Html.header [ Attributes.class "navbar" ]
[ viewLink "Home" Route.Home_
, viewLink "Notes" Route.Notes
]
]
, Html.main_ [] children
]