Skip to content

Commit ba120a6

Browse files
committed
chore: PR feedback, remove description
1 parent 7871e60 commit ba120a6

File tree

6 files changed

+21
-21
lines changed

6 files changed

+21
-21
lines changed

assets/js/autocomplete/suggestions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ function nodeSectionSuggestion (node, section, query, category, label) {
147147

148148
let link
149149

150-
if (section.anchor === '' || !section.anchor) {
150+
if (section.anchor === '') {
151151
link = `${node.id}.html`
152152
} else {
153153
link = `${node.id}.html#${section.anchor}`
@@ -156,7 +156,7 @@ function nodeSectionSuggestion (node, section, query, category, label) {
156156
return {
157157
link,
158158
title: highlightMatches(section.id, query),
159-
description: section.description || node.title,
159+
description: node.title,
160160
matchQuality: matchQuality(section.id, query),
161161
labels: section.labels || [label, 'section'],
162162
category

assets/test/autocomplete/suggestions.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ describe('getSuggestions', () => {
6464
title: 'API Reference'
6565
},
6666
{
67-
title: "how-to-make-things",
68-
description: "How to make things",
67+
id: "how-to-make-things",
68+
title: "How to make things",
6969
searchData: [
7070
{
7171
id: "custom-text",

lib/ex_doc/formatter/html.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ defmodule ExDoc.Formatter.HTML do
66

77
@main "api-reference"
88
@assets_dir "assets"
9-
@search_data_keys [:anchor, :body, :description, :title, :type]
9+
@search_data_keys [:anchor, :body, :title, :type]
1010

1111
@doc """
1212
Generates HTML documentation for the given modules.

lib/ex_doc/formatter/html/templates.ex

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,11 @@ defmodule ExDoc.Formatter.HTML.Templates do
9696
%{search_data: search_data} when is_list(search_data) ->
9797
search_data =
9898
Enum.map(search_data, fn search_item ->
99-
search_item
100-
|> Map.take([:description, :anchor])
101-
|> Map.put(:id, search_item.title)
102-
|> Map.put(:labels, [search_item.type])
99+
%{
100+
anchor: search_item.anchor,
101+
id: search_item.title,
102+
labels: [search_item.type]
103+
}
103104
end)
104105

105106
Map.put(item, :searchData, search_data)

lib/mix/tasks/docs.ex

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -363,11 +363,13 @@ defmodule Mix.Tasks.Docs do
363363
364364
## Customizing Extras
365365
366-
- `:title` - The title of the extra page. If not provided, the title will be inferred from the filename.
367-
- `:filename` - The name of the generated file. If not provided, the filename will be inferred from the source file.
368-
- `:source` - The source file of the extra page. This is useful if you want to customize the filename or title but keep the source file unchanged.
369-
- `:search_data` - A list of terms to be indexed for autocomplete and search. If not provided, the content of the extra page will be indexed for search.
370-
See the section below for more.
366+
* `:title` - The title of the extra page. If not provided, the title will be inferred from the filename.
367+
* `:filename` - The name of the generated file. If not provided, the filename will be inferred from
368+
the source file.
369+
* `:source` - The source file of the extra page. This is useful if you want to customize the filename or
370+
title but keep the source file unchanged. *
371+
`:search_data` - A list of terms to be indexed for autocomplete and search. If not provided, the content
372+
of the extra page will be indexed for search. See the section below for more.
371373
372374
### Customizing Search Data
373375
@@ -376,11 +378,10 @@ defmodule Mix.Tasks.Docs do
376378
overrides the built in logic for indexing your document based on the headers and content of the document.
377379
The following fields can be provided in a list of maps for `search_data`.
378380
379-
- `:anchor` - The anchor link for the search result. Use `""` to point to the top of the page.
380-
- `:title` - The title of the result.
381-
- `:description` - A brief description of the result (used during autocompletion)
382-
- `:type` - The type of the search result, such as "module", "function" or "section".
383-
- `:body` - The main content or body of the search result, _as markdown_. Used in search, not autocomplete.
381+
* `:anchor` - The anchor link for the search result. Use `""` to point to the top of the page.
382+
* `:title` - The title of the result.
383+
* `:type` - The type of the search result, such as "module", "function" or "section".
384+
* `:body` - The main content or body of the search result, _as markdown_. Used in search, not autocomplete.
384385
385386
## Umbrella project
386387

test/ex_doc/formatter/html_test.exs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,6 @@ defmodule ExDoc.Formatter.HTMLTest do
602602
%{
603603
anchor: "heading-without-content",
604604
title: "custom-text",
605-
description: "Some Custom Text",
606605
type: "custom",
607606
body: """
608607
Some longer text!
@@ -621,7 +620,6 @@ defmodule ExDoc.Formatter.HTMLTest do
621620
%{
622621
"anchor" => "heading-without-content",
623622
"id" => "custom-text",
624-
"description" => "Some Custom Text",
625623
"labels" => ["custom"]
626624
}
627625
] =

0 commit comments

Comments
 (0)