I’ve had my own Dr. Drang moment, which is when you describe how you’ve done something and then someone shows a better way.
In my case it was collegue and most-excellent person Chris Radcliff responding to Implementing Strike Out:
Haha, I had not, but this seems way better. Mark’s default seems closer to what I want, but semantically ins and del are closer so I’ll probably use those and fix the default styling in CSS. I love deleting code, thanks!
— Adam Wuerl (@wuerl) December 29, 2020
So this is a little meta, even for me, but here’s what I’ve now changed. First, I simplified the CSS, replacing with span.new
ins
and with span.strike
del
. I was also able to remove display: inline-block;
from both definitions but had to add text-decoration: none;
to ins
because I don’t want new text underlined, which is the default. Here’s the result:
.article-content ins {
text-decoration: none;
background-color: #b3e8b4;
}
.article-content del {
text-decoration: line-through;
background-color: #f2c2bf;
}
Which means to generate this: new text to be added, I can write <ins>new text to be added</ins>
instead of <span class="new">new text to be added</span>
.