From f7d698aff4325c9370243110e8ee9c0fbedc5c44 Mon Sep 17 00:00:00 2001 From: Simon Farshid Date: Thu, 27 Jun 2024 22:52:45 -0700 Subject: [PATCH] feat: markdown basic code block support (#345) --- .../registry/assistant-ui/markdown-text.tsx | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/shadcn-registry/registry/assistant-ui/markdown-text.tsx b/packages/shadcn-registry/registry/assistant-ui/markdown-text.tsx index 5837489f0..73e56dfed 100644 --- a/packages/shadcn-registry/registry/assistant-ui/markdown-text.tsx +++ b/packages/shadcn-registry/registry/assistant-ui/markdown-text.tsx @@ -147,6 +147,26 @@ const MarkdownTextImpl = () => { {...props} /> ), + code(props) { + const { children, className, node, ref, ...rest } = props; + const match = /language-(\w+)/.exec(className || "")?.[1]; + return ( + <> +
+

{match}

+
+ + {children} + + + ); + }, }} /> );