From e1c7034322f16bc546a966ace5420c7a16de543d Mon Sep 17 00:00:00 2001 From: Tatsu723 Date: Fri, 5 Sep 2025 15:17:19 +0900 Subject: [PATCH 1/8] =?UTF-8?q?=E3=83=86=E3=83=BC=E3=83=9E=E3=83=81?= =?UTF-8?q?=E3=82=A7=E3=83=B3=E3=82=B8=E6=A9=9F=E8=83=BD=E3=81=AE=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/[docs_id]/markdown.tsx | 308 +++++++++++++++++----------------- app/[docs_id]/themeToggle.tsx | 38 +++++ app/globals.css | 7 +- app/layout.tsx | 2 +- app/sidebar.tsx | 4 +- app/terminal/editor.tsx | 3 +- 6 files changed, 208 insertions(+), 154 deletions(-) create mode 100644 app/[docs_id]/themeToggle.tsx diff --git a/app/[docs_id]/markdown.tsx b/app/[docs_id]/markdown.tsx index cacf58f..9ae6958 100644 --- a/app/[docs_id]/markdown.tsx +++ b/app/[docs_id]/markdown.tsx @@ -5,166 +5,174 @@ import { PythonEmbeddedTerminal } from "../terminal/python/embedded"; import { Heading } from "./section"; import { AceLang, EditorComponent } from "../terminal/editor"; import { ExecFile, ExecLang } from "../terminal/exec"; +import { ChangeTheme } from "./themeToggle"; +import { vscDarkPlus, prism } from "react-syntax-highlighter/dist/esm/styles/prism"; + + export function StyledMarkdown({ content }: { content: string }) { - return ( - - {content} - - ); -} + const syntaxtheme = ChangeTheme() === "twilight" ? vscDarkPlus : prism; -// TailwindCSSがh1などのタグのスタイルを消してしまうので、手動でスタイルを指定する必要がある -const components: Components = { - h1: ({ children }) => {children}, - h2: ({ children }) => {children}, - h3: ({ children }) => {children}, - h4: ({ children }) => {children}, - h5: ({ children }) => {children}, - h6: ({ children }) => {children}, - p: ({ node, ...props }) =>

, - ul: ({ node, ...props }) => ( -