🎥 Make videos programmatically with React
Docs: Snippets are always in dark theme
Jonny Burger6b91f7080d9d
diff --git a/packages/docs/docusaurus-theme-shiki-twoslash/theme/CodeBlock/styles.css b/packages/docs/docusaurus-theme-shiki-twoslash/theme/CodeBlock/styles.cssindex 1a4717b28d..d5939ae464 100644--- a/packages/docs/docusaurus-theme-shiki-twoslash/theme/CodeBlock/styles.css+++ b/packages/docs/docusaurus-theme-shiki-twoslash/theme/CodeBlock/styles.css@@ -1,5 +1,9 @@/* Title */+pre.shiki {+ background-color: #282a36 !important;+}+pre.shiki > .code-title {position: absolute;left: 0;@@ -7,13 +11,13 @@ pre.shiki > .code-title {top: 0;width: 100%;- font-family: var(--ifm-font-family-base);- font-size: var(--ifm-code-font-size);- font-weight: 500;+ color: white !important;+ font-size: 0.9rem;color: var(--ifm-color-emphasis-900);- border-bottom: 1px solid var(--ifm-color-emphasis-300);+ border-bottom: 1px solid rgba(255, 255, 255, 0.2);padding: 0 var(--ifm-pre-padding);+ font-family: 'GT Planar';height: 2.5rem;display: flex;diff --git a/packages/docs/docusaurus.config.js b/packages/docs/docusaurus.config.jsindex 5e7e05ddf3..49e2a0ffc5 100644--- a/packages/docs/docusaurus.config.js+++ b/packages/docs/docusaurus.config.js@@ -263,7 +263,7 @@ const config = (mode) => ({'./shiki',{vfsRoot: process.cwd(),- themes: ['github-light', 'github-dark'],+ themes: ['github-dark'],defaultCompilerOptions: {types: ['node'],},diff --git a/packages/docs/src/css/custom.css b/packages/docs/src/css/custom.cssindex a7b7899c93..1bf2c01a5e 100644--- a/packages/docs/src/css/custom.css+++ b/packages/docs/src/css/custom.css@@ -127,20 +127,6 @@ h6 {padding: 0 var(--ifm-pre-padding);}-/* Hide code blocks according to theme */-[data-theme='light'] .shiki.github-dark {- display: none;-}--[data-theme='dark'] .shiki.github-light {- display: none;-}--/* Patches */-pre.shiki > .code-title {- color: var(--ifm-color-emphasis-900) !important;-}-code {background-color: transparent;border-width: 0;diff --git a/packages/docusaurus-plugin/src/shiki.ts b/packages/docusaurus-plugin/src/shiki.tsindex f527b36040..25128095ac 100644--- a/packages/docusaurus-plugin/src/shiki.ts+++ b/packages/docusaurus-plugin/src/shiki.ts@@ -23,13 +23,19 @@ type Fence = {// A set of includes which can be pulled via a set IDconst includes = new Map();-function getHTML(- code: string,- fence: Fence,- highlighters: Highlighter[],- twoslash: any,- twoslashSettings: UserConfigSettings,-) {+function getHTML({+ code,+ fence,+ highlighters,+ twoslash,+ twoslashSettings,+}: {+ code: string;+ fence: Fence;+ highlighters: Highlighter[];+ twoslash: any;+ twoslashSettings: UserConfigSettings;+}) {// Shiki doesn't respect json5 as an input, so switch it// to json, which can handle comments in the syntax highlightif (fence.lang === 'json5') {@@ -111,7 +117,7 @@ export const highlightersFromSettings = (// console.log("i should only log once per theme")// ^ uncomment this to debug if requiredconst themes =- settings.themes || (settings.theme ? [settings.theme] : ['light-plus']);+ settings.themes || (settings.theme ? [settings.theme] : ['dark-plus']);return Promise.all(themes.map(async (theme) => {@@ -217,13 +223,13 @@ const remarkVisitor =node.twoslash = twoslash;}- const shikiHTML = getHTML(- node.value,+ const shikiHTML = getHTML({+ code: node.value,fence,highlighters,twoslash,twoslashSettings,- );+ });// @ts-expect-errornode.type = 'mdxJsxFlowElement';node.name = 'div';@@ -348,5 +354,11 @@ export const transformAttributesToHTML = (const twoslash = runTwoSlashOnNode(code, fence, settings);const newCode = (twoslash && twoslash.code) || code;- return getHTML(newCode, fence, highlighters, twoslash, settings);+ return getHTML({+ code: newCode,+ fence,+ highlighters,+ twoslash,+ twoslashSettings: settings,+ });};