Skip to content

Commit 7128381

Browse files
committed
render spec links in md
1 parent f2cfdc4 commit 7128381

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

lib/ex_doc/autolink.ex

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,13 @@ defmodule ExDoc.Autolink do
9999
if app in config.apps do
100100
path <> ext <> suffix
101101
else
102+
#  TODO: remove this if/when hexdocs.pm starts including .md files
103+
ext = ".html"
104+
102105
config.deps
103106
|> Keyword.get_lazy(app, fn -> base_url <> "#{app}" end)
104107
|> String.trim_trailing("/")
105-
|> Kernel.<>("/" <> path <> ".html" <> suffix)
108+
|> Kernel.<>("/" <> path <> ext <> suffix)
106109
end
107110
else
108111
path <> ext <> suffix

lib/ex_doc/language/elixir.ex

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,11 @@ defmodule ExDoc.Language.Elixir do
699699
end
700700

701701
if url do
702-
~s[<a href="#{url}">#{ExDoc.Utils.h(call_string)}</a>]
702+
if config.ext == ".md" do
703+
~s[\[#{ExDoc.Utils.h(call_string)}\](#{url})]
704+
else
705+
~s[<a href="#{url}">#{ExDoc.Utils.h(call_string)}</a>]
706+
end
703707
else
704708
call_string
705709
end <> do_typespec(rest, config)

lib/ex_doc/language/erlang.ex

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,11 @@ defmodule ExDoc.Language.Erlang do
695695
end
696696

697697
if url do
698-
~s|<a href="#{url}">#{string}</a>(|
698+
if config.ext == ".md" do
699+
~s|[#{string}\](#{url})(|
700+
else
701+
~s|<a href="#{url}">#{string}</a>(|
702+
end
699703
else
700704
string <> "("
701705
end

0 commit comments

Comments
 (0)