Skip to content

Commit

Permalink
Use EDoc link for erlang type
Browse files Browse the repository at this point in the history
  • Loading branch information
chulkilee committed Jul 24, 2019
1 parent ab8a16c commit b342e93
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/ex_doc/formatter/html/autolink.ex
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,17 @@ defmodule ExDoc.Formatter.HTML.Autolink do

defp type_remote_url(source, alias, name, args) do
name = enc("#{name}")
"#{source}#{enc(inspect(alias))}.html#t:#{name}/#{length(args)}"

if erlang_alias?(alias) do
"#{source}#{enc(to_string(alias))}.html#type-#{name}"
else
"#{source}#{enc(inspect(alias))}.html#t:#{name}/#{length(args)}"
end
end

defp erlang_alias?(alias) do
first_char = alias |> to_string() |> String.at(0)
first_char == String.downcase(first_char)
end

defp typespec_string_to_link(string, url) do
Expand Down

0 comments on commit b342e93

Please sign in to comment.