Skip to content

Commit d0c8cf2

Browse files
committed
✨ Added code highlighting using highlightjs
1 parent 2ff563d commit d0c8cf2

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

index.css

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,10 @@ code {
226226
font-family: 'Roboto Mono', "SF Mono", "Lucida Console", Monaco, monospace;
227227
font-size: 16px;
228228
font-weight: 600;
229+
border-radius: 8px;
229230
}
230231

231232
pre {
232-
background-color: var(--dbg-color);
233-
padding: 8px;
234-
border-radius: 8px;
235233
white-space: pre-wrap;
236234
}
237235

index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363

6464
</script>
6565
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
66+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.15.6/build/styles/nord.min.css">
67+
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.15.6/build/highlight.min.js"></script>
6668
</head>
6769

6870
<body>

index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ function keyup() {
66
var wordCount = document.getElementById('content').innerText.trim().replace(regex, ' ').split(' ').length;
77
document.getElementById('wordcount').innerHTML = wordCount + " words";
88
document.getElementById('save').disabled = false;
9+
document.querySelectorAll('pre code').forEach((block) => {
10+
hljs.highlightBlock(block);
11+
});
912
} else {
1013
document.getElementById('content').innerHTML = "";
1114
document.getElementById('wordcount').innerHTML = "";

0 commit comments

Comments
 (0)