Replies: 4 comments
-
Reproduction is required. You need to use |
Beta Was this translation helpful? Give feedback.
-
Start with the HTML guide to keep elements in the pipeline Then also include a component renderer for |
Beta Was this translation helpful? Give feedback.
-
I tried but couldn't get a clear idea from |
Beta Was this translation helpful? Give feedback.
-
@amio The following is what I'm doing with my project. <Markdown
className="markdown"
rehypePlugins={validation ? [rehypeHighlight, rehypeRaw] : [rehypeHighlight]}
remarkPlugins={[remarkGfm]}
components={{
// @ts-ignore because
think: (data) => {
return data.children?.constructor == Array ? <Accordion title={stream ? "Thinking" : "Chain of thought"} content={data.children} loading={stream} initialOpen={stream} /> : <></> Validation is just a check for if the block is a valid // <think> this would be invaild </think>
/* <think> this is valid
</think>
*/ the closing tag needs to be on a new line. /**
* Adds a new line before the ending </customtag>
* */
export function formatCustomBlock(message: string, tagName: string): string {
const tag = `</${tagName}>`
let response = ""
if (!message.includes(tag)) response = message
else {
const position = message.indexOf(tag)
response = message.slice(0, position) + "\n" + message.slice(position)
}
return response
} Hope this helps! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to render
<think>...</think>
from an LLM response text, and I want to either:<blockquote>...</blockquote>
, or<think>...</think>
I've tried using
<Markdown allowedElements={['think']}>
and<Markdown components={{ think: () => {} }}>
, but neither worked as expected. Perhaps I didn't compose it correctly? Is there a way to achieve this?Beta Was this translation helpful? Give feedback.
All reactions