Skip to content

WIP: Markdown formatter #1992

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
4 changes: 4 additions & 0 deletions bin/ex_doc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Code.prepend_path Path.expand("../_build/#{mix_env}/lib/makeup_elixir/ebin", __D
Code.prepend_path Path.expand("../_build/#{mix_env}/lib/makeup_erlang/ebin", __DIR__)
Code.prepend_path Path.expand("../_build/#{mix_env}/lib/makeup_html/ebin", __DIR__)
Code.prepend_path Path.expand("../_build/#{mix_env}/lib/earmark_parser/ebin", __DIR__)
Code.prepend_path Path.expand("../_build/#{mix_env}/lib/rustler_precompiled/ebin", __DIR__)
Code.prepend_path Path.expand("../_build/#{mix_env}/lib/castore/ebin", __DIR__)
Code.prepend_path Path.expand("../_build/#{mix_env}/lib/jason/ebin", __DIR__)
Code.prepend_path Path.expand("../_build/#{mix_env}/lib/mdex/ebin", __DIR__)
Code.prepend_path Path.expand("../_build/#{mix_env}/lib/ex_doc/ebin", __DIR__)

if Code.ensure_loaded?(ExDoc.CLI) do
Expand Down
7 changes: 6 additions & 1 deletion lib/ex_doc.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,16 @@ defmodule ExDoc do
end

defp find_formatter(name) do
[ExDoc.Formatter, String.upcase(name)]
[ExDoc.Formatter, modname(name)]
|> Module.concat()
|> check_formatter_module(name)
end

defp modname("epub"), do: EPUB
defp modname("html"), do: HTML
defp modname("markdown"), do: Markdown
defp modname(_), do: nil

defp check_formatter_module(modname, argname) do
if Code.ensure_loaded?(modname) do
modname
Expand Down
2 changes: 1 addition & 1 deletion lib/ex_doc/cli.ex
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ defmodule ExDoc.CLI do
See "Custom config" section below for more information.
--favicon Path to a favicon image for the project. Must be PNG, JPEG or SVG. The image
will be placed in the output "assets" directory.
-f, --formatter Docs formatter to use (html or epub), default: html and epub
-f, --formatter Docs formatter to use (html, epub or markdown), default: html and epub
--homepage-url URL to link to for the site name
--language Identify the primary language of the documents, its value must be
a valid [BCP 47](https://tools.ietf.org/html/bcp47) language tag, default: "en"
Expand Down
Loading
Loading