Skip to content

Commit

Permalink
html search: show warning if [role=main] element not found
Browse files Browse the repository at this point in the history
  • Loading branch information
tk0miya committed Feb 22, 2020
1 parent 792b578 commit 73fd75f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sphinx/themes/basic/static/searchtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ var Search = {
$(htmlElement).find('.headerlink').remove();
docContent = $(htmlElement).find('[role=main]')[0];
if(docContent === undefined) {
return "";
console.warn("Content block not found. Sphinx search tries to obtain it " +
"via '[role=main]'. Could you check your theme or template.");
return "";
}
return docContent.textContent || docContent.innerText;
},
Expand Down

0 comments on commit 73fd75f

Please sign in to comment.