Floki.raw_html

You're seeing just the function raw_html, go back to Floki module for more information.
Link to this function

raw_html(html_tree, options \\ [])

View Source

Specs

raw_html(html_tree() | binary(), keyword()) :: binary()

Converts HTML tree to raw HTML. Note that the resultant HTML may be different from the original one. Spaces after tags and doctypes are ignored.

Options

  • :encode: accepts true or false. Will encode html special characters to html entities. You can also control the encoding behaviour at the application level via config :floki, :encode_raw_html, true | false

  • :pretty: accepts true or false. Will format the output, ignoring breaklines and spaces from the input and putting new ones in order to pretty format the html.

Examples

iex> Floki.raw_html({"div", [{"class", "wrapper"}], ["my content"]})
~s(<div class="wrapper">my content</div>)

iex> Floki.raw_html({"div", [{"class", "wrapper"}], ["10 > 5"]}, encode: true)
~s(<div class="wrapper">10 &gt; 5</div>)

iex> Floki.raw_html({"div", [{"class", "wrapper"}], ["10 > 5"]}, encode: false)
~s(<div class="wrapper">10 > 5</div>)

iex> Floki.raw_html({"div", [], ["\n   ", {"span", [], "Fully indented"}, "    \n"]}, pretty: true)
"""
<div>
  <span>
    Fully indented
  </span>
</div>
"""