diff --git a/extensions/void/src/sidebar/Sidebar.tsx b/extensions/void/src/sidebar/Sidebar.tsx
index b8099733..67492f36 100644
--- a/extensions/void/src/sidebar/Sidebar.tsx
+++ b/extensions/void/src/sidebar/Sidebar.tsx
@@ -56,8 +56,8 @@ const ChatBubble = ({ chatMessage }: { chatMessage: ChatMessage }) => {
>
}
else if (role === 'assistant') {
- const tokens = marked.lexer(children); // https://marked.js.org/using_pro#renderer
- chatbubbleContents = // sectionsHTML
+
+ chatbubbleContents = // sectionsHTML
}
diff --git a/extensions/void/src/sidebar/chatContext.tsx b/extensions/void/src/sidebar/chatContext.tsx
index 4962c45d..d6397392 100644
--- a/extensions/void/src/sidebar/chatContext.tsx
+++ b/extensions/void/src/sidebar/chatContext.tsx
@@ -60,9 +60,6 @@ function ChatProvider({ children }: { children: ReactNode }) {
setCurrentThreadId(currentThread.id)
}
- console.log('adding message: ', currentThreadId, currentThread.id, message.displayContent)
- console.log('allThreads', allThreads)
-
setAllThreads({
...allThreads.current,
[currentThread.id]: {
diff --git a/extensions/void/src/sidebar/markdown/MarkdownRender.tsx b/extensions/void/src/sidebar/markdown/MarkdownRender.tsx
index c972342e..999cdd80 100644
--- a/extensions/void/src/sidebar/markdown/MarkdownRender.tsx
+++ b/extensions/void/src/sidebar/markdown/MarkdownRender.tsx
@@ -1,9 +1,9 @@
-import React, { JSX, useState } from "react"
-import { MarkedToken, Token, TokensList } from "marked"
-import { awaitVSCodeResponse, getVSCodeAPI } from "../getVscodeApi"
+import React, { JSX } from "react"
+import { marked, MarkedToken, Token, TokensList } from "marked"
import BlockCode from "./BlockCode"
-const Render = ({ token }: { token: Token }) => {
+const RenderToken = ({ token, nested = false }: { token: Token | string, nested?: boolean }): JSX.Element => {
+
// deal with built-in tokens first (assume marked token)
const t = token as MarkedToken
@@ -62,7 +62,7 @@ const Render = ({ token }: { token: Token }) => {
const ListTag = t.ordered ? "ol" : "ul"
return (
{t.items.map((item, index) => (
@@ -70,7 +70,7 @@ const Render = ({ token }: { token: Token }) => {
{item.task && (
)}
- {item.text}
+
))}
@@ -78,15 +78,17 @@ const Render = ({ token }: { token: Token }) => {
}
if (t.type === "paragraph") {
- return (
-
- {t.tokens.map((token, index) => (
-
- ))}
-
- )
+ const contents = <>
+ {t.tokens.map((token, index) => (
+
+ ))}
+ >
+ if (nested)
+ return contents
+ return {contents}
}
+ // don't actually render tags, just render strings of them
if (t.type === "html") {
return (
@@ -102,7 +104,7 @@ const Render = ({ token }: { token: Token }) => {
}
if (t.type === "def") {
- return null // Definitions are typically not rendered
+ return <>> // Definitions are typically not rendered
}
if (t.type === "link") {
@@ -138,6 +140,7 @@ const Render = ({ token }: { token: Token }) => {
return
}
+ // strikethrough
if (t.type === "del") {
return {t.text}
}
@@ -151,14 +154,15 @@ const Render = ({ token }: { token: Token }) => {
)
}
-const MarkdownRender = ({ tokens }: { tokens: TokensList }) => {
+const MarkdownRender = ({ string, nested = false }: { string: string, nested?: boolean }) => {
+ const tokens = marked.lexer(string); // https://marked.js.org/using_pro#renderer
return (
<>
{tokens.map((token, index) => (
-
+
))}
>
)
}
-export default MarkdownRender
+export default MarkdownRender
\ No newline at end of file