feat: code highlighting

This commit is contained in:
2026-04-25 16:01:28 +02:00
parent 9bae3a813d
commit d1b44ad53e
6 changed files with 108 additions and 3 deletions
+2
View File
@@ -0,0 +1,2 @@
@import 'highlight.js/scss/arduino-light.scss';
@import '@articles/style.scss';
+6 -1
View File
@@ -1,12 +1,13 @@
<script setup lang="ts">
import type { Article } from '@interfaces'
import { ref, onBeforeMount } from 'vue'
import { ref, onBeforeMount, onUpdated } from 'vue'
import { loadArticle } from '@lib/articles'
import { useRoute, onBeforeRouteUpdate, type RouteLocation } from 'vue-router'
import NotFoundView from './NotFoundView.vue'
import { dateFromParts, simpleDateFormat } from '@lib/dates'
import { SIGNATURE, TITLE } from '@lib/meta'
import PageFooter from '@components/PageFooter.vue'
import hljs from 'highlight.js'
const article = ref<Article | null>(null)
const loading = ref<boolean>(true)
@@ -27,6 +28,10 @@ async function loadPage(target: RouteLocation) {
onBeforeMount(() => loadPage(route))
onBeforeRouteUpdate(loadPage)
onUpdated(() => {
hljs.highlightAll()
})
</script>
<template>