-
Notifications
You must be signed in to change notification settings - Fork 5
Description
I propose that the code block be highlighted on the frontend via server-side logic (as a dynamic block) instead of client-side logic (via enqueueing Prism.js). A couple key benefits are that this improves frontend performance and the syntax highlighting will be seen even when JS is disabled or when the content is served in AMP plugin. What's more, the Highlight.php library includes support for auto-detection of the language, so it would not be necessary to select the language and any existing code blocks could have syntax highlighting automatically added to them.
I've implemented server-side highlighting for a similar block in mkaz/code-syntax-block#13
It is also done in an extension for the SyntaxHighlighter plugin: https://github.com/xwp/syntaxhighlighter-amplified