Skip to content

Commit 595c445

Browse files
committed
feat(toc): got the table of contents working for imported documents
Signed-off-by: Laura Santamaria <[email protected]>
1 parent d2fa36b commit 595c445

File tree

4 files changed

+28
-28
lines changed

4 files changed

+28
-28
lines changed

site/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ highlight_theme = "inspired-github"
4343
render_emoji = true
4444
external_links_target_blank = true
4545
external_links_no_referrer = true
46-
insert_anchor_links = "left"
46+
#insert_anchor_links = "left"
4747

4848
[extra]
4949
# Put all your custom variables here

site/content/about/about.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ toc = true
77

88
# So what is bootc?
99

10-
Imagine the ability to set up your operating system using a file you can check into source control. bootc basically turns your operating system into a containerized system, complete with in-place updates, custom configuations and pre-installed software and drivers, and more. You can share your custom containerized operating system image with others, too.
10+
Imagine the ability to set up your operating system using a file you can check into source control. bootc basically turns your operating system into a containerized system, complete with in-place updates, custom configurations and pre-installed software and drivers, and more. You can share your custom containerized operating system image with others, too.
1111

12-
Unlock the power of bootc with shared custom OS images
12+
Unlock the power of bootc with shared custom OS images.

site/templates/imported.html

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,26 @@
2828
{% set_global mapset = mapset | concat(with=mapset1) %}
2929
{%- endif %}
3030
{%- endfor %}
31-
<p>{{ mapset | json_encode(pretty=true) | safe }}</p>
3231
<div class="toc">
3332
<div class="toc-sticky">
34-
<ul>
35-
{%- for elem in toc %}
36-
{%- if elem is starting_with("<h1") %}
37-
{%- set id_val = elem | regex_replace(pattern=`<h1 id="(?P<anchor>.*)">.*</h1>`, rep=`$anchor`) %}
38-
<li class="toc-item"><a href="#{{ id_val }}" class="subtext">{{ elem | regex_replace(pattern=`<h1 id=".*">(?P<heading>.*)</h1>`, rep=`$heading`) | as_str }}</a></li>
39-
{%- else %}
40-
<ul>
41-
{%- if elem is starting_with("<h2") %}
42-
{%- set id_val = elem | regex_replace(pattern=`<h2 id="(?P<anchor>.*)">.*</h2>`, rep=`$anchor`) %}
43-
<li class="toc-item"><a href="#{{ id_val }}" class="subtext">{{ elem | regex_replace(pattern=`<h2 id=".*">(?P<heading>.*)</h2>`, rep=`$heading`) | as_str }}</a></li>
44-
{%- else %}
45-
<ul>
46-
{%- if elem is starting_with("<h3") %}
47-
{%- set id_val = elem | regex_replace(pattern=`<h3 id="(?P<anchor>.*)">.*</h3>`, rep=`$anchor`) %}
48-
<li class="toc-item"><a href="#{{ id_val }}" class="subtext">{{ elem | regex_replace(pattern=`<h3 id=".*">(?P<heading>.*)</h3>`, rep=`$heading`) | as_str }}</a></li>
49-
{%- endif %}
50-
</ul>
51-
{%- endif %}
52-
</ul>
53-
{%- endif %}
54-
{%- endfor %}
55-
</ul>
33+
{%- for elem in mapset %}
34+
{%- set id_val = elem | regex_replace(pattern=`(?P<id>\d*),(?P<anchor>.*),(?P<heading>.*)`, rep=`$id`) %}
35+
{%- set anchor = elem | regex_replace(pattern=`(?P<id>\d*),(?P<anchor>.*),(?P<heading>.*)`, rep=`$anchor`) %}
36+
{%- set heading = elem | regex_replace(pattern=`(?P<id>\d*),(?P<anchor>.*),(?P<heading>.*)`, rep=`$heading`) %}
37+
{%- if id_val == "1" -%}
38+
<div class="toc-item">
39+
<a href="#{{ anchor }}" class="subtext">{{ heading }}</a>
40+
</div>
41+
{%- elif id_val == "2" -%}
42+
<div class="toc-item-child">
43+
<a href="#{{ anchor }}" class="subtext">
44+
<small>- {{ heading }}</small>
45+
</a>
46+
</div>
47+
{%- else -%}
48+
<div></div>
49+
{%- endif -%}
50+
{%- endfor -%}
5651
</div>
5752
</div>
5853
{% endblock toc %}

site/templates/index.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ <h3 class="title-text text-center">
2323
<img src="https://img.shields.io/badge/bootc_on_CNCF_Slack-join_us-green?style=for-the-badge&logo=slack&logoColor=white&label=bootc%20on%20CNCF%20Slack">
2424
</a>
2525
</div>
26+
<div class="explore-more-container">
27+
<div class="explore-more text"
28+
onclick="document.getElementById('features').scrollIntoView({behavior: 'smooth'})">
29+
Explore More ⇩
30+
</div>
31+
</div>
2632
</section>
2733

2834
{% endblock hero %}
@@ -40,7 +46,6 @@ <h3 class="title-text text-center">
4046
{% endblock fonts %}
4147

4248
{% block sidebar %}
43-
<div>
44-
Your cool sidebar
49+
<div class="sidebar">
4550
</div>
4651
{% endblock sidebar %}

0 commit comments

Comments
 (0)