How do I use the styles in tinyMCE to highlight the submitted code?

use Flask to do the blog, add a tinyMCE text editor, in the editing interface, the code can be highlighted:

clipboard.png

tinyMCE:

clipboard.png
I want to still use the style provided by tinyMCE to render the submitted page, which ensures that the display is the same before and after submission. No configuration was found. Front-end slag, light spray. Ask for help, how to solve it?

Mar.07,2021

this is due to the fact that render, does not introduce a corresponding css in the editor, so you need to introduce a code formatted css component, such as https://highlightjs.org/


originally thought that since the tinyMCE text editor comes with code rendering (the codesample), in the configuration should be able to render the submitted code quickly by configuring tinyMCE. After checking tinyMCE official website , it is found that js and css files need to be configured manually, and codesample uses the rendering program provided by http://prismjs.com/.

Menu