-
Notifications
You must be signed in to change notification settings - Fork 341
Allow listing outside URLs in extras #2103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
639afcc
Allow listing outside URLs in extras
sorentwo 7d56189
Omit url extras when generating html paths
sorentwo c18894d
Skip generating files for extras in epub formatter
sorentwo b873af5
Prune unnecessary map fields for url extras
sorentwo a9be4ab
Document the new :url option in mix docs
sorentwo 861d451
Merge branch 'main' into allow-extra-urls
sorentwo 6b6cad6
Expand extra matcher to handle grouping urls
sorentwo d6e824b
Correct filtering logic for epub extras
sorentwo b5b224c
Update remixicon and add external-link icon
sorentwo b973cfc
Omit external links from search data
sorentwo 64d85dd
Split customizing extras section apart
sorentwo 197ee31
Flip link title and external icon order
sorentwo d8941ee
Only group external links by url
sorentwo 3373491
Update lib/ex_doc/group_matcher.ex
josevalim cabe7c3
Update test/ex_doc/formatter/html_test.exs
josevalim 3eae3fc
Try full path
josevalim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
settings-3-line,add-line,subtract-line,arrow-up-s-line,arrow-down-s-line,arrow-right-s-line,search-2-line,menu-line,close-line,link-m,code-s-slash-line,error-warning-line,information-line,alert-line,double-quotes-l,printer-line | ||
add-line,alert-line,arrow-down-s-line,arrow-right-s-line,arrow-up-s-line,close-line,code-s-slash-line,double-quotes-l,error-warning-line,external-link-line,information-line,link-m,menu-line,printer-line,search-2-line,settings-3-line,subtract-line |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
formatters/html/dist/html-5PS32TPG.js → formatters/html/dist/html-AG646WP7.js
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,36 +18,10 @@ defmodule ExDoc.Formatter.HTML.SearchData do | |
["searchData=" | ExDoc.Utils.to_json(data)] | ||
end | ||
|
||
defp extra(map) do | ||
if custom_search_data = map[:search_data] do | ||
extra_search_data(map, custom_search_data) | ||
else | ||
Comment on lines
-22
to
-24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a clause for this rather than a conditional in the function body. |
||
{intro, sections} = extract_sections_from_markdown(map.source) | ||
|
||
intro_json_item = | ||
encode( | ||
"#{map.id}.html", | ||
map.title, | ||
:extras, | ||
intro | ||
) | ||
|
||
section_json_items = | ||
for {header, body} <- sections do | ||
encode( | ||
"#{map.id}.html##{Utils.text_to_id(header)}", | ||
header <> " - #{map.title}", | ||
:extras, | ||
body | ||
) | ||
end | ||
|
||
[intro_json_item | section_json_items] | ||
end | ||
end | ||
defp extra(%{url: _}), do: [] | ||
|
||
defp extra_search_data(map, custom_search_data) do | ||
Enum.map(custom_search_data, fn item -> | ||
defp extra(%{search_data: search_data} = map) when is_list(search_data) do | ||
Enum.map(search_data, fn item -> | ||
link = | ||
if item.anchor === "" do | ||
"#{map.id}.html" | ||
|
@@ -59,6 +33,30 @@ defmodule ExDoc.Formatter.HTML.SearchData do | |
end) | ||
end | ||
|
||
defp extra(map) do | ||
{intro, sections} = extract_sections_from_markdown(map.source) | ||
|
||
intro_json_item = | ||
encode( | ||
"#{map.id}.html", | ||
map.title, | ||
:extras, | ||
intro | ||
) | ||
|
||
section_json_items = | ||
for {header, body} <- sections do | ||
encode( | ||
"#{map.id}.html##{Utils.text_to_id(header)}", | ||
header <> " - #{map.title}", | ||
:extras, | ||
body | ||
) | ||
end | ||
|
||
[intro_json_item | section_json_items] | ||
end | ||
|
||
defp module(%ExDoc.ModuleNode{} = node) do | ||
{intro, sections} = extract_sections(node.doc_format, node) | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add an icon, such as this one, for URLs?
If so, you can upload this bundle to remixicon.com, add external link, and get the new font back: https://github.com/elixir-lang/ex_doc/blob/main/assets/fonts/RemixIconCollection.remixicon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is that?