Add a "code block" component?
See original GitHub issueFeature request
Is your feature request related to a problem? Please describe.
It would be nice to have a component for longer blocks of code. It seems like right now there is only <Code>
which is for code mixed inline with text.
Describe the solution you’d like
Having something very similar to how the code blocks in the docs are formatted would be amazing.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:9
- Comments:9 (1 by maintainers)
Top Results From Across the Web
How to Add Syntax Highlighting to a Code Block in React
This article will show you how to use react-syntax-highlighter to highlight code blocks in React. You will create a code block component ......
Read more >rajinwonderland/react-code-blocks - GitHub
Initially, this started as a small project looking to modify Atlaskit's Code Block component to support more languages (i.e graphql , reasonml ,...
Read more >How to Build a Code Block Web Component
Build a code block web component that can be used on any page, is compatible with different frameworks and can be used by...
Read more >react-code-blocks - CodeSandbox
react-code-blocks. React components for rendering code snippets with syntax highlighting. code-snippet. highlightjs. remark. prismicjs. react-code-blocks.
Read more >Code block - Examples - Components
A code block highlights an entire block of code and keeps the formatting.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
What are the requirements for such component?
You can achieve the following result by adding 2 style props, although we could make a
variant
out of it:cc @ianstormtaylor @HarishJangra @gamegee @rohmanhm @yatish27
Are you sure? I just clicked on it and it seems to be working. Here’s a permalink: https://github.com/chakra-ui/chakra-ui-docs/blob/9f1b555eb87b82437f2754342b1d7cab5d8bf5e3/src/components/mdx-components/codeblock/codeblock.tsx