diff --git a/demos/src/Nodes/CodeBlockLowlight/React/index.jsx b/demos/src/Nodes/CodeBlockLowlight/React/index.jsx index 2d5a4e0ff8..2f131dd350 100644 --- a/demos/src/Nodes/CodeBlockLowlight/React/index.jsx +++ b/demos/src/Nodes/CodeBlockLowlight/React/index.jsx @@ -13,15 +13,26 @@ import html from 'highlight.js/lib/languages/xml' import { all, createLowlight } from 'lowlight' import React from 'react' -// create a lowlight instance +// create a lowlight instance with all languages loaded const lowlight = createLowlight(all) -// you can also register languages +// This is only an example, all supported languages are already loaded above +// but you can also register only specific languages to reduce bundle-size lowlight.register('html', html) lowlight.register('css', css) lowlight.register('js', js) lowlight.register('ts', ts) +/** + * Lowlight version 2.x had a different API + * import { lowlight } from 'lowlight' + * + * lowlight.registerLanguage('html', html) + * lowlight.registerLanguage('css', css) + * lowlight.registerLanguage('js', js) + * lowlight.registerLanguage('ts', ts) + */ + export default () => { const editor = useEditor({ extensions: [