diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index 6f5c2f3..5bd01c8 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -12,6 +12,8 @@
"@jamescoyle/svelte-icon": "^0.1.1",
"@mdi/js": "^7.3.67",
"flag-icons": "^7.1.0",
+ "highlight.js": "^11.9.0",
+ "highlightjs-svelte": "^1.0.6",
"sass": "^1.69.5",
"simple-icons": "^9.21.0",
"svelte-markdown": "^0.4.1"
@@ -1167,6 +1169,19 @@
"integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==",
"dev": true
},
+ "node_modules/highlight.js": {
+ "version": "11.9.0",
+ "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.9.0.tgz",
+ "integrity": "sha512-fJ7cW7fQGCYAkgv4CPfwFHrfd/cLS4Hau96JuJ+ZTOWhjnhoeN1ub1tFmALm/+lW5z4WCAuAV9bm05AP0mS6Gw==",
+ "engines": {
+ "node": ">=12.0.0"
+ }
+ },
+ "node_modules/highlightjs-svelte": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/highlightjs-svelte/-/highlightjs-svelte-1.0.6.tgz",
+ "integrity": "sha512-aXuBPz8df3sOXg90q8rRcBLyxIR8ozPU39a6tJ2rpJUjjd9brRIr55aC0IccW4gsPhQxZ+B3rFugdXsg9/ckDw=="
+ },
"node_modules/immutable": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.4.tgz",
diff --git a/frontend/package.json b/frontend/package.json
index f749b39..0348639 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -20,6 +20,8 @@
"@jamescoyle/svelte-icon": "^0.1.1",
"@mdi/js": "^7.3.67",
"flag-icons": "^7.1.0",
+ "highlight.js": "^11.9.0",
+ "highlightjs-svelte": "^1.0.6",
"sass": "^1.69.5",
"simple-icons": "^9.21.0",
"svelte-markdown": "^0.4.1"
diff --git a/frontend/src/lib/components/markdown-highlight.svelte b/frontend/src/lib/components/markdown-highlight.svelte
new file mode 100644
index 0000000..76fcf93
--- /dev/null
+++ b/frontend/src/lib/components/markdown-highlight.svelte
@@ -0,0 +1,83 @@
+
+
+
showLang(true)}
+ on:mouseleave={() => showLang(false)}
+ on:focus={() => true}
+ role="link"
+ tabindex="0"
+>
+
{lang}
+
{@html html}
+
diff --git a/frontend/src/lib/components/projects-popup.svelte b/frontend/src/lib/components/projects-popup.svelte
index 9fa6313..7d34ef1 100644
--- a/frontend/src/lib/components/projects-popup.svelte
+++ b/frontend/src/lib/components/projects-popup.svelte
@@ -21,6 +21,7 @@
mdiDownload,
} from "@mdi/js";
import SvelteMarkdown from "svelte-markdown";
+ import MarkdownHighlight from "$lib/components/markdown-highlight.svelte";
import { formatMonth } from "$lib/js/date.js";
// Variables
@@ -65,6 +66,7 @@
archive_link = data.archive_link;
application_link = data.application_link;
filteredTags = filterTag(tags, id);
+
// Active set to true after the await to avoid conflict when clicking outside while the popup hasn't showed yet.
setTimeout(() => {
active = true;
@@ -140,7 +142,10 @@
Description
-
+
@@ -218,7 +223,10 @@
Description
-
+
diff --git a/frontend/src/lib/css/markdown.css b/frontend/src/lib/css/markdown.css
index 37ec534..d4e492b 100644
--- a/frontend/src/lib/css/markdown.css
+++ b/frontend/src/lib/css/markdown.css
@@ -48,18 +48,36 @@ li {
}
/* Code Blcoks */
-.markdown pre {
+.markdown-codeblock {
+ position: relative;
+ font-family: 'Sometype Mono', monospace;
+ font-weight: 500;
+ color: var(--color-text);
+}
+
+.markdown-codeblock pre {
display: block;
padding: 9.5px;
margin: 0 0 10px;
font-size: 13px;
line-height: 1.42857143;
- color: var(--color-text);
word-break: break-all;
word-wrap: break-word;
background-color: var(--color-code);
border-radius: 0.5rem;
box-shadow: #352b4027 0px 4px 6px -1px, #352b4016 0px 2px 4px -1px;
+ white-space: pre-wrap;
+}
+
+.little-language {
+ color: var(--color-subtext);
+ position: absolute;
+ visibility: hidden;
+ top: 0;
+ right: 0;
+ margin-top: 0.5rem;
+ margin-right: 0.5rem;
+ cursor: default;
}
.markdown code {
@@ -70,15 +88,6 @@ li {
box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
}
-.markdown pre>code {
- font-family: 'Sometype Mono', monospace;
- font-weight: 500;
- padding: 0 !important;
- border-radius: 0 !important;
- color: var(--color-subtext) !important;
- box-shadow: none !important;
-}
-
.markdown blockquote {
padding: 10px 20px;
margin: 0 0 20px;