GemtextToHTML (gemtext_to_html v0.1.0)
Render Gemtext as HTML.
Phoenix function components are used to transform individual Gemtext elements to HTML. Simply implement the
GemtextToHTML.Components
behaviour and pass it to the :components
option of render/2
.
example
Example
gemtext = """
# Hello, world
* this is a list
* indeed
pretty neat
"""
GemtextToHTML.render_to_string(gemtext, components: GemtextToHTML.DefaultComponents)
# => "<h1>Hello, world</h1><ul><li>this is a list</li><li>indeed</li></ul><p>pretty neat</p>"
Link to this section Summary
Functions
Returns a safe iolist of HTML rendered from a gemtext document.
Returns an iolist of HTML rendered from a gemtext document.
Returns a string of HTML rendered from a gemtext document.
Link to this section Functions
Link to this function
render(gemtext, opts \\ [])
Returns a safe iolist of HTML rendered from a gemtext document.
options
Options
:components
- theGemtextToHTML.Components
callback module used to render each element; defaults toGemtextToHTML.DefaultComponents
Any additional options may be specified, which will be passed to the components as a map in the @opts
assign.
Link to this function
render_to_iolist(gemtext, opts \\ [])
Returns an iolist of HTML rendered from a gemtext document.
See render/2
for options.
Link to this function
render_to_string(gemtext, opts \\ [])
Returns a string of HTML rendered from a gemtext document.
See render/2
for options.