Skip to content

Fix: example.js stores defaultHTML function reference instead of calling it, causing examples to display raw JavaScript source in preview #4344

Open

Description

@syedbarkath980

p5.js version

v18.20.8

What is your operating system?

Windows

Web browser and version

Brave1.96.61 Chromium: 154.0.8037.98 (Official Build) (64-bit)

Actual Behavior

Bug Description

When running npm run fetch-examples locally, opening any example sketch
shows raw JavaScript function source code in the preview panel instead of
rendering a proper HTML page.

The preview panel displays raw JavaScript function source code:

Image

Expected Behavior

The preview panel renders a proper HTML page that runs the p5.js sketch.

Image

Steps to Reproduce:

  1. Clone the repository and complete manual installation
  2. Run npm run fetch-examples
  3. Start the server with npm start
  4. Open any example sketch from File → Examples
  5. Observe the preview panel
improper.HTML.rendered.Before.Fix.mp4

Activity

  1. syedbarkath980 commented on Oct 4, 2026

    @syedbarkath980
    Author

    Hi maintainers, I discovered and reported this bug while setting up
    the project locally as a new contributor. I have already identified
    the root cause and the fix is a one-line.

    Could I be assigned to this issue so I can submit the PR?

  2. doradocodes commented on Oct 30, 2026

    @doradocodes
    Collaborator

    I was also able to reproduce this issue locally. @syedbarkath980 you are welcome to investigate and submit a PR. I will assign the issue to you.

  3. syedbarkath980 commented on Oct 30, 2026

    @syedbarkath980
    Author

    Hi @doradocodes i have opened the PR: #4395 please review it. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugError or unexpected behaviors

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions