Skip to content
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

Generate search index entries for all headings, not just H1 and H2 #644

Merged
merged 3 commits into from Jun 22, 2015

Conversation

@zmousm
Copy link
Contributor

@zmousm zmousm commented Jun 19, 2015

Currently search index generation is limited to H1 and H2, which is hard-coded. I have found it necessary to extend this to H3 and H4, as I wanted to provide more specific search results. Not sure what a good balance would be (e.g. stop at H4), as the level of headings included in the TOC, for example, is up to the template, so I opted for no limits.

@landscape-bot
Copy link

@landscape-bot landscape-bot commented Jun 19, 2015

Code Health
Code quality remained the same when pulling 7d852d0 on zmousm:unlimit_search into 9cf5a99 on mkdocs:master.

@d0ugal
Copy link
Member

@d0ugal d0ugal commented Jun 19, 2015

This looks great! I'm really busy at the moment, planning to look at it at the start of next week.

@landscape-bot
Copy link

@landscape-bot landscape-bot commented Jun 21, 2015

Code Health
Code quality remained the same when pulling 1c5d881 on zmousm:unlimit_search into 9cf5a99 on mkdocs:master.

@landscape-bot
Copy link

@landscape-bot landscape-bot commented Jun 21, 2015

Code Health
Code quality remained the same when pulling 495b8ea on zmousm:unlimit_search into 9cf5a99 on mkdocs:master.

return toc_sub_item
toc_item_r = self._find_toc_by_id(toc_item.children, id_)
if toc_item_r is not None:
return toc_item_r

This comment has been minimized.

@d0ugal

d0ugal Jun 22, 2015
Member

This if statement could be simplified with return toc_item_r

This comment has been minimized.

@zmousm

zmousm Jun 22, 2015
Author Contributor

That wouldn't work because recursion breaks as soon as it reaches the first empty list of children. For example:

() recursing [u'#_1', u'#_2'] for dnsmasq
(_1) recursing [u'#capwap-split-mac', u'#local-switching-vs-overlay-tunnels', u'#vlans-vlan-profiles-overlayvlanwla-tunnels'] for dnsmasq
(capwap-split-mac) recursing [] for dnsmasq
(_1) recursion returned <type 'NoneType'>
() recursion returned <type 'NoneType'>

So _find_toc_by_id returns None.

This comment has been minimized.

@d0ugal

d0ugal Jun 22, 2015
Member

Oh, sorry. Good point. I totally miss-read it.

@d0ugal d0ugal added this to the 0.15.0 milestone Jun 22, 2015
d0ugal added a commit that referenced this pull request Jun 22, 2015
Generate search index entries for all headings, not just H1 and H2
@d0ugal d0ugal merged commit 85a8ca9 into mkdocs:master Jun 22, 2015
3 checks passed
3 checks passed
codecov/commit 93.53% (min required 90%)
Details
continuous-integration/appveyor AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@d0ugal
Copy link
Member

@d0ugal d0ugal commented Jun 22, 2015

Thanks!

thumbs

waylan added a commit to waylan/mkdocs that referenced this pull request Nov 10, 2017
Uses the `mdx_gh_links` Markdown extension. Fixes mkdocs#644.
waylan added a commit to waylan/mkdocs that referenced this pull request Nov 11, 2017
Uses the `mdx_gh_links` Markdown extension. Fixes mkdocs#644.
waylan added a commit to waylan/mkdocs that referenced this pull request Nov 11, 2017
Uses the `mdx_gh_links` Markdown extension. Fixes mkdocs#644.
waylan added a commit to waylan/mkdocs that referenced this pull request Mar 9, 2018
Uses the `mdx_gh_links` Markdown extension. Fixes mkdocs#644.
waylan added a commit that referenced this pull request Mar 9, 2018
Uses the `mdx_gh_links` Markdown extension. Fixes #644.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants