processing / processing/p5.js-website

Refine the syntax section of the reference

Open
#384 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement
Dominant language
MDX
Stars
96
Forks
322
Avg merge
5d 22h
Merged PRs (30d)
8

Description

The syntax section of the reference could be clearer in a few places.

Methods

The reference pages for methods such as p5.Vector.add() display the following syntax:

add(x, [y], [z])

add(value)

add(v1, v2, [target])

It'd be helpful to demonstrate the dot operator, and to distinguish between instance and static methods. I suggest standardizing on p5.X.method() and myX.method(), as in:

myVector.add(x, [y], [z]);

myVector.add(value);

p5.Vector.add(v1, v2, [target]);

Side note: I'm not sure whether we should encourage copy/pasting syntax snippets.

Events and Structure

The reference pages for event functions such as doubleClicked() display the following syntax:

doubleClicked([event])

It'd be helpful to demonstrate that these functions are declared, not called, as in:

function doubleClicked([event]) {
  // Code to run.
}

🤦🏽‍♂️ I just noticed that the code snippets for these are broken and will make a pull request soon!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked p5.Vector.add() and doubleClicked() reference pages, then inspect how their syntax examples are produced. Done means method examples show instance and static forms with the dot operator, while event examples show declaration syntax rather than calls; resolve whether the snippets should be copyable as part of the same review.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.