From e106caa15d62518fcf6d79354f08407863ad42e4 Mon Sep 17 00:00:00 2001
From: weru <fromweru@gmail.com>
Date: Thu, 19 Jan 2023 13:08:33 +0000
Subject: [PATCH] highlight terminal commands
---
assets/js/code.js | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/assets/js/code.js b/assets/js/code.js
index 9d2612d..9720d25 100644
--- a/assets/js/code.js
+++ b/assets/js/code.js
@@ -271,10 +271,20 @@
});
(function addLangLabel() {
+ const shell_based = ['sh', 'shell', 'zsh', 'bash'];
const blocks = codeBlocks();
- blocks.forEach(function(block){
+
+ blocks.forEach(block => {
let label = block.dataset.lang;
- label = label === 'sh' ? 'bash' : label;
+ const is_shell_based = shell_based.includes(label);
+ if(is_shell_based) {
+ const lines = elems(lineClass, block);
+ Array.from(lines).forEach(line => {
+ pushClass(line, 'shell');
+ });
+ }
+
+ label = label === 'sh' ? 'shell' : label;
if(label !== "fallback") {
const labelEl = createEl();
labelEl.textContent = label;
--
Gitblit v1.10.0