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/sass/_syntax.sass | 11 ++++++++++-
assets/js/code.js | 14 ++++++++++++--
2 files changed, 22 insertions(+), 3 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;
diff --git a/assets/sass/_syntax.sass b/assets/sass/_syntax.sass
index fafb461..458ed49 100644
--- a/assets/sass/_syntax.sass
+++ b/assets/sass/_syntax.sass
@@ -232,4 +232,13 @@
letter-spacing: 0.1px
z-index: 19
&_expanded &_from
- display: none
\ No newline at end of file
+ display: none
+
+.shell
+ position: relative
+ display: flex
+ align-items: center
+ gap: 0.5rem
+ &::before
+ content: "$"
+ position: relative
\ No newline at end of file
--
Gitblit v1.10.0