Skip to content

Commit 18f0687

Browse files
authored
Merge branch 'main' into main
2 parents 4f01c40 + fe363ad commit 18f0687

File tree

300 files changed

+15913
-2790
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

300 files changed

+15913
-2790
lines changed

public/reference/data.json

Lines changed: 7775 additions & 2418 deletions
Large diffs are not rendered by default.

public/search-indices/en.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

public/search-indices/es.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

public/search-indices/hi.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

public/search-indices/ko.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

public/search-indices/zh-Hans.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/content/contributor-docs/en/creating_libraries.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ p5.prototype.myMethod = function(){
302302

303303
**Contributed libraries are hosted, documented, and maintained by their creators.** This could be on GitHub, a separate website, or elsewhere. We only feature addon libraries that are fully open source.
304304

305-
**Documentation is key!** The documentation for your library should be easy to find. The documentation for contributed libraries won’t be included in the main p5.js reference, but you may want to follow a similar format. See these examples of a [library overview page](http://p5js.org/reference/#/libraries/p5.sound), [class overview page](http://p5js.org/reference/#/p5.Vector), and [method page](http://p5js.org/reference/#/p5/arc/).
305+
**Documentation is key!** The documentation for your library should be easy to find. The documentation for contributed libraries won’t be included in the main p5.js reference, but you may want to follow a similar format. See these examples of a [library overview page](https://p5js.org/reference/p5.sound), [class overview page](https://p5js.org/reference/p5/p5.Vector), and [method page](https://p5js.org/reference/p5/arc/).
306306

307307
**Examples are great, too!** They show people what your library can do. Because this is all JavaScript, people can see them running online before they download anything.[ ](http://jsfiddle.net/) You can create a collection of examples on the p5.js web editor to showcase how your library works.
308308

src/content/contributor-docs/en/friendly_error_system.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Here, the key is `greeting`, and the variable name is `who`.
106106

107107
To dynamically generate this message, we will need to pass a value:
108108

109-
```JavaScript
109+
```javascript
110110
translator('greeting', { who: 'everyone' } );
111111
```
112112

@@ -124,7 +124,7 @@ Here is an item from `fes`'s `fileLoadError` that demonstrates interpolation:
124124

125125
To dynamically generate the final message, the FES will call `translator()` with the key and a pre-generated `suggestion` value.
126126

127-
```JavaScript
127+
```javascript
128128
translator('fes.fileLoadError.image', { suggestion });
129129
```
130130

@@ -177,7 +177,7 @@ For full reference, please see our [Dev Notes].
177177

178178
`fes_core.js/_friendlyError()` prints generated friendly error messages in the console. For example:
179179

180-
```JavaScript
180+
```javascript
181181
p5._friendlyError(
182182
translator('fes.globalErrors.type.notfunc', translationObj)
183183
);
@@ -193,7 +193,7 @@ There may be cases where you want to [disable the FES for performance].
193193

194194
Example:
195195

196-
```JavaScript
196+
```javascript
197197
p5.disableFriendlyErrors = true;
198198

199199
function setup() {

src/content/contributor-docs/en/how-to-add-friendly-error-messages.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ In the example above, anything in double angle brackets (`{{}}`) is something th
186186

187187
After adding your case, you can now call `p5._friendlyFileLoadError([case number], [file path])` inside your error handling statements.
188188

189-
For example, please take a look at `loadStrings()` method loading a string-based file (which corresponds to `case 3` from `fileLoadErrorCases`). The  `loadStrings()` method uses [`httpDo.call()`](https://p5js.org/reference/#/p5/httpDo/) with a custom callback method that is executed in the case of a file error:
189+
For example, please take a look at `loadStrings()` method loading a string-based file (which corresponds to `case 3` from `fileLoadErrorCases`). The  `loadStrings()` method uses [`httpDo.call()`](https://p5js.org/reference/p5/httpDo/) with a custom callback method that is executed in the case of a file error:
190190

191191
```js
192192
p5.prototype.httpDo.call(

src/content/contributor-docs/zh-Hans/fes_reference_dev_notes.mdx

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ description: >
3737

3838
##### 语法
3939

40-
```JavaScript
40+
```javascript
4141
_report(message)
4242
```
4343

44-
```JavaScript
44+
```javascript
4545
_report(message, func)
4646
```
4747

48-
```JavaScript
48+
```javascript
4949
_report(message, func, color)
5050
```
5151

@@ -89,15 +89,15 @@ _friendlyError
8989

9090
##### 语法
9191

92-
```JavaScript
92+
```javascript
9393
_friendlyError(message)
9494
```
9595

96-
```JavaScript
96+
```javascript
9797
_friendlyError(message, func)
9898
```
9999

100-
```JavaScript
100+
```javascript
101101
_friendlyError(message, func, color)
102102
```
103103

@@ -144,7 +144,7 @@ _friendlyFileLoadError
144144

145145
##### 语法
146146

147-
```JavaScript
147+
```javascript
148148
_friendlyFileLoadError(errorType, filePath)
149149
```
150150

@@ -159,7 +159,7 @@ _friendlyFileLoadError(errorType, filePath)
159159

160160
<ins>文件加载错误示例</ins>
161161

162-
```JavaScript
162+
```javascript
163163
/// missing font file
164164
let myFont;
165165
function preload() {
@@ -244,7 +244,7 @@ validateParameters
244244

245245
##### 语法
246246

247-
```JavaScript
247+
```javascript
248248
_validateParameters(func, args)
249249
```
250250

@@ -259,7 +259,7 @@ _validateParameters(func, args)
259259

260260
<ins>缺少参数的示例</ins>
261261

262-
```JavaScript
262+
```javascript
263263
arc(1, 1, 10.5, 10);
264264
```
265265

@@ -271,7 +271,7 @@ FES将在控制台生成以下消息:
271271
272272
<ins>类型不匹配的示例</ins>
273273

274-
```JavaScript
274+
```javascript
275275
arc('1', 1, 10.5, 10, 0, Math.PI, 'pie');
276276
```
277277

@@ -323,7 +323,7 @@ try { someCode(); } catch(err) { p5._fesErrorMonitor(err); }
323323

324324
##### 语法
325325

326-
```JavaScript
326+
```javascript
327327
fesErrorMonitor(event)
328328
```
329329

@@ -337,7 +337,7 @@ fesErrorMonitor(event)
337337

338338
<ins>内部错误示例 1</ins>
339339

340-
```JavaScript
340+
```javascript
341341
function preload() {
342342
// 由于在preload中调用background()而引发
343343
// 错误
@@ -351,7 +351,7 @@ FES将在控制台中生成以下消息:
351351
352352
<ins>内部错误示例 2</ins>
353353

354-
```JavaScript
354+
```javascript
355355
function setup() {
356356
cnv = createCanvas(200, 200);
357357
cnv.mouseClicked();
@@ -364,7 +364,7 @@ FES将在控制台中生成以下消息:
364364
365365
<ins>用户示例中的作用域错误示例</ins>
366366

367-
```JavaScript
367+
```javascript
368368
function setup() {
369369
let b = 1;
370370
}
@@ -379,7 +379,7 @@ FES将在控制台中生成以下消息:
379379
380380
<ins>用户示例中的拼写错误示例</ins>
381381

382-
```JavaScript
382+
```javascript
383383
function setup() {
384384
colour(1, 2, 3);
385385
}
@@ -414,7 +414,7 @@ core/friendly\_errors/fes\_core.js
414414

415415
<ins>重新定义 p5.js 保留常量的示例</ins>
416416

417-
```JavaScript
417+
```javascript
418418
function setup() {
419419
// PI 是 p5.js 的保留常量
420420
let PI = 100;
@@ -427,7 +427,7 @@ FES 将在控制台生成以下消息:
427427
428428
<ins>重新定义 p5.js 保留函数的示例</ins>
429429

430-
```JavaScript
430+
```javascript
431431
function setup() {
432432
// text 是 p5.js 的保留函数
433433
let text = 100;
@@ -452,7 +452,7 @@ core/friendly\_errors/sketch\_reader.js
452452

453453
##### 语法
454454

455-
```JavaScript
455+
```javascript
456456
checkForUserDefinedFunctions(context)
457457
```
458458

@@ -465,7 +465,7 @@ checkForUserDefinedFunctions(context)
465465

466466
##### 示例
467467

468-
```JavaScript
468+
```javascript
469469
function preLoad() {
470470
loadImage('myimage.png');
471471
}
@@ -538,7 +538,7 @@ p5.newObject = function(parameter) {
538538

539539
您可以在代码的顶部添加一行代码来禁用此功能:
540540

541-
```JavaScript
541+
```javascript
542542
p5.disableFriendlyErrors = true; // 禁用 FES
543543

544544
function setup() {
@@ -556,7 +556,7 @@ function draw() {
556556

557557
* FES 可能仍然会导致假阴性的情况。这通常是由于设计与实际使用情况之间的不匹配而导致的(例如,绘图函数最初设计用于在 2D 和 3D 设置中可以互换使用),例如:
558558

559-
```JavaScript
559+
```javascript
560560
const x3; // 未定义
561561
line(0, 0, 100, 100, x3, Math.PI);
562562
```
@@ -587,7 +587,7 @@ line(0, 0, 100, 100, x3, Math.PI);
587587

588588
* `sketch_reader.js` 可以扩展,可以添加新功能(例如:当用户在 `draw()` 函数中声明变量时向用户发出警告)。以更好地帮助用户。
589589

590-
```JavaScript
590+
```javascript
591591
// 这段代码片段使用新函数包装了 window.console 方法,以修改其功能
592592
// 目前尚未实现,但可以使用它来提供更好格式的错误消息
593593
const original = window.console;

0 commit comments

Comments
 (0)