Skip to content

Commit

Permalink
refactor: remove bad conditional compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
c4710n committed Dec 6, 2023
1 parent 2fc4be4 commit 12b7fe8
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions lib/fs_build/adapters/markdown_publisher.ex
Original file line number Diff line number Diff line change
Expand Up @@ -111,23 +111,17 @@ defmodule FsBuild.Adapters.MarkdownPublisher do
end
end

if Code.ensure_loaded?(Earmark) do
defp as_html(body, opts) do
earmark_opts = Keyword.get(opts, :earmark_options, %Earmark.Options{})
highlighters = Keyword.get(opts, :highlighters, [])
body |> Earmark.as_html!(earmark_opts) |> highlight(highlighters)
end
defp as_html(body, opts) do
earmark_opts = Keyword.get(opts, :earmark_options, %Earmark.Options{})
highlighters = Keyword.get(opts, :highlighters, [])
body |> Earmark.as_html!(earmark_opts) |> highlight(highlighters)
end

defp highlight(html, []) do
html
end
defp highlight(html, []) do
html
end

defp highlight(html, _) do
__MODULE__.Highlighter.highlight(html)
end
else
defp as_html(body, _opts) do
body
end
defp highlight(html, _) do
__MODULE__.Highlighter.highlight(html)
end
end

0 comments on commit 12b7fe8

Please sign in to comment.