From 455fbb78b70574ae625253f5f2b2f1ad1954026e Mon Sep 17 00:00:00 2001 From: Qz Date: Wed, 29 May 2024 23:24:18 +0700 Subject: [PATCH] Fix syntax highlighting light theme in API ref (#1067) --- site/api/components/Class/Constructors.tsx | 4 +++- site/api/components/Class/Method.tsx | 16 +++++++++++++--- site/api/components/CodeBlock.tsx | 9 +++++---- site/api/components/PropertyName.tsx | 4 ++-- site/api/components/styles.tsx | 18 +++++++++++++----- 5 files changed, 36 insertions(+), 15 deletions(-) diff --git a/site/api/components/Class/Constructors.tsx b/site/api/components/Class/Constructors.tsx index 4aec91a20..d74a2935c 100644 --- a/site/api/components/Class/Constructors.tsx +++ b/site/api/components/Class/Constructors.tsx @@ -24,7 +24,9 @@ export function Constructors({ {v.accessibility ? {v.accessibility}{" "} : undefined} - {v.name}( + + {v.name} + ( {v.params}); {"jsDoc" in v &&

{v.jsDoc?.doc}

} diff --git a/site/api/components/Class/Method.tsx b/site/api/components/Class/Method.tsx index 29281a7e3..963614ecc 100644 --- a/site/api/components/Class/Method.tsx +++ b/site/api/components/Class/Method.tsx @@ -73,13 +73,23 @@ export function Def( return ( <> {method.kind == "setter" - ? set{" "} + ? ( + + set{" "} + + ) : method.kind == "getter" - ? get{" "} + ? ( + + get{" "} + + ) : ( "" )} - {method.name} + + {method.name} + {typeParams} ( diff --git a/site/api/components/CodeBlock.tsx b/site/api/components/CodeBlock.tsx index c245920d8..14a8b6cc9 100644 --- a/site/api/components/CodeBlock.tsx +++ b/site/api/components/CodeBlock.tsx @@ -4,12 +4,13 @@ export function CodeBlock({ children }: { children?: ComponentChildren }) { return ( <> {"\n\n"} -
+
+ + ts {"\n\n"} -
-            {children}
+        
+          {children}
         
- {"\n\n"}
{"\n\n"} diff --git a/site/api/components/PropertyName.tsx b/site/api/components/PropertyName.tsx index 086cf18ed..da759d7c6 100644 --- a/site/api/components/PropertyName.tsx +++ b/site/api/components/PropertyName.tsx @@ -9,11 +9,11 @@ export function PropertyName({ }) { return ( <> - + {name} {(optional || hasType) && ( - + {optional && <>?} {hasType && <>:} diff --git a/site/api/components/styles.tsx b/site/api/components/styles.tsx index 3b66206e8..49c955875 100644 --- a/site/api/components/styles.tsx +++ b/site/api/components/styles.tsx @@ -1,25 +1,33 @@ import { ComponentChildren } from "preact"; export function StyleKw({ children }: { children?: ComponentChildren }) { - return {children}; + return ( + {children} + ); } export function StyleStrLit({ children }: { children?: ComponentChildren }) { - return {children}; + return ( + {children} + ); } export function StyleTypeRef({ children }: { children?: ComponentChildren }) { return ( - + {children} ); } export function StyleCallee({ children }: { children?: ComponentChildren }) { - return {children}; + return ( + {children} + ); } export function StyleNum({ children }: { children?: ComponentChildren }) { - return {children}; + return ( + {children} + ); }