From edd3ff0f019a9ecc774a498caa73899c259d3ccd Mon Sep 17 00:00:00 2001 From: Viki Date: Fri, 16 Aug 2024 14:16:19 +0800 Subject: [PATCH] docs: modify docs build config --- docs/docs/theme/index.tsx | 2 ++ docs/docs/theme/style.css | 9 +++++++++ docs/rspress.config.ts | 7 ++++++- docs/src/components/code-block.tsx | 7 +++++-- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/docs/docs/theme/index.tsx b/docs/docs/theme/index.tsx index b12eee52..58c1dcec 100644 --- a/docs/docs/theme/index.tsx +++ b/docs/docs/theme/index.tsx @@ -1,3 +1,5 @@ +import '@unocss/reset/tailwind.css' + import './style.css' import Theme from 'rspress/theme' diff --git a/docs/docs/theme/style.css b/docs/docs/theme/style.css index aebdfb88..2960ed04 100644 --- a/docs/docs/theme/style.css +++ b/docs/docs/theme/style.css @@ -1,5 +1,14 @@ @unocss; +.hide-scrollbar { + scrollbar-width: none; + -ms-overflow-style: none; + + &::-webkit-scrollbar { + display: none; + } +} + :root { --rp-c-text-code: var(--rp-c-brand-dark); --rp-c-text-code-bg: #90998e1a; diff --git a/docs/rspress.config.ts b/docs/rspress.config.ts index d6f0f379..764c00a8 100644 --- a/docs/rspress.config.ts +++ b/docs/rspress.config.ts @@ -127,7 +127,9 @@ export default defineConfig({ }, plugins, themeConfig: { - darkMode: true, + enableContentAnimation: true, + enableScrollToTop: true, + darkMode: !process.env.IS_SODOC, socialLinks: [ { icon: 'github', @@ -139,6 +141,9 @@ export default defineConfig({ }, builderPlugins, builderConfig: { + html: { + tags: [{ tag: 'script', children: "window.RSPRESS_THEME = 'light';" }], + }, output: { cleanDistPath: true, }, diff --git a/docs/src/components/code-block.tsx b/docs/src/components/code-block.tsx index 15b6ab24..490f0688 100644 --- a/docs/src/components/code-block.tsx +++ b/docs/src/components/code-block.tsx @@ -53,8 +53,11 @@ export function CodeBlock(props: Props) { >
{clipboard.copied ? 'Copied' : 'Copy'}
- {/* biome-ignore lint/security/noDangerouslySetInnerHtml: */} -
+
*/ + dangerouslySetInnerHTML={{ __html: html }} + />
) }