You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, we are using the Code Syntax Block for the Developer Blog, which extends the Core Code block. When setting a "Language" for this block in the editor, it adds <br> tags instead of \n within the code.
<br> tags are perfectly fine within <pre><code>. Nested HTML is valid here.
However, the plugin uses Prism.js, which strips HTML within code elements. And because the plugin is using <br> instead of \n, it behaves as there are no line breaks at all. So, on the front end, all the code is formatted into a single line.
Currently, we are using the Code Syntax Block for the Developer Blog, which extends the Core Code block. When setting a "Language" for this block in the editor, it adds
<br>
tags instead of\n
within the code.<br>
tags are perfectly fine within<pre><code>
. Nested HTML is valid here.However, the plugin uses Prism.js, which strips HTML within code elements. And because the plugin is using
<br>
instead of\n
, it behaves as there are no line breaks at all. So, on the front end, all the code is formatted into a single line.There is a "Keep Markup" JS extension that may also be a front-end fix for the plugin: https://prismjs.com/plugins/keep-markup/
What we've been doing:
We've had to manually search/replace
<br>
tags in the editor and replace them with\n
.Short-term fix:
We have a temporary solution for the plugin here: #61
Longer term:
We need a more robust solution that:
This could be forking the current plugin, submitting a patch to it, or picking another plugin (potentially needing to fix too).
Related history:
This initially became an issue when Gutenberg started adding
<br>
tags. However, this has now been addressed in Gutenberg: WordPress/gutenberg#59627The text was updated successfully, but these errors were encountered: