Content
You are here:
Code snippet formatting not working
Added by Jason Culligan about 5 years ago
If I use the code snippet and add say Python and I change the format type by manually typing 'python', the formatting in the editor autoformats. But when I save and review it the formatting it gone and it's just all black text. No python formatting.
Questions:
- How to fix this?
- What formatting types can be entered?
- Why isn't there a selector to show which formats are available instead of assuming the end user knows exactly which languages are supported and what exactly to type?
- Am I doing it all wrong?
Replies (1)
Hi Jason,
this is due to CKEditor not yet providing a WYSIWYG code block. We added a custom widget that is based on
codemirror
that allows dynamically loading syntax and highlight modes from these values here: https://github.com/codemirror/CodeMirror/tree/master/modeHighlight will thus only work within the codemirror editor (double click the widget in CKEditor to open the editor modal again), and when you save the page. This widget is only meant as a workaround until CKEditor provides their own code block implementation: https://github.com/ckeditor/ckeditor5/issues/436
There is of course lots of room for improvements, it's not our topmost priority at the moment since hopefully, CKEditor5 will provide the correct solution.
```ruby\n....
Best,
Oliver