File tree Expand file tree Collapse file tree 2 files changed +37
-3
lines changed Expand file tree Collapse file tree 2 files changed +37
-3
lines changed Original file line number Diff line number Diff line change 24
24
OTHER DEALINGS IN THE SOFTWARE.
25
25
{% endcomment %}
26
26
{% comment %}
27
- Version 1.0.6
27
+ Version 1.0.7
28
28
https://github.com/allejo/jekyll-anchor-headings
29
29
30
30
"Be the pull request you wish to see in the world." ~Ben Balter
82
82
{% continue %}
83
83
{% endif %}
84
84
85
- {% assign _workspace = node | split: '</ h' %}
85
+ {% capture _closingTag %} </ h{{ headerLevel }}> {% endcapture %}
86
+ {% assign _workspace = node | split: _closingTag %}
86
87
{% assign _idWorkspace = _workspace[0] | split: 'id="' %}
87
88
{% assign _idWorkspace = _idWorkspace[1] | split: '"' %}
88
89
{% assign html_id = _idWorkspace[0] %}
127
128
{{ header }}{{ anchor }}
128
129
{% endif %}
129
130
{{ include.bodySuffix }}
130
- </ h{{ _workspace | last }}
131
+ </ h{{ headerLevel }} >
131
132
{% endcapture %}
133
+
134
+ <!--
135
+ If we have content after the `</hX>` tag, then we'll want to append that here so we don't lost any content.
136
+ -->
137
+ {% assign chunkCount = _workspace | size %}
138
+ {% if chunkCount > 1 %}
139
+ {% capture new_heading %}{{ new_heading }}{{ _workspace | last }}{% endcapture %}
140
+ {% endif %}
141
+
132
142
{% capture edited_headings %}{{ edited_headings }}{{ new_heading }}{% endcapture %}
133
143
{% endfor %}
134
144
{% endcapture %}{% assign headingsWorkspace = '' %}{{ edited_headings | strip }}
Original file line number Diff line number Diff line change
1
+ ---
2
+ # https://github.com/allejo/jekyll-anchor-headings/issues/21
3
+ ---
4
+
5
+ {% capture markdown %}
6
+ < header >
7
+ < h1 id ="goodbye-world "> Goodbye World</ h1 >
8
+ < p > some header text</ p >
9
+ </ header >
10
+ {% endcapture %}
11
+ {% assign text = markdown | markdownify %}
12
+
13
+ < div >
14
+ {% include anchor_headings.html html=text %}
15
+ </ div >
16
+
17
+ <!-- /// -->
18
+
19
+ < div >
20
+ < header >
21
+ < h1 id ="goodbye-world "> Goodbye World < a href ="#goodbye-world "> </ a > </ h1 >
22
+ < p > some header text</ p >
23
+ </ header >
24
+ </ div >
You can’t perform that action at this time.
0 commit comments