I find myself copying a lot of material from books to TiddlyWiki, which have either line numbers or verse numbers. I made a small piece of markup and CSS to add line numbers to the copied texts. This is handy for literature and scripture.
An example of what I want to reproduce. Notice the line numbers on the right.
Here is the tiddler. Notice there are line numbers on every line. I left the line numbers to the left because it’s simpler that way, and I still get the intended result (numbered lines.)
Here is the code:
<h2 style="text-align:center;font-variant-caps: all-small-caps;">Eurōpa Antīqua</h2>
<ol class="linenum">
<li> Discipulī, pictūram spectāte (//Pupils, look at the illus-//</li>
<li>//tration//). Pictūra (//The illustration//) est tabula (//a map//).</li>
<li>Tabula est parva. Tabula est Eurōpa antīqua.</li>
<li> Ubi est Britannia? Ubi est Gallia? Ubi est Hispānia?</li>
<li>Ubi est Germānia? Ubi est Graecia? Ubi est Italia?</li>
<li> Britannia est īnsula. Britannia est magna. Britannia</li>
<li>est īnsula magna. Sicilia est īnsula. Sicilia non est īnsula</li>
<li>parva. Germānia non est īnsula. Gallia non est īnsula.</li>
<li> Hispānia est paenīnsula. Graecia es paenīnsula. His-</li>
<li>pānia est magna, sed Graecia est parva. Italia paenīnsula</li>
</ol>
Here is the stylesheet:
/* Adapted from: https://www.lockedownseo.com/ordered-list-ol-different-color-for-numbers/ */
ol.linenum {
counter-reset: linenumber;
list-style-type: none;
}
ol.linenum li {
counter-increment: linenumber;
position: relative;
}
/* Output the numbers using the counter() function, but use a custom color, and position the numbers how we want */
ol.linenum li:before {
content: counter(linenumber, decimal) "";
left: -42px;
position: absolute;
text-align: right;
font-size: 70%;
width: 26px;
opacity: 0.7;
}
.lectnum:before {
content: counter(lectnumber, upper-roman) "";
left: -64px;
position: absolute;
text-align: right;
font-size: 70%;
width: 26px;
opacity: 0.7;
}
I hope this is fairly self-explanatory. As you can see, I made each line of text into an ordered list item, and modified the appearance of the number at the beginning of the line in the style sheet.
If anyone has advice on improving this, please let me know. I’m especially interested in figuring out how to display the line numbers by fives, but it’s not too important since I have something that works “good enough.”
I will try my best to answer questions, but please bear in mind that I barely have the knowledge to make the thing in the first place, so please keep your expectations reasonable low.