Skip to content

Commit 23b5f01

Browse files
committed
cleanup
1 parent d295d8e commit 23b5f01

File tree

3 files changed

+9
-34
lines changed

3 files changed

+9
-34
lines changed

Diff for: lib/ex_doc.ex

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ defmodule ExDoc do
4444
if Code.ensure_loaded?(modname) do
4545
modname
4646
else
47-
IO.inspect(modname)
4847
raise "formatter module #{inspect(argname)} not found"
4948
end
5049
end

Diff for: lib/ex_doc/formatter/markdown.ex

+9-16
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
defmodule ExDoc.Formatter.MARKDOWN do
22
@moduledoc false
33

4-
@assets_dir "MD/assets"
5-
alias __MODULE__.{Assets, Templates}
4+
alias __MODULE__.{Templates}
65
alias ExDoc.Formatter.HTML
76
alias ExDoc.Utils
87

@@ -15,7 +14,7 @@ defmodule ExDoc.Formatter.MARKDOWN do
1514

1615
config = normalize_config(config)
1716
File.rm_rf!(config.output)
18-
File.mkdir_p!(Path.join(config.output, "MD"))
17+
File.mkdir_p!(config.output)
1918

2019
project_nodes =
2120
HTML.render_all(project_nodes, filtered_modules, ".md", config, highlight_tag: "samp")
@@ -51,15 +50,15 @@ defmodule ExDoc.Formatter.MARKDOWN do
5150
output =
5251
config.output
5352
|> Path.expand()
54-
|> Path.join("#{config.project}")
53+
|> Path.join("markdown")
5554

5655
%{config | output: output}
5756
end
5857

5958
defp normalize_output(output) do
6059
output
6160
|> String.replace(~r/\r\n|\r|\n/, "\n")
62-
|> String.replace(~r/\n{2,}/, "\n")
61+
|> String.replace(~r/\n{3,}/, "\n\n")
6362
end
6463

6564
defp generate_nav(config, nodes) do
@@ -70,25 +69,19 @@ defmodule ExDoc.Formatter.MARKDOWN do
7069

7170
content = Templates.nav_template(config, nodes)
7271
|> normalize_output()
73-
File.write("#{config.output}/MD/index.md", content)
72+
File.write("#{config.output}/index.md", content)
7473
end
7574

7675
defp generate_extras(config) do
7776
for {_title, extras} <- config.extras do
78-
Enum.each(extras, fn %{id: id, title: title, title_content: _title_content, source: content} ->
79-
output = "#{config.output}/MD/#{id}.md"
80-
content = """
81-
# #{title}
82-
83-
#{content}
84-
"""
85-
|> normalize_output()
77+
Enum.each(extras, fn %{id: id, source: content} ->
78+
output = "#{config.output}/#{id}.md"
8679

8780
if File.regular?(output) do
8881
Utils.warn("file #{Path.relative_to_cwd(output)} already exists", [])
8982
end
9083

91-
File.write!(output, content)
84+
File.write!(output, normalize_output(content))
9285
end)
9386
end
9487
end
@@ -129,7 +122,7 @@ defmodule ExDoc.Formatter.MARKDOWN do
129122
defp generate_module_page(module_node, config) do
130123
content = Templates.module_page(config, module_node)
131124
|> normalize_output()
132-
File.write("#{config.output}/MD/#{module_node.id}.md", content)
125+
File.write("#{config.output}/#{module_node.id}.md", content)
133126
end
134127

135128
end

Diff for: lib/ex_doc/formatter/markdown/assets.ex

-17
This file was deleted.

0 commit comments

Comments
 (0)