Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Code-Area] code blocks with highlighted languages #2414

Open
VeejaLiu opened this issue Aug 15, 2024 · 4 comments
Open

[Code-Area] code blocks with highlighted languages #2414

VeejaLiu opened this issue Aug 15, 2024 · 4 comments
Assignees
Labels
feature request Request new feature

Comments

@VeejaLiu
Copy link

Can we use code blocks that recognize highlighted languages like in Coze? I checked the documentation but couldn't find any related tags.
image

Do we have plans for this? Or is there an easy way to implement it now?

@VeejaLiu VeejaLiu added the feature request Request new feature label Aug 15, 2024
@DaiQiangReal
Copy link
Collaborator

This first demo?
image
What you want?

@VeejaLiu
Copy link
Author

Oh, I haven’t looked at the documentation under Chat.
But I want to know how to create a code box like this that includes syntax highlighting, language type indication, and a copy button.
I don’t want a chat box, but I would like a code box like this. Can this be achieved using the CodeHighlight component? Or is there an easier way to achieve the same effect? It seems that using CodeHighlight requires additional setup similar to Prism.js, which looks a bit complicated.
But the demo, It seems only used simple Markdown to achieve.

image

@DaiQiangReal
Copy link
Collaborator

Add language indicator and copy button function yourself by wrapping CodeHighlight component with your own div and css. Highlight different code language by importing extra prismJS language plugin following https://semi.design/en-US/plus/codehighlight#Support%20other%20languages

@VeejaLiu
Copy link
Author

Okay...
Thank you for your reply. Although this is different from what I expected, I don’t understand why the chat box component can achieve this effect so simply. But still, thank you for your response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request new feature
Projects
None yet
Development

No branches or pull requests

2 participants