pablohirafuji/elm-markdown/2.0.5

NOTE: the latest version is 2.0.6

Markdown.Config

Configure markdown to fit your needs.

Options

type alias Options =
{ softAsHardLineBreak : Bool
, rawHtml : HtmlOption
}

Some parser options so you can tweak things for your particular case.

  • softAsHardLineBreak: If set to True, will render \n as <br />.
  • rawHtml: This determine what to do with raw html elements.
= ParseUnsafe
| Sanitize SanitizeOptions
| DontParse

Choose what to do with raw html tags.

  • ParseUnsafe: Will parse any valid html tag and attribute. This includes malicious code like <script>alert("XSS ALERT!!");</script>.
  • Sanitize SanitizeOptions: Will parse only specific html elements and attributes.
  • DontParse: Do not parse any html tag. It will include the raw text in the output.
type alias SanitizeOptions =
{ allowedHtmlElements : List String
, allowedHtmlAttributes : List String
}

Choose what html elements and attributes are allowed to parse.

  • allowedHtmlElements: List of allowed html elements.
  • allowedHtmlAttributes: List of allowed attributes.
defaultOptions : Options

The Options used in Markdown.toHtml.

{ softAsHardLineBreak = False
, rawHtml = Sanitize defaultSanitizeOptions
}
defaultSanitizeOptions : SanitizeOptions

The SanitizeOptions used by defaultOptions.

{ allowedHtmlElements =
    [ "address", "article", "aside", "b", "blockquote", "br"
    , "caption", "center", "cite", "code", "col", "colgroup"
    , "dd", "details", "div", "dl", "dt", "figcaption", "figure"
    , "footer", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "i"
    , "legend", "li", "menu", "menuitem", "nav", "ol", "optgroup"
    , "option", "p", "pre", "section", "strike", "summary"
    , "small", "table", "tbody", "td", "tfoot", "th", "thead"
    , "tr", "ul" ]
, allowedHtmlAttributes =
    [ "name", "class" ]
}