From ef19e256840bd0d9d2d3ee4a28e74e2e61dd4e08 Mon Sep 17 00:00:00 2001 From: Kacper Kula Date: Wed, 19 Mar 2025 11:35:38 +0000 Subject: [PATCH] docs: adding syntax highlighting to the documentation --- docs/.vitepress/config.mts | 6 + docs/.vitepress/theme/components/Stats.vue | 8 +- docs/.vitepress/theme/index.ts | 1 + docs/.vitepress/theme/style.css | 5 + docs/.vitepress/theme/syntax-highlighting.css | 132 +++++++++ docs/index.md | 17 +- docs/links-and-images.md | 12 +- .../ohm-plugin/vitepress-ohm-plugin.js | 275 ++++++++++++++++++ docs/renderers/template.md | 2 +- docs/using-properties.md | 4 +- src/grammar/highlighterOperation.ts | 12 +- tsconfig.json | 3 +- 12 files changed, 456 insertions(+), 21 deletions(-) create mode 100644 docs/.vitepress/theme/syntax-highlighting.css create mode 100644 docs/plugins/ohm-plugin/vitepress-ohm-plugin.js diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index e6b6db7..5c0a8e1 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -1,4 +1,5 @@ import { defineConfig } from 'vitepress' +import ohmMarkdownPlugin from '../plugins/ohm-plugin/vitepress-ohm-plugin' // https://vitepress.dev/reference/site-config export default defineConfig({ @@ -90,5 +91,10 @@ export default defineConfig({ message: '', copyright: 'By hypersphere.
Sponsor Me: Ko-Fi' } + }, + markdown: { + config(md) { + md.use(ohmMarkdownPlugin()) + }, } }) diff --git a/docs/.vitepress/theme/components/Stats.vue b/docs/.vitepress/theme/components/Stats.vue index 796528d..692baa3 100644 --- a/docs/.vitepress/theme/components/Stats.vue +++ b/docs/.vitepress/theme/components/Stats.vue @@ -1,22 +1,22 @@