Add small gap between line numbers and code

Change-Id: Ie65128872f318a42677e52420338684ad8d814f8
This commit is contained in:
Ed Sanders 2020-12-30 15:25:11 +00:00
parent 9c0e82878e
commit 6e558b37db
2 changed files with 14 additions and 2 deletions

View file

@ -346,7 +346,18 @@ class SyntaxHighlight {
return null;
}
return $result->getStdout();
$out = $result->getStdout();
// Convert line numbers to data attributes so they
// can be displayed as CSS generated content and be
// unselectable in all browsers.
$out = preg_replace(
'`<span class="linenos">([^<]*)</span>`',
'<span class="linenos" data-line="$1"></span>',
$out
);
return $out;
}
);

View file

@ -42,8 +42,9 @@
display: block;
}
/* Make line numbers non copyable */
.linenos {
margin-right: 4px;
/* Make line numbers non copyable */
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;