mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-04 20:57:17 +02:00
* add validation for blog plugin * fix wrong default component * fix test and add yup to package.json * remove console.log * add validation for classic theme and code block theme * add yup to packages * remove console.log * fix build * fix logo required * replaced yup with joi * fix test * remove hapi from docusuars core * replace joi with @hapi/joi * fix eslint * fix remark plugin type * change remark plugin validation to match documentation * move schema to it's own file * allow unknown only on outer theme object * fix type for schema type * fix yarn.lock * support both commonjs and ES modules * add docs for new lifecycle method |
||
---|---|---|
.. | ||
src | ||
package.json | ||
README.md |
Docusaurus 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>
);
}
```