Next.js Discord

Discord Forum

Shiki Syntax Highlight

Answered
BakaPresident posted this in #help-forum
Open in Discord
Hi there, any idea how i can differentiate between code tags and code blocks.

Single backticks and triple backticks.
I want to have customized code components upon codeblocks but i want codetags to stay the same
Answered by B33fb0n3
yea, when you have your if statement then just ask:
if(myString === "``\`") // remove the '\'
  // is codeblock
else
  // is inline code
View full answer

15 Replies

Answer
ohh okayy
thanks
happy to help
@B33fb0n3 happy to help
Can i also check if i do
<Markdown components={{
    code(props) {
        const { children, className, node, ...rest } = props
        const match = /language-(\w+)/.exec(className || '')
        return match ? (
            <SyntaxHighlighter
                language={match[1]}
                style={docco}
                children={String(children)}
            />
        ) : (
            <code {...rest} className='border-2 rounded-md p-1'>
                {children}
            </code>
        )
    }
}}>
    {message.content}
</Markdown>

and
            typography: {
                DEFAULT: {
                    css: {
                        pre: false,
                        code: false
                    }
                }
            }

Why does my code still have the before
which caused something like
I think it's just a blog handlingn type of thing though
If u look at hello it doesn't have the backtickks for some reason
@BakaPresident Ohh okay i thought react markdown could render everything correct
yea it can. But "correct" is quite a big word. It could mean something to you and mean something different to me
@B33fb0n3 yea it can. But *"correct"* is quite a big word. It could mean something to you and mean something different to me
righttt for me i just wanted it to look right and all the bolded things / list and everything looks good to me
I'll just stick with this first and if i wanna edit later then i edit
doing this for a school work