View Source Textile (textile v0.1.0)

Render Textile to HTML using Rustextile.

iex> Textile.render """
  h2. Textile

  * is a _shorthand syntax_ used to generate valid HTML
  * is *easy* to read and *easy* to write
  * can generate complex pages, including: headings, quotes, lists, tables and figures

  Textile integrations are available for "a wide range of platforms":/article/.
"""

"""
<h2>Textile</h2>

<ul>
  <li>is a <em>shorthand syntax</em> used to generate valid <span class="caps">HTML</span></li>
  <li>is <strong>easy</strong> to read and <strong>easy</strong> to write</li>
  <li>can generate complex pages, including: headings, quotes, lists, tables and figures</li>
</ul>

<p>Textile integrations are available for <a href="/article/">a wide range of platforms</a>.</p>
"""

Link to this section Summary

Types

Render options.

Functions

Render Textile to HTMl.

Link to this section Types

@type options() :: [
  html_kind: :html5 | :xhtml,
  restricted: boolean(),
  sanitize: boolean()
]

Render options.

Link to this section Functions

Link to this function

render(textile, opts \\ [])

View Source
@spec render(binary(), options()) :: binary()

Render Textile to HTMl.

The options directly correspond to Rustextile options.

options

Options

  • :html_kind Either :html5 or :xhtml. Defaults to :html5.
  • :restricted Escape dangerous HTML entities. Default false.
  • :sanitize Remove dangerous HTML entities. Default false.

examples

Examples

iex> Textile.render("<script>foo</script>")
"<p><script>foo</script></p>"

iex> Textile.render("<script>foo</script>", restricted: true)
"<p>&lt;script&gt;foo&lt;/script&gt;</p>"

iex> Textile.render("<script>foo</script>", sanitize: true)
"<p></p>"