From 83bf660b76fde8739636c22069a9cb2c1c302d22 Mon Sep 17 00:00:00 2001 From: Mathew Pareles Date: Sun, 12 Jan 2025 17:51:58 -0800 Subject: [PATCH] md styles --- .../react/src/markdown/ChatMarkdownRender.tsx | 110 ++++++++++++------ .../react/src/sidebar-tsx/SidebarChat.tsx | 2 - .../void/browser/react/tailwind.config.js | 2 +- 3 files changed, 73 insertions(+), 41 deletions(-) diff --git a/src/vs/workbench/contrib/void/browser/react/src/markdown/ChatMarkdownRender.tsx b/src/vs/workbench/contrib/void/browser/react/src/markdown/ChatMarkdownRender.tsx index c9fcb230..96352c0f 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/markdown/ChatMarkdownRender.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/markdown/ChatMarkdownRender.tsx @@ -71,7 +71,15 @@ const CodeButtonsOnHover = ({ text }: { text: string }) => { } export const CodeSpan = ({ children, className }: { children: React.ReactNode, className?: string }) => { - return + return {children} } @@ -95,45 +103,60 @@ const RenderToken = ({ token, nested = false }: { token: Token | string, nested? if (t.type === "heading") { const HeadingTag = `h${t.depth}` as keyof JSX.IntrinsicElements - return {t.text} + const headingClasses: { [h: string]: string } = { + h1: "text-4xl font-semibold mt-6 mb-4 pb-2 border-b border-void-bg-2", + h2: "text-3xl font-semibold mt-6 mb-4 pb-2 border-b border-void-bg-2", + h3: "text-2xl font-semibold mt-6 mb-4", + h4: "text-xl font-semibold mt-6 mb-4", + h5: "text-lg font-semibold mt-6 mb-4", + h6: "text-base font-semibold mt-6 mb-4 text-gray-600" + } + return {t.text} } if (t.type === "table") { return ( - - - - {t.header.map((cell: any, index: number) => ( - - ))} - - - - {t.rows.map((row: any[], rowIndex: number) => ( - - {row.map((cell: any, cellIndex: number) => ( - + {t.rows.map((row: any[], rowIndex: number) => ( + + {row.map((cell: any, cellIndex: number) => ( + + ))} + + ))} + +
- {cell.raw} -
+ + + + {t.header.map((cell: any, index: number) => ( + ))} - ))} - -
{cell.raw} - +
+ +
+ {cell.raw} +
+ ) } if (t.type === "hr") { - return
+ return
} if (t.type === "blockquote") { - return
{t.text}
+ return
{t.text}
} if (t.type === "list") { @@ -141,14 +164,16 @@ const RenderToken = ({ token, nested = false }: { token: Token | string, nested? return ( {t.items.map((item, index) => ( -
  • +
  • {item.task && ( - + )} - + + +
  • ))}
    @@ -163,13 +188,12 @@ const RenderToken = ({ token, nested = false }: { token: Token | string, nested? if (nested) return contents - return

    {contents}

    + return

    {contents}

    } - // don't actually render tags, just render strings of them if (t.type === "html") { return ( -
    +			
     				{``}
     				{t.raw}
     				{``}
    @@ -187,22 +211,32 @@ const RenderToken = ({ token, nested = false }: { token: Token | string, nested?
     
     	if (t.type === "link") {
     		return (
    -			 { window.open(t.href) }} href={t.href} title={t.title ?? undefined}>
    +			 { window.open(t.href) }}
    +				href={t.href}
    +				title={t.title ?? undefined}
    +			>
     				{t.text}
     			
     		)
     	}
     
     	if (t.type === "image") {
    -		return {t.text}
    +		return {t.text}
     	}
     
     	if (t.type === "strong") {
    -		return {t.text}
    +		return {t.text}
     	}
     
     	if (t.type === "em") {
    -		return {t.text}
    +		return {t.text}
     	}
     
     	// inline code
    @@ -220,12 +254,12 @@ const RenderToken = ({ token, nested = false }: { token: Token | string, nested?
     
     	// strikethrough
     	if (t.type === "del") {
    -		return {t.text}
    +		return {t.text}
     	}
     
     	// default
     	return (
    -		
    +
    Unknown type: {t.raw}
    diff --git a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx index c132bc76..9e29fcc8 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx @@ -495,8 +495,6 @@ export const SidebarChat = () => { if (isDisabled) return if (isLoading) return - - const currSelns = threadsStateService.state._currentStagingSelections ?? [] const selections = !currSelns ? null : await Promise.all( currSelns.map(async (sel) => ({ ...sel, content: await VSReadFile(modelService, sel.fileURI) })) diff --git a/src/vs/workbench/contrib/void/browser/react/tailwind.config.js b/src/vs/workbench/contrib/void/browser/react/tailwind.config.js index 79d8884c..c4dc1980 100644 --- a/src/vs/workbench/contrib/void/browser/react/tailwind.config.js +++ b/src/vs/workbench/contrib/void/browser/react/tailwind.config.js @@ -11,7 +11,7 @@ module.exports = { extend: { fontSize: { xs: '10px', - sm: '12px', + sm: '11px', root: '13px', lg: '14px', xl: '16px',