View Source Tableau.Extension behaviour (tableau v0.3.0)

A tableau extension.

An extension can be used to generate other kinds of content.

There are currently the following extension types:

  • :pre_build - executed before tableau builds your site and writes anything to disk.
defmodule MySite.PostsExtension do
  use Tableau.Extension, type: :pre_build

  def run(_graph, _site) do
    posts = Path.wildcard("_posts/**/*.md")

    for post <- post do
      post
      |> Markdown.render()
      |> then(&File.write(Path.join(Path.rootname(post), "index.html"), &1))
    end

    :ok
  end
end

Link to this section Summary

Callbacks

The extension entry point.

Link to this section Callbacks

@callback run(Graph.t(), map()) :: :ok | :error

The extension entry point.

The function is passed the layout graph and a set of default assigns.

The graph is an instance of a Graph.t from the library libgraph.