Still.Preprocessor behaviour (Still v0.8.0) View Source
Defines functions to be used by the several preprocessors as well as the behaviour they should have.
Preprocessors are the cornerstone of Still. A preprocessor chain can take a markdown file, execute its embedded Elixir, extract metadata from its front matter, transform it into HTML and wrap it in a layout.
There are a few defined chains by default, but you can extend Still with your own.
A custom preprocessor is simply a module that calls use Still.Preprocessor
and implements the render/1
function.
Take the following example:
defmodule YourSite.JPEG do
use Still.Preprocessor
@impl true
def render(file) do
file
end
end
In this example, the render/1
function is used to transform the content and
the metadata of a Elixir.Still.SourceFile.
See the preprocessor guide for more details.
Link to this section Summary
Functions
Retrieves the preprocessor pipeline for the given file.
Runs the preprocessor pipeline for the given file.
Link to this section Functions
Retrieves the preprocessor pipeline for the given file.
Specs
run(Still.SourceFile.t()) :: [Still.SourceFile.t()] | {:error, any()}
Runs the preprocessor pipeline for the given file.
Specs
run(Still.SourceFile.t(), [module()]) :: [Still.SourceFile.t()] | {:error, any()}
Link to this section Callbacks
Specs
after_render(Still.SourceFile.t()) :: Still.SourceFile.t()
Specs
render(Still.SourceFile.t()) :: Still.SourceFile.t()