Skip to content

Commit 3aa792b

Browse files
committed
Remove unused extract_headers
1 parent 3efa2d7 commit 3aa792b

File tree

2 files changed

+0
-38
lines changed

2 files changed

+0
-38
lines changed

lib/ex_doc/doc_ast.ex

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -109,19 +109,6 @@ defmodule ExDoc.DocAST do
109109
def extract_title([{:h1, _attrs, inner, _meta} | ast]), do: {:ok, inner, ast}
110110
def extract_title(_ast), do: :error
111111

112-
@doc """
113-
Extracts headers (h2) from the given AST.
114-
115-
Returns the header text.
116-
"""
117-
def extract_headers(doc_ast, headers) do
118-
for {tag, _, _, _} = node <- doc_ast,
119-
tag in headers,
120-
text = ExDoc.DocAST.text(node),
121-
text != "",
122-
do: text
123-
end
124-
125112
@doc """
126113
Extracts the headers which have anchors (aka ids) in them.
127114
"""

test/ex_doc/doc_ast_test.exs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -131,31 +131,6 @@ defmodule ExDoc.DocASTTest do
131131
end
132132
end
133133

134-
describe "extract_headers" do
135-
test "extracts h2 headers" do
136-
assert extract_headers("""
137-
# h1
138-
## h2-a
139-
### h3
140-
## h2-b
141-
##
142-
""") == ["h2-a", "h2-b"]
143-
end
144-
145-
test "trims whitespace and preserve HTML entities" do
146-
assert extract_headers("""
147-
# h1
148-
##\s\s\s**h2**\s<&>\s`h2`\s\s\s
149-
""") == ["h2 <&> h2"]
150-
end
151-
152-
defp extract_headers(markdown) do
153-
markdown
154-
|> DocAST.parse!("text/markdown")
155-
|> DocAST.extract_headers([:h2])
156-
end
157-
end
158-
159134
describe "headers" do
160135
test "adds and extracts anchored headers" do
161136
assert """

0 commit comments

Comments
 (0)