From b79c15a53c992bfb8bf7349b77250b2c9e0b5648 Mon Sep 17 00:00:00 2001 From: Robert Jelic <36573031+NoryiE@users.noreply.github.com> Date: Sat, 13 Sep 2025 23:33:31 +0200 Subject: [PATCH] CC Emulator --- docs/.vitepress/config.mts | 69 +++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 27 deletions(-) diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index f1296dd..4a3a5f6 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -1,38 +1,53 @@ import { defineConfig } from 'vitepress' -// https://vitepress.dev/reference/site-config +function codeBlockRunPlugin(md) { + const defaultFence = md.renderer.rules.fence + + md.renderer.rules.fence = (tokens, idx, options, env, self) => { + const token = tokens[idx] + const info = token.info.trim() + const content = token.content + + // Check if the code block has a 'run' attribute + if (info.includes('run')) { + // Remove 'run' from info for standard rendering + const cleanInfo = info.replace(/\s*run\s*/, '').trim() + token.info = cleanInfo + + // Render the standard code block + const codeHtml = defaultFence(tokens, idx, options, env, self) + + // Wrap with run button - no language badge since we hide it anyway + return ` +
+
+ +
+
+ ${codeHtml} +
+
+ ` + } + + return defaultFence(tokens, idx, options, env, self) + } +} + export default defineConfig({ title: "Basalt", description: "A UI Framework made for CC:Tweaked", lang: 'en-US', lastUpdated: true, - head: [ - //[ - // 'link', - // { rel: 'stylesheet', href: '../css/computer.css', type: 'text/css' } - //], - //[ - // 'script', - // { async: '', src: 'https://copy-cat.squiddev.cc/require.js' } - //], - //[ - // 'script', - // {}, - // `require.config({ paths: { copycat: "https://copy-cat.squiddev.cc/" } }); - // require(["copycat/embed"], setup => setup(document.getElementById("embed-computer")));` - //], - //[ - // 'script', - // {src: '../js/computer.js' }, - //], - - //HTML for this: - // - //
- //
- //
- ], + markdown: { + config: (md) => { + md.use(codeBlockRunPlugin) + } + }, themeConfig: { editLink: {