(In the interest of troubleshooting, I tried switching to prism.js
, but that destroys all the newlines in my code for some reason, even after doing a reset…)
Not sure, but it sounds like the code escape setting is not enabled. When it’s not enabled, certain characters (like angle brackets) are not escaped, which would break code display, etc. Try enabling code escaping and try again should resolve the issue.
Enabling code-escaping seems to make everything display worse:
x = default_value<br />for key, values in dict_of_sets:<br /> for value in values:<br /> if predicate(key, value):<br /> x = value<br /> break # THIS BREAKS BOTH LOOPS!<br /> else:<br /> continue<br /> break
I don’t want to go back and change all the code blocks on my website to work with one specific highlighting plugin (in a way that will break if I ever change plugins or if Prismatic ever stops being maintained); I just want to highlight my existing, stock-wordpress-compatible code blocks.
(EDIT: I would consider going back and modifying all my code blocks iff it won’t screw them up in the event that I stop using this plugin; I’m not interested in being vendor-locked or putting myself in a position where I’ve got to do a bunch of chores before I can uninstall a plugin.)
-
This reply was modified 4 years, 1 month ago by
squeegily.
You shouldn’t have to change anything, this is some sort of bug of misconfiguration. Testing the code from your initial post:
x = default_value
for key, values in dict_of_sets:
for value in values:
if predicate(key, value):
x = value
break # THIS BREAKS BOTH LOOPS!
else:
continue
break
..results in no breakage, everything displays normally. Although it sounds like you also are adding some other code like angle brackets or something..? Help me to replicate the issue and I will be glad to investigate further.
…well, I still have no idea what it could be. 🙁
it sounds like you also are adding some other code like angle brackets or something..?
No, the <br>
tags must have been created by WordPress itself; I did not type any bracket characters into my code (and the posts display normally when escaping isn’t enabled in Prismatic)
⸻
However, even after I installed all the same themes and plugins (Suki, wpuntexturize, Classic Editor, Very Simple Meta Description, Customizer Reset, and Prismatic), I was still unable to reproduce on a demo site [https://faithful-jungle.jurassic.ninja/2021/05/09/hello-world/ user: demo, password: Z0doEEzeMQ6h], so I’m marking this as resolved.
If I ever figure out what’s causing it on my site, I’ll post the cause/solution here in this thread.
Okay thank you @squeegily.
If anybody else experiences this, here was the problem:
If you type code in a Paragraph, then paste it into a Code block, it will have <br />
tags for newlines, which confuses the Highlighting libraries. So you’ll have to go in and manually remove those to fix it (and now you know what not to do in the future, too.)
Thank you for sharing your solution, much appreciated @squeegily.