News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

[BBCODE] Show line number

Started by cellax, May 05, 2016, 06:05:51 PM

Previous topic - Next topic

cellax

hi all,

is there a mod/tip to show line number inside Tag code?

useful when posting program code on reply.

Thx

qc

You could probably do that with CSS - the following works in Chrome, but I didn't check other browsers:
code.bbc_code {
counter-reset: line;
padding-left: 30px;
}

code.bbc_code br {
content: ' ';
color: #999;
display: block;
margin-top: -15px;
margin-left: -15px;
}

code.bbc_code br:before {
counter-increment: line;
content: counter(line);
}

code.bbc_code br:last-child:after {
counter-increment: line;
content: counter(line);
display: block;
margin-bottom: -15px;
}


It will make your code blocks look as follows:


For cross-browser compatibility, I recommend editing the template for the code BBCode though.
Playing quizduell? Having quizduell questions? Our german quizduell forum quizcommunity.de is looking for quiz freaks to come and play quizduell with us :)

Advertisement: