Code blocks are used to display code snippets. The following languages are supported for syntax highlighting (via highlight.js):
html
css
js
ts
svelte
(fallback to html
)jsx
(fallback to html
)yaml
json
php
<CodeBlock language="html" code={code} />
<div class="container">
<h1>Hello World</h1>
</div>
.container {
display: flex;
justify-content: center;
align-items: center;
}
console.log('Hello World');
type User {
name: string;
age: number;
}
<script>
let name = 'World';
</script>
<h1>Hello {name}</h1>
function App() {
return (
<div>
<h1>Hello World</h1>
</div>
);
}
product: Hyvor Blogs
url: https://blogs.hyvor.com
plans:
- name: Starter
price: $9
- name: Growth
price: $19
{
"product": "Hyvor Blogs",
"url": "https://blogs.hyvor.com",
"plans": [
{
"name": "Starter",
"price": "$9"
},
{
"name": "Growth",
"price": "$19"
}
]
}
<?php
class World
{
public function hello(): void
{
echo 'Hello World';
}
}