Markup.Languages (Markup v0.1.0)

Copy Markdown View Source

Discovers installed Markup.Language modules.

A language package lists its modules under :markup_languages in its application env (see Markup.Language). config :markup, languages: [...] adds modules explicitly. The result is not cached, because loaded applications change while a project compiles.

Summary

Functions

Every installed language module, deduplicated and sorted by id.

Finds an installed language by id or module.

Resolves the language for opts and an optional document. Precedence: opts[:language], doc.language, config :markup, :default_language, then the only installed language. Raises Markup.Error otherwise.

Functions

all()

@spec all() :: [module()]

Every installed language module, deduplicated and sorted by id.

fetch(id_or_module)

@spec fetch(atom()) :: {:ok, module()} | {:error, Markup.Error.t()}

Finds an installed language by id or module.

resolve(opts, doc)

@spec resolve(keyword(), Markup.Document.t() | nil) :: module()

Resolves the language for opts and an optional document. Precedence: opts[:language], doc.language, config :markup, :default_language, then the only installed language. Raises Markup.Error otherwise.