mirror of
https://github.com/facebook/docusaurus.git
synced 2026-05-07 00:09:44 -04:00
3f10bdc930
* v4.0.0
* bump package.json versions, mostly for canary release versioning
* use triple installs for supply chain workflow
* Revert "v4.0.0"
This reverts commit 8303548033.
* v3.10.1
* revert versioning docs
@docusaurus/theme-live-codeblock
You can create live code editors with a code block live meta string.
Install
npm i @docusaurus/theme-live-codeblock # or yarn add @docusaurus/theme-live-codeblock
Modify your docusaurus.config.js
module.exports = {
...
+ themes: ['@docusaurus/theme-live-codeblock'],
presets: ['@docusaurus/preset-classic']
...
}
Example:
```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>
);
}
```