Skip to content

Fix escaped characters in inline examples + instance mode examples #897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2025

Conversation

davepagurek
Copy link
Collaborator

While working on processing/p5.js#7961, I noticed the following issues:

  • Interleaved reference examples were coming in with escaped html, e.g. () => { ... } as () => { ... }, and weren't working
  • Examples using instance mode weren't working because they were being executed before p5 gets injected into the example

This addresses those two issues:

  • Example code is run through _.unescape first
  • Instance mode is detected via the existence of new p5 in the code, and if so, disables p5 code injection, and goes back to the slightly-less-efficient but more predictable mode that just uses <script> tags

@davepagurek davepagurek merged commit a142774 into 2.0 Jul 10, 2025
4 checks passed
@davepagurek davepagurek deleted the fix/inline-examples-instance branch July 10, 2025 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant