Packages

Earmark is a pure-Elixir Markdown converter. It is intended to be used as a library (just call Earmark.as_html), but can also be used as a command-line tool (run mix escript.build first). Output generation is pluggable.

Retired package: Deprecated - Earmark is no longer maintained. Migrate to a replacement, for example MDEx (https://hex.pm/packages/mdex).

Current section

Files

Jump to
earmark tasks docs.exs
Raw

tasks/docs.exs

defmodule Mix.Tasks.Docs do
use Mix.Task
@shortdoc "Build docs with globally installed ex_doc to avoid conflicts"
@moduledoc """
ex_doc uses earmark. This means we can't have a dependency from
earmark back to ex_doc, as this would be circular.
Instead, we run ex_doc from the command line.
## Prerequisite
### Install `ex_doc` as an escript on your system ( Elixir >= 1.8 needed)
mix escript.install hex ex_doc
### For ASDF
Provide the location of where the ex_doc escript is by means of the
EX_DOC_ESCRIPT environment variable.
N.B. Launch the above command form anywhere else than your
`Earmark` root directory.
"""
def run(_) do
ex_doc = System.get_env("EX_DOC_ESCRIPT") ||
"#{System.get_env("HOME")}/.mix/escripts/ex_doc"
System.cmd("rm", ~w( -rf doc ))
IO.puts ex_doc
Mix.Task.run(:compile)
System.cmd(ex_doc,
~w( Earmark #{current_version()} _build/dev/lib/earmark/ebin -m Earmark
-u https://github/pragdave/earmark.html ))
end
defp current_version do
Earmark.Mixfile.project() |> Keyword.get(:version)
end
end
# SPDX-License-Identifier: Apache-2.0