GemtextToHTML.Components behaviour (gemtext_to_html v0.1.0)
Callback module to render HTML components from gemtext elements.
example
Example
defmodule MyApp.MyComponents do
@behaviour GemtextToHTML.Components
import Phoenix.Component
def h1(assigns) do
~H"""
<h1 class="text-lg font-bold"><%= @text %></h1>
"""
end
# ...
end
Link to this section Summary
Callbacks
Renders a heading.
Renders a sub-heading.
Renders a sub-sub-heading.
Renders a link.
Renders an unordered list.
Renders preformatted text.
Renders a block quote.
Renders a line of text.
Link to this section Callbacks
Link to this callback
h1(assigns)
@callback h1(assigns :: map()) :: Phoenix.LiveView.Rendered.t()
Renders a heading.
assigns
Assigns
:text
- the text content:opts
- a map of user-specified options
Link to this callback
h2(assigns)
@callback h2(assigns :: map()) :: Phoenix.LiveView.Rendered.t()
Renders a sub-heading.
assigns
Assigns
:text
- the text content:opts
- a map of user-specified options
Link to this callback
h3(assigns)
@callback h3(assigns :: map()) :: Phoenix.LiveView.Rendered.t()
Renders a sub-sub-heading.
assigns
Assigns
:text
- the text content:opts
- a map of user-specified options
Link to this callback
link(assigns)
@callback link(assigns :: map()) :: Phoenix.LiveView.Rendered.t()
Renders a link.
assigns
Assigns
:text
- the text content (may benil
):opts
- a map of user-specified options:to
- the URL content
Link to this callback
list(assigns)
@callback list(assigns :: map()) :: Phoenix.LiveView.Rendered.t()
Renders an unordered list.
assigns
Assigns
:items
- a list of strings for each list item:opts
- a map of user-specified options
Link to this callback
pre(assigns)
@callback pre(assigns :: map()) :: Phoenix.LiveView.Rendered.t()
Renders preformatted text.
assigns
Assigns
:text
- the text content:opts
- a map of user-specified options:title
- optional; the title/language specified on the same line as the first three backticks,
Link to this callback
quote assigns
@callback quote(assigns :: map()) :: Phoenix.LiveView.Rendered.t()
Renders a block quote.
assigns
Assigns
:text
- the text content:opts
- a map of user-specified options
Link to this callback
text(assigns)
@callback text(assigns :: map()) :: Phoenix.LiveView.Rendered.t()
Renders a line of text.
assigns
Assigns
:text
- the text content:opts
- a map of user-specified options