Closed lkp-k closed 2 weeks ago
Have u also set a css file for code lowlight? From my expereince, lowlight just adds classNames, therefore you should write css for your own. There are plenty of sites that provide highlight css file that you can use.
// your extensions
CodeBlockLowlight.configure({
lowlight: createLowlight(common),
}),
// lowlight.css
...
.hljs-variable,
.hljs-template-variable,
.hljs-attribute,
.hljs-tag,
.hljs-name,
.hljs-regexp,
.hljs-link,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class {
color: #f98181;
}
...
Thanks for chiming in @semanticist21 and helping out! That sounds like the right solution to me, so I'll close this. If there's still some problem that is specific to mui-tiptap, feel free to chime in again.
Describe the bug
I'm trying to get code syntax highlighting using https://tiptap.dev/docs/editor/extensions/nodes/code-block-lowlight
However, it seems not to work following the setup on the docs.
BTW I'm not sure why importing the ./styles.css doesn't work in codesandbox, but works fine locally. However, the colors are all washed and I'm wondering how I can get them to work with the styles you've already applied to the code block.
To Reproduce
https://codesandbox.io/p/devbox/mui-tiptap-demo-forked-czw63n
Steps to reproduce the behavior:
Expected behavior
Expecting the syntax highlight to work :(
Screenshots
System (please complete the following information)
mui-tiptap
version: 1.12.0@tiptap/react
version: 2.8.0@mui/material
: 6.1.2@mui/icons-material
version: 6.1.2extensions
array used for the editor:Additional context
Add any other context about the problem here.