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

@callback h1(assigns :: map()) :: Phoenix.LiveView.Rendered.t()

Renders a heading.

assigns

Assigns

  • :text - the text content
  • :opts - a map of user-specified options
@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
@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
@callback link(assigns :: map()) :: Phoenix.LiveView.Rendered.t()

Renders a link.

assigns

Assigns

  • :text - the text content (may be nil)
  • :opts - a map of user-specified options
  • :to - the URL content
@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
@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,
@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
@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