Code blocks
When authoring markdown using the Carbon Gatsby theme, code blocks have some extra super powers you can take advantage of. We provide carbon-themed syntax highlighting as well as optional
path
src
hideCode
Example
Horizontal overflowVertical overflow## Path and src w/ overflowThis example overflows to demonstrate the text fading out under the side bar.This example overflows to demonstrate the text fading out under the side bar.This example overflows to demonstrate the text fading out under the side bar.This example overflows to demonstrate the text fading out under the side bar.
## Path, src, hideCode w/ overflowThis example demonstrates the show more button. This example demonstrates theshow more button. This example demonstrates the show more button. This exampledemonstrates the show more button. This example demonstrates the show morebutton. This example demonstrates the show more button. This exampledemonstrates the show more button. This example demonstrates the show morebutton. This example demonstrates the show more button. This exampledemonstrates the show more button. This example demonstrates the show morebutton. This example demonstrates the show more button. This exampledemonstrates the show more button. This example demonstrates the show morebutton. This example demonstrates the show more button. This exampledemonstrates the show more button. This example demonstrates the show morebutton.
Code
```markdown path=/directory/file.mdx src=https://gatsby.carbondesignsystem.com hideCode=true### Path, src and hideCodeThis code snippet provides a `path`, a `src` and `hideCode` prop.```
Props
property | propType | description |
---|---|---|
language | string | Available languages. |
src | string | The full url of a relevant link (source) |
path | string | A string indicating the filename or path. Due to markdown limitations this can only be a single word |
hideCode | boolean | A boolean indicating if the code block should have a Show More button. Code block should have more than 9 lines to display the button. Default value =
|