line-numbers config now done and working :)

This commit is contained in:
DeltaLima 2023-06-22 16:04:50 +02:00
parent 773b47984e
commit 13ab2b4580
2 changed files with 8 additions and 2 deletions

View file

@ -22,6 +22,6 @@ return [
// change here // change here
'size' => 'small', 'size' => 'small',
'theme' => 'okaidia', 'theme' => 'okaidia',
'line-numbers' => true, 'line-numbers' => 'true',
] ]
?> ?>

View file

@ -26,6 +26,12 @@
function wrap_pre_tags(used_languages, enable_line_numbers) { function wrap_pre_tags(used_languages, enable_line_numbers) {
if ( enable_line_numbers == true )
{
enable_line_numbers = "line-numbers";
} else {
enable_line_numbers = "";
}
// iterate through all used_languages // iterate through all used_languages
for (let iUl = 0;iUl < used_languages.length; iUl++) for (let iUl = 0;iUl < used_languages.length; iUl++)
{ {
@ -47,7 +53,7 @@ function wrap_pre_tags(used_languages, enable_line_numbers) {
org_html = preElements[iEl].innerHTML; org_html = preElements[iEl].innerHTML;
// put <code> tag with 'language-' class and plugin-classes // put <code> tag with 'language-' class and plugin-classes
// prism.js plugin around the <pre> content // prism.js plugin around the <pre> content
new_html = "<code class=\"language-" + used_languages[iUl] + " " + used_plugins + "\">" + org_html + "</code>"; new_html = "<code class=\"language-" + used_languages[iUl] + " " + enable_line_numbers + "\">" + org_html + "</code>";
// write back our new html and enjoy syntax highlightning :) // write back our new html and enjoy syntax highlightning :)
preElements[iEl].innerHTML = new_html; preElements[iEl].innerHTML = new_html;
} }