From dcad862c24f8bca320e369fb553b06049543d74b Mon Sep 17 00:00:00 2001 From: tmbb Date: Wed, 2 Aug 2017 10:40:42 +0100 Subject: [PATCH] Markdown modules are now 100% responsible for code Code blocks are now handled by the markdown modules, and ExDoc doesn't do any post-processing. The modules bundled with ExDoc were updated to reflect this. The goal of this change is to make it easier to use alternative Markdown implementations. This might break compatibility for people that are already usin Markdown extensions. --- lib/ex_doc/markdown.ex | 2 +- lib/ex_doc/markdown/cmark.ex | 2 +- lib/ex_doc/markdown/earmark.ex | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ex_doc/markdown.ex b/lib/ex_doc/markdown.ex index 62b457868..f747ab2c6 100644 --- a/lib/ex_doc/markdown.ex +++ b/lib/ex_doc/markdown.ex @@ -29,7 +29,7 @@ defmodule ExDoc.Markdown do Converts the given markdown document to HTML. """ def to_html(text, opts \\ []) when is_binary(text) do - pretty_codeblocks(get_markdown_processor().to_html(text, opts)) + get_markdown_processor().to_html(text, opts) end @doc """ diff --git a/lib/ex_doc/markdown/cmark.ex b/lib/ex_doc/markdown/cmark.ex index 5b92166f5..031810f55 100644 --- a/lib/ex_doc/markdown/cmark.ex +++ b/lib/ex_doc/markdown/cmark.ex @@ -15,6 +15,6 @@ defmodule ExDoc.Markdown.Cmark do Generate HTML output. Cmark takes no options. """ def to_html(text, _opts) do - Cmark.to_html(text) + Cmark.to_html(text) |> ExDoc.Markdown.pretty_codeblocks end end diff --git a/lib/ex_doc/markdown/earmark.ex b/lib/ex_doc/markdown/earmark.ex index 05a79b7c6..d9eb07458 100644 --- a/lib/ex_doc/markdown/earmark.ex +++ b/lib/ex_doc/markdown/earmark.ex @@ -32,6 +32,6 @@ defmodule ExDoc.Markdown.Earmark do file: Keyword.get(opts, :file), breaks: Keyword.get(opts, :breaks, false), smartypants: Keyword.get(opts, :smartypants, true)) - Earmark.as_html!(text, options) + Earmark.as_html!(text, options) |> ExDoc.Markdown.pretty_codeblocks end end