Below is the most simple code that appears to work. But is it faultless? Can it perhaps be improved upon, without making it too complicated?
Code: Select all
<div class="td-post-content">
<div class="toc_white" id="toc_container">
<div class="toc_title">
Contents of this page:</div>
<ul class="toc_list">
<li><a href="https://www.pjotrs-non-existent-website.net/p/tutorial-one.html#ID1"><span class="toc_number">1</span> First item</a></li>
<li><a href="https://www.pjotrs-non-existent-website.net/p/tutorial-one.html#ID2"><span class="toc_number">2</span> Second item</a></li>
<li><a href="https://www.pjotrs-non-existent-website.net/p/tutorial-one.html#ID2"><span class="toc_number">2.1</span> Sub-item for the second item</a></li>
</ul>
</div>
<br />
<h2>
<span id="ID1">First item</span></h2>
1. This is absolutely the first item of them all.<br />
<br />
<h2>
<span id="ID2">Second item</span></h2>
2. And this is the second item.<br />
<br />
<h2>
<span id="ID2.1">Sub-item for the second item</span></h2>
2.1. This sub-item is the very last one.<br />