[{"name":"HtmlData.Extra","comment":"\n\n\n## Functions to\n\nto convert `HtmlData.Html` values into `String`\n\n@docs toTextHtml, toTextPlain, toElmHtml\n\n\n## Functions from\n\n@docs fromHtmlParserNodes\n\n\n## Configs\n\ndefault configurations on how content is sanitized for toTextHtml, and how layout is done for toTextPlain\n\n@docs SanitizeConfig, defaultSanitizeConfig, TextPlainConfig, defaultTextPlainConfig\n\n@docs escapeHtml, sanitize\n\n\n## More ~tests~ examples\n\n    import HtmlData exposing (..)\n    import HtmlData.Attributes exposing (..)\n\n    div []\n        [ h1 [] [ text \"Block-level elements\" ]\n        , p []\n            [ text \"In this article, we'll examine HTML block-level elements and how they differ from \"\n            , a [ href \"https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements\" ] [ text \"inline-level elements\" ]\n            , text \".\"\n            ]\n        , p []\n            [ text \"HTML (\"\n            , b [] [ text \"Hypertext Markup Language\" ]\n            , text \") elements ... by CSS in the \"\n            , a [ href \"https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flow_Layout\" ] [ text \"Flow Layout\" ]\n            , text \". A Block-level element occupies ... contents, thereby creating a \\\"block\\\".\"\n            , aside []\n                [ strong [] [ text \"Note:\" ]\n                , text \" A block-level element always starts on a new line and ... as it can).\"\n                ]\n            , h3 [] [ text \"See also\" ]\n            , ol []\n                [ li [] [ a [ href \"\" ] [ text \"Inline elements\" ] ]\n                , li [] [ a [ href \"\" ] [ text \"display\" ] ]\n                , li [] [ a [ href \"\" ] [ text \"Block and Inline Layout in Normal Flow\" ] ]\n                ]\n            ]\n        ]\n        |> toTextHtml\n    --> \"<div><h1>Block-level&#32;elements</h1><p>In&#32;this&#32;article,&#32;we&#39;ll&#32;examine&#32;HTML&#32;block-level&#32;elements&#32;and&#32;how&#32;they&#32;differ&#32;from&#32;<a href=\\\"https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements\\\">inline-level&#32;elements</a>.</p><p>HTML&#32;&#40;<b>Hypertext&#32;Markup&#32;Language</b>&#41;&#32;elements&#32;...&#32;by&#32;CSS&#32;in&#32;the&#32;<a href=\\\"https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flow_Layout\\\">Flow&#32;Layout</a>.&#32;A&#32;Block-level&#32;element&#32;occupies&#32;...&#32;contents,&#32;thereby&#32;creating&#32;a&#32;&quot;block&quot;.<aside><strong>Note:</strong>&#32;A&#32;block-level&#32;element&#32;always&#32;starts&#32;on&#32;a&#32;new&#32;line&#32;and&#32;...&#32;as&#32;it&#32;can&#41;.</aside><h3>See&#32;also</h3><ol><li><a href=\\\"\\\">Inline&#32;elements</a></li><li><a href=\\\"\\\">display</a></li><li><a href=\\\"\\\">Block&#32;and&#32;Inline&#32;Layout&#32;in&#32;Normal&#32;Flow</a></li></ol></p></div>\"\n\n\n    -- https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dd\n    div []\n        [ p []\n            [ text \"Cryptids of Cornwall:\" ]\n        , dl []\n            [ dt []\n                [ text \"Beast of Bodmin\" ]\n            , dd []\n                [ text \"A large feline inhabiting Bodmin Moor.\" ]\n            , dt []\n                [ text \"Morgawr\" ]\n            , dd []\n                [ text \"A sea serpent.\" ]\n            , dt []\n                [ text \"Owlman\" ]\n            , dd []\n                [ text \"A giant owl-like creature.\" ]\n            ]\n        ]\n        |> toTextHtml\n    --> \"<div><p>Cryptids&#32;of&#32;Cornwall:</p><dl><dt>Beast&#32;of&#32;Bodmin</dt><dd>A&#32;large&#32;feline&#32;inhabiting&#32;Bodmin&#32;Moor.</dd><dt>Morgawr</dt><dd>A&#32;sea&#32;serpent.</dd><dt>Owlman</dt><dd>A&#32;giant&#32;owl-like&#32;creature.</dd></dl></div>\"\n\n\n\n    div []\n        [ h1 [] [ text \"Block-level elements\" ]\n        , p []\n            [ text \"In this article, we'll examine HTML block-level elements and how they differ from \"\n            , a [ href \"https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements\" ] [ text \"inline-level elements\" ]\n            , text \".\"\n            ]\n        , p []\n            [ text \"HTML (\"\n            , b [] [ text \"Hypertext Markup Language\" ]\n            , text \") elements ... by CSS in the \"\n            , a [ href \"https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flow_Layout\" ] [ text \"Flow Layout\" ]\n            , text \". A Block-level element occupies ... contents, thereby creating a \\\"block\\\".\"\n            , aside []\n                [ strong [] [ text \"Note:\" ]\n                , text \" A block-level element always starts on a new line and ... as it can).\"\n                ]\n            , h3 [] [ text \"See also\" ]\n            , ol []\n                [ li [] [ a [ href \"\" ] [ text \"Inline elements\" ] ]\n                , li [] [ a [ href \"\" ] [ text \"display\" ] ]\n                , li [] [ a [ href \"\" ] [ text \"Block and Inline Layout in Normal Flow\" ] ]\n                ]\n            ]\n        ]\n        |> toTextPlain defaultTextPlainConfig\n    --> String.join \"\\n\"\n    -->     [ \"Block-level elements\"\n    -->     , \"\"\n    -->     , \"In this article, we'll examine HTML block-level elements and how they differ from inline-level elements https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements .\"\n    -->     , \"\"\n    -->     , \"HTML (Hypertext Markup Language) elements ... by CSS in the Flow Layout https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flow_Layout . A Block-level element occupies ... contents, thereby creating a \\\"block\\\".\"\n    -->     , \"\"\n    -->     , \"Note: A block-level element always starts on a new line and ... as it can).\"\n    -->     , \"\"\n    -->     , \"See also\"\n    -->     , \"\"\n    -->     , \"    1. Inline elements\"\n    -->     , \"\"\n    -->     , \"    2. display\"\n    -->     , \"\"\n    -->     , \"    3. Block and Inline Layout in Normal Flow\"\n    -->     ]\n\n\n    -- https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dd\n    div []\n        [ p []\n            [ text \"Cryptids of Cornwall:\" ]\n        , dl []\n            [ dt []\n                [ text \"Beast of Bodmin\" ]\n            , dd []\n                [ text \"A large feline inhabiting Bodmin Moor.\" ]\n            , dt []\n                [ text \"Morgawr\" ]\n            , dd []\n                [ text \"A sea serpent.\" ]\n            , dt []\n                [ text \"Owlman\" ]\n            , dd []\n                [ text \"A giant owl-like creature.\" ]\n            ]\n        ]\n        |> toTextPlain defaultTextPlainConfig\n    --> String.join \"\\n\"\n    -->     [ \"Cryptids of Cornwall:\"\n    -->     , \"\"\n    -->     , \"Beast of Bodmin\"\n    -->     , \"\"\n    -->     , \"    A large feline inhabiting Bodmin Moor.\"\n    -->     , \"\"\n    -->     , \"Morgawr\"\n    -->     , \"\"\n    -->     , \"    A sea serpent.\"\n    -->     , \"\"\n    -->     , \"Owlman\"\n    -->     , \"\"\n    -->     , \"    A giant owl-like creature.\"\n    -->     ]\n\n    div []\n        [ text \"hi\"\n        , p [] [ text \"hello\" ]\n        , text \"world\"\n        ]\n        |> toTextPlain defaultTextPlainConfig\n    --> String.join \"\\n\"\n    -->     [ \"hi\"\n    -->     , \"\"\n    -->     , \"hello\"\n    -->     , \"\"\n    -->     , \"world\"\n    -->     ]\n\n","unions":[],"aliases":[{"name":"SanitizeConfig","comment":" Config for sanitization of content (element and attributes)\n","args":[],"type":"{ urlAttributes : List.List String.String, removedAttributes : List.List String.String, isAllowedUrl : String.String -> Basics.Bool }"},{"name":"TextPlainConfig","comment":" Config for converting html to text\n","args":["msg"],"type":"{ textlinkFromHtml : List.List (HtmlData.Attributes.Attribute msg) -> List.List (HtmlData.Html msg) -> String.String }"}],"values":[{"name":"defaultSanitizeConfig","comment":" Default SanitizeConfig provided out of the box\n","type":"HtmlData.Extra.SanitizeConfig"},{"name":"defaultTextPlainConfig","comment":" Default TextPlainConfig provided out of the box\n\nNote: there's a space added behind the string to prevent punctuations from\nbeing confused as part of url.\n\n    import HtmlData exposing (..)\n    import HtmlData.Attributes exposing (..)\n\n    defaultTextPlainConfig.textlinkFromHtml\n        [ id \"some-id\"\n        , href \"https://example.com/url\"\n        , src \"https://example.com/src\"\n        ]\n        [ text \"Hello World \"\n        , b [] [ text \"Everyone!\" ]\n        , text \" How are you?\"\n        ]\n    --> \"Hello World Everyone! How are you? https://example.com/url \"\n\n    defaultTextPlainConfig.textlinkFromHtml\n        [ href \"https://example.com/url\" ]\n        [ text \"Click here\"\n        ]\n    --> \"Click here https://example.com/url \"\n\n    defaultTextPlainConfig.textlinkFromHtml\n        [ href \"https://example.com/url\" ]\n        [ text \"See https://example.com/url\"\n        ]\n    --> \"See https://example.com/url \"\n\n    defaultTextPlainConfig.textlinkFromHtml\n        [ href \"https://example.com/url\" ]\n        [ text \"https://example.com/url\"\n        ]\n    --> \"https://example.com/url \"\n\n","type":"HtmlData.Extra.TextPlainConfig msg"},{"name":"escapeHtml","comment":" <http://wonko.com/post/html-escaping>\n\n    \"<a href=\\\"/user/foo\\\" onmouseover=\\\"alert(1)\\\">foo\\\" onmouseover=\\\"alert(1)</a>\"\n    |> escapeHtml\n    --> \"&lt;a&#32;href&#61;&quot;/user/foo&quot;&#32;onmouseover&#61;&quot;alert&#40;1&#41;&quot;&gt;foo&quot;&#32;onmouseover&#61;&quot;alert&#40;1&#41;&lt;/a&gt;\"\n\n    \"<a href='/user/foo' onmouseover='alert(1)'>foo' onmouseover='alert(1)</a>\"\n    |> escapeHtml\n    --> \"&lt;a&#32;href&#61;&#39;/user/foo&#39;&#32;onmouseover&#61;&#39;alert&#40;1&#41;&#39;&gt;foo&#39;&#32;onmouseover&#61;&#39;alert&#40;1&#41;&lt;/a&gt;\"\n\n","type":"String.String -> String.String"},{"name":"fromHtmlParserNodes","comment":" Converts from [`Html.Parser.Node`](https://package.elm-lang.org/packages/hecrj/html-parser/latest/Html-Parser#Node) into `HtmlData.Html`\n\nWe could achieve `String -> List (HtmlData.Html msg)` by\n\n1.  combining with [`Html.Parser.run`](https://package.elm-lang.org/packages/hecrj/html-parser/latest/Html-Parser#run)\n\n2.  adding fallback value for error\n\nLike this\n\n    import Html.Parser\n    import HtmlData exposing (..)\n    import HtmlData.Attributes exposing (..)\n\n    fromString : String -> List (Html msg)\n    fromString str =\n        case Html.Parser.run str of\n            Err err ->\n                [ text (Debug.toString err) ]\n            --\n            Ok nodes ->\n                fromHtmlParserNodes nodes\n\n    fromString \"<p class=\\\"hello world\\\"><b>young</b> and <em>dangerous</em></p>\"\n    --> [Element \"p\" [Attribute \"class\" \"hello world\"] [Element \"b\" [] [Text \"young\"],Text \" and \",Element \"em\" [] [Text \"dangerous\"]]]\n\n","type":"List.List Html.Parser.Node -> List.List (HtmlData.Html msg)"},{"name":"sanitize","comment":" Given some `String`, run it through a sanitizer and get back safe `String` that we can use as `text/html`\n\n    sanitize defaultSanitizeConfig \"\"\"<h1 class=\"javascript:yo\"> hello </h1>\"\"\"\n    --> Just \"<h1 class=\\\"javascript:yo\\\">&#32;hello&#32;</h1>\"\n\n    sanitize defaultSanitizeConfig \"\"\"<a onclick='yo' data-other='yo' href=\"javascript :alert('Hi')\">Cli>ckMe</a><script>alert(\"hello\");</script>\"\"\"\n    --> Just \"<a data-other=\\\"yo\\\">Cli&gt;ckMe</a>\"\n\n    sanitize defaultSanitizeConfig \"\"\"<b onmouseover=alert('Wufff!')>click me!</b>\"\"\"\n    --> Nothing\n\n    sanitize defaultSanitizeConfig \"\"\"blah\"/><script>alert(\"hello\");</script>\"\"\"\n    --> Just \"blah&quot;/&gt;\"\n\n    sanitize defaultSanitizeConfig \"\"\"<b onmouseover=alert(‘XSS!‘)></b>\"\"\"\n    --> Just \"<b></b>\"\n\n    sanitize defaultSanitizeConfig \"\"\"<body style=\"javascript:yo\" onload=alert(‘something’)></body>\"\"\"\n    --> Just \"<body></body>\"\n\n    sanitize defaultSanitizeConfig \"\"\"<script>alert(\"hello\");</script>\"\"\"\n    --> Nothing\n\n    sanitize defaultSanitizeConfig \"\"\"<scr<script>ipt>alert(‘XSS’)</script>\"\"\"\n    --> Nothing\n\n    sanitize defaultSanitizeConfig \"\"\"<SCRIPT>yo</SCRIPT>\"\"\"\n    --> Nothing\n\n    sanitize defaultSanitizeConfig \"\"\"<IMG SRC=j&#X41vascript:alert('test2')>\"\"\"\n    --> Nothing\n\n    sanitize defaultSanitizeConfig \"\"\"<IMG SRC=\"j&#X41vascript:alert('test2')\">\"\"\"\n    --> Just \"<img>\"\n\n    sanitize defaultSanitizeConfig \"\"\"<a onclick='yo' href=\"javascript :alert('Hi')\">ClickMe</a><scr<script>ipt>alert(\"hello\");</script>\"\"\"\n    --> Nothing\n\n    sanitize defaultSanitizeConfig \"\"\"<img src=\"data:text/html;base64,PHNjcmlwdD5hbGVydCgndGVzdDMnKTwvc2NyaXB0Pg\">\"\"\"\n    --> Just \"<img>\"\n\n    sanitize defaultSanitizeConfig \"\"\"< h1>strict</h1>\"\"\"\n    --> Nothing\n\n    sanitize defaultSanitizeConfig \"\"\"<h1>strict</ h1>\"\"\"\n    --> Nothing\n\n    sanitize defaultSanitizeConfig \"\"\n    --> Nothing\n\n","type":"HtmlData.Extra.SanitizeConfig -> String.String -> Maybe.Maybe String.String"},{"name":"toElmHtml","comment":" Converts into a regular [elm/html `Html msg`](https://package.elm-lang.org/packages/elm/html/1.0.0/Html)\n","type":"HtmlData.Html msg -> Html.Html msg"},{"name":"toTextHtml","comment":" Returns `String` in `text/html` format, suitable for use in email or static browser rendering.\n\n    import HtmlData exposing (..)\n    import HtmlData.Attributes exposing (..)\n\n    div [ classList\n            [ (\"hello\", True)\n            , (\"world\", True )\n            , (\"there\", False )\n            ]\n        ]\n        [ button [ id \"Decrement\", name \"buttonDecrement\" ] [ text \"-\" ]\n        , div [] [ text (\"Hello \" ++ String.fromInt 1999) ]\n        , button [ id \"Increment\", name \"buttonIncrement\" ] [ text \"+\" ]\n        ]\n        |> toTextHtml\n    --> \"<div class=\\\"hello&#32;world\\\"><button id=\\\"Decrement\\\" name=\\\"buttonDecrement\\\">-</button><div>Hello&#32;1999</div><button id=\\\"Increment\\\" name=\\\"buttonIncrement\\\">&#43;</button></div>\"\n\n    text \"<bad> content\"\n    |> toTextHtml\n    --> \"&lt;bad&gt;&#32;content\"\n\n","type":"HtmlData.Html msg -> String.String"},{"name":"toTextPlain","comment":" Returns `String` in `text/plain` format, suitable for use in email or console output.\n\n    import HtmlData exposing (..)\n    import HtmlData.Attributes exposing (..)\n\n\n    div [ class \"hello\" ]\n        [ p [] [ text \"Hi Bob,\" ]\n        , ol []\n            [ li [] [ text \"Do this\" ]\n            , li [] [ a [ href \"https://example.com\" ] [ text \"Go here\" ] ]\n            ]\n        ]\n        |> toTextPlain defaultTextPlainConfig\n    --> String.join \"\\n\"\n    -->     [ \"Hi Bob,\"\n    -->     , \"\"\n    -->     , \"    1. Do this\"\n    -->     , \"\"\n    -->     , \"    2. Go here https://example.com \"\n    -->     ]\n\n","type":"HtmlData.Extra.TextPlainConfig msg -> HtmlData.Html msg -> String.String"}],"binops":[]}]