mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
ui: highlighter: support line-numbers
This commit is contained in:
1 file changed
+1
@@ -10,6 +10,7 @@ const highlighterPage = new AutoloadPage('highlighterPage', () => {
|
|||||||
const m = language.match(/language-([a-z0-9]+)(\|[\d,-]+)/);
|
const m = language.match(/language-([a-z0-9]+)(\|[\d,-]+)/);
|
||||||
if (m?.[2]) {
|
if (m?.[2]) {
|
||||||
$(code).parent().attr('data-line', m[2].substring(1));
|
$(code).parent().attr('data-line', m[2].substring(1));
|
||||||
|
if (language.includes('line-numbers')) $(code).parent().addClass('line-numbers');
|
||||||
$(code).attr('class', `language-${m[1]}`);
|
$(code).attr('class', `language-${m[1]}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user