HTML
<ol> <li>first level</li> <li> first level: <ol> <li>second level</li> <li id="ref">second level</li> </ol> </li> </ol> <a href="#ref">This is a reference to </a>
CSS
ol { counter-reset: item; } li { list-style-type: none; counter-increment: item; } li:before { content: counters(item, '.') ' '; } a:after { content: target-counters(attr(href), item, '.'); }
JavaScript
/* Put your JavaScript here! But be aware that not all rendering tools are supporting JavaScript. */
Preview powered by paged.js
PDF rendered with  (https://weasyprint.org/)