You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Nowdays, web browsers are smart enough to read linear-gradient() and calc() function in CSS. I would go with that!
Instead of splitting the code block line-by-line and then rebuild them into a <table> element (that is placed inside a <pre> tag 🤦🏻♂️), I would simply add more background images to the current block element using CSS gradients:
<pre><codeclass ="hljs">function foo() {
return 'bar';
}
a
a
a
a</code></pre>
<style>
.hljs {display: block;padding: .5em;line-height: 1.2em;background-color: #eee;background-repeat:repeat-x,repeat-x;background-image:linear-gradient(#dddcalc(1.2em*1), transparentcalc(1.2em*1), transparent),linear-gradient(#dddcalc(1.2em*2), transparentcalc(1.2em*2), transparent);background-position:0calc(0.5em+ (1.2em*1)), 0 calc(0.5em + (1.2em * 5));}
</style>
What I am thinking:
data-ln-active
→ Determine line or range of line to be highlighted.data-ln-hide
→ Hide line number only for this block.data-ln-start
→ Determine the start number (default to1
).The text was updated successfully, but these errors were encountered: