1
1
<!-- Copyright Vespa.ai. All rights reserved. -->
2
2
{% assign h2_count = content | split: '< h ' | size | minus: 1 %}
3
3
{% if h2_count > 4 %}
4
-
4
+
5
5
6
6
< nav class ="toc {% if page.title == 'FAQ - frequently asked questions'%} faq-toc {% endif %} " aria-labelledby ="on-this-page-heading " style ="position: fixed; align-self: flex-start; ">
7
7
< h3 id ="on-this-page-heading " style ="pointer-events: none; "> On this page:</ h3 >
8
8
{% assign headings = content | split: '< ' %}
9
9
10
10
< ul >
11
11
{% for tag in headings %}
12
- {% assign tag_slice = tag | slice: 0, 1%}
13
- {% if tag_slice == '/' %}
12
+ {% assign trimmed_tag = tag | strip %}
13
+ {% assign tag_slice = trimmed_tag | slice: 0, 3 %}
14
+
15
+ <!-- skip if parser is inside of comment tag -->
16
+ {% if tag_slice == '!--' %}
17
+ {% assign skip = true %}
18
+ {% endif %}
19
+ <!-- stop skiping if parser reached comment tag end -->
20
+ {% if tag contains '--> ' %}
21
+ {% assign skip = false %}
14
22
{% continue %}
15
- {% else %}
23
+ {% endif %}
24
+
25
+ {% if skip %}
26
+ {% continue %}
27
+ {% endif %}
28
+
29
+
30
+ {% assign first_char = trimmed_tag | slice: 0, 1 %}
31
+ {% if first_char == '/' %}
32
+ {% continue %}
33
+ {% endif %}
34
+
16
35
{% assign tag_start = tag | slice: 0, 3 %}
17
36
{% if tag_start == 'h1 ' or tag_start == 'h2 ' or tag_start == 'h3 ' or tag_start == 'h1> ' or tag_start == 'h2> ' or tag_start == 'h3> ' %}
18
37
{% assign toc_level = tag | slice: 1, 2%}
@@ -26,13 +45,11 @@ <h3 id="on-this-page-heading" style="pointer-events: none;">On this page:</h3>
26
45
< li class ="toc-level-{{toc_level | minus: 1 }} ">
27
46
< a href ="#{{ heading_id }} "> {{ heading_text }}</ a >
28
47
</ li >
29
- {% endif %}
30
- {% endif %}
48
+ {% endif %}
31
49
{% endif %}
32
50
{% endfor %}
33
51
34
52
</ ul >
35
53
</ div >
36
54
37
- {% endif %}
38
-
55
+ {% endif %}
0 commit comments