mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-10 14:52:29 +02:00
fix(v2): make code blocks more standalone (#4315)
* refactor(v2): make code blocks styles standalone * Rework * Revert font size in playground headers Co-authored-by: slorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
0383dd1496
commit
a4b409c93b
8 changed files with 120 additions and 65 deletions
|
@ -128,3 +128,62 @@ function Demo() {
|
|||
return null;
|
||||
}
|
||||
```
|
||||
|
||||
## Code block test
|
||||
|
||||
```js title="Title"
|
||||
function Clock(props) {
|
||||
const [date, setDate] = useState(new Date());
|
||||
useEffect(() => {
|
||||
var timerID = setInterval(() => tick(), 1000);
|
||||
|
||||
return function cleanup() {
|
||||
clearInterval(timerID);
|
||||
};
|
||||
});
|
||||
|
||||
function tick() {
|
||||
setDate(new Date());
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h2>It is {date.toLocaleTimeString()}.</h2>
|
||||
// highlight-start
|
||||
{/* prettier-ignore */}
|
||||
long long long long long long long long long long long long line
|
||||
{/* prettier-ignore */}
|
||||
// highlight-end
|
||||
</div>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
```jsx live
|
||||
function Clock(props) {
|
||||
const [date, setDate] = useState(new Date());
|
||||
useEffect(() => {
|
||||
var timerID = setInterval(() => tick(), 1000);
|
||||
|
||||
return function cleanup() {
|
||||
clearInterval(timerID);
|
||||
};
|
||||
});
|
||||
|
||||
function tick() {
|
||||
setDate(new Date());
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h2>It is {date.toLocaleTimeString()}.</h2>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
<CodeBlock className="language-yaml" title="test">
|
||||
test
|
||||
</CodeBlock>
|
||||
|
||||
<code>test</code>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue