Skip to content

Commit

Permalink
Fix closing header level for section headings
Browse files Browse the repository at this point in the history
  • Loading branch information
timvink committed Sep 15, 2021
1 parent 8f05cf4 commit bcce1f2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions mkdocs_print_site_plugin/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,16 @@ def get_html_from_items(items: list, dir_urls: bool, excluded_pages: list, secti
item_html += fix_internal_links(item.html, item.url, directory_urls=dir_urls)

if item.is_section:
item_html += (
"<h%s class='nav-section-title' id='section-%s'>%s <a class='headerlink' href='#section-%s' title='Permanent link'>↵</a></h1>" # noqa
% (min(6, section_depth + 1), to_snake_case(item.title), item.title, to_snake_case(item.title))
item_html += """
<h%s class='nav-section-title' id='section-%s'>
%s <a class='headerlink' href='#section-%s' title='Permanent link'>↵</a>
</h%s>
""" % (
min(6, section_depth + 1),
to_snake_case(item.title),
item.title,
to_snake_case(item.title),
min(6, section_depth + 1),
)
item_html += get_html_from_items(item.children, dir_urls, excluded_pages, section_depth + 1)
# We also need to indicate the end of section page
Expand Down

0 comments on commit bcce1f2

Please sign in to comment.