mirror of https://github.com/docker/docs.git
Make 'toc_min: 1' work
This commit is contained in:
parent
a09e279035
commit
0d63979f30
|
@ -45,7 +45,7 @@
|
|||
{% assign html_id = _idWorkspace[1] %}
|
||||
|
||||
{% capture _hAttrToStrip %}{{ headerLevel }} id="{{ html_id }}">{% endcapture %}
|
||||
{% assign header = _workspace[0] | replace: _hAttrToStrip, '' %}
|
||||
{% assign header = _workspace[0] | replace: _hAttrToStrip, '' | remove_first: "1>" %}
|
||||
|
||||
{% assign space = '' %}
|
||||
{% for i in (1..indentAmount) %}
|
||||
|
|
|
@ -289,8 +289,19 @@ ng\:form {
|
|||
{% assign my_min = page.toc_min | default: site.toc_min | default: 2 %}
|
||||
{% assign my_max = page.toc_max | default: site.toc_max | default: 3 %}
|
||||
{% assign my_name = page.url | default: "unnamed" %}
|
||||
<div id="side-toc"><div id="side-toc-title">On this page:</div><div id="side-toc-contents">{% include toc_pure_liquid.html html=content sanitize=true class="inline_toc" id="my_toc" toc_min=my_min toc_max=my_max page_name=my_name %}</div></div>
|
||||
{% if my_min < 2 %}
|
||||
{% comment %}
|
||||
the 'content' variable doesn't include the <h1> by default
|
||||
so if we request the h1 heading to be in the in-page TOC,
|
||||
append it to the content before we pass it to the TOC generator
|
||||
{% endcomment %}
|
||||
{% assign my_content = "<h1>" | append: page.title | append: "</h1>" | append: content %}
|
||||
{% else %}
|
||||
{% assign my_content = content %}
|
||||
{% endif %}
|
||||
<div id="side-toc"><div id="side-toc-title">On this page:</div><div id="side-toc-contents">{% include toc_pure_liquid.html html=my_content sanitize=true class="inline_toc" id="my_toc" toc_min=my_min toc_max=my_max page_name=my_name %}</div></div>
|
||||
{% endunless %}
|
||||
<div>{{content}}</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue