Skip to content

Commit 328d625

Browse files
authored
Merge pull request #1153 from skyash-dev/docs/multiple-small-fixes-2.0
fix: multiple small documentation issues across tutorials and reference
2 parents 5d7e49e + 9ebae1a commit 328d625

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

src/components/PageHeader/RootPage.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const borderStyle = isFilterRoute ? "" : "border-b border-sidebar-type-color";
1212
---
1313

1414
<div
15-
class=`content-grid-simple min-h-[350px] h-[50vh] pt-[11.25rem] lg:pt-4xl bg-accent-color text-accent-type-color pb-md px-5 md:px-lg ${borderStyle}`
15+
class=`content-grid-simple min-h-[350px] pt-[11.25rem] lg:pt-4xl bg-accent-color text-accent-type-color pb-md px-5 md:px-lg ${borderStyle}`
1616
>
1717
<h1 class="whitespace-pre-line col-span-full mb-5">{title}</h1>
1818
<p class="text-h3 !mt-0 mb-3xl col-span-2">{subtitle}</p>

src/content/tutorials/en/conditionals-and-interactivity.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { Columns, Column } from "../../../components/Columns";
2323
import AnnotatedLine from "../../../components/AnnotatedLine/index.astro";
2424
import Video from "../../../components/Video/index.astro"
2525

26-
In this tutorial, you will learn new ways to add user interaction to your sketches, and control the order in which code runs.
26+
In this tutorial, you will learn new ways to add user interaction to your sketches, and control the order in which code runs.
2727

2828
You will learn these basic programming concepts by creating an [interactive sun](https://editor.p5js.org/gbenedis@gmail.com/sketches/nNVmHVf5m) sketch and a [sunrise animation](https://editor.p5js.org/gbenedis@gmail.com/sketches/9lz2aqfTO):
2929

@@ -524,7 +524,7 @@ function draw() {
524524

525525
  fill("green");
526526

527-
  rect(0, horizon, 400, 400);
527+
  rect(0, horizon, 400, 200);
528528

529529
}
530530
```
@@ -764,7 +764,7 @@ function draw() {
764764
    sunHeight -= 2;
765765
  }
766766

767-
  // increase color variables by 4 or 1 during sunrise
767+
  // increase color variables by 4 or 1 during sunrise
768768
  if (sunHeight < 480) {
769769
    redVal += 4;
770770
    greenVal += 1;

src/content/tutorials/en/repeating-with-loops.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ Above `setup()`:
199199
In `draw()`:
200200

201201
- After the code that draws the finish line, declare a new local variable `x` to position all the body segments: `let x = circX;`
202-
- Add a *for loop* using: `for (let i = 0; i < length; i += 1) { }`
202+
- Add a *for loop* using: `for (let i = 0; i < segments; i += 1) { }`
203203
- A *for loop* will repeat the code we write inside the curly brackets multiple times. 
204204
- Move the lines of code that draw the `circle()` into the curly brackets of the *for loop*.
205205
- After the for loop, add: `circX += spacing` 
@@ -936,7 +936,7 @@ function moveCaterpillars() {
936936
  for (let i = 0; i < numCaterpillars; i += 1) {
937937
    //Give each caterpillar a
938938
    //random speed.
939-
    move = random(5, 30);
939+
    let move = random(5, 30);
940940
    caterpillarEnds[i] += move;
941941
}
942942
}
@@ -1001,7 +1001,7 @@ function moveCaterpillars() {
10011001
  for (let i = 0; i < numCaterpillars; i += 1) {
10021002
    //Give each caterpillar a
10031003
    //random speed.
1004-
    move = random(5, 30);
1004+
    let move = random(5, 30);
10051005
10061006
    // Update caterpillars' x-coordinates
10071007
    caterpillarEnds[i] += move;
@@ -1356,7 +1356,7 @@ function drawCaterpillar(x, y, segments) {
13561356
function drawCaterpillars() {
13571357
  let padding = height / numCaterpillars;
13581358
  for (let i = 0; i < numCaterpillars; i += 1) {
1359-
    // Update each caterpillar x-coordinate  
1359+
    // Update each caterpillar x-coordinate  
13601360
    let y = (i + 0.5) * padding;
13611361
13621362
    // Update length of caterpillar.   
@@ -1379,7 +1379,7 @@ function moveCaterpillars() {
13791379
    // Give each caterpillar a random
13801380
    // speed once the race has started.
13811381
    let move = round(random(5, 30));
1382-
 
1382+
 
13831383
    // Update caterpillars' x-coordinates
13841384
    caterpillarEnds[i] += move;
13851385
  }

src/pages/_utils-node.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ export const removeNestedReferencePaths = (route: string): string =>
4545
route.replace(/types\//, "")
4646

4747
export const rewriteRelativeLink = (url: string): string => {
48-
let updatedUrl: string;
48+
let updatedUrl: string = url;
4949

50-
if (/^((https?:\/)?)\//.exec(url) || url.startsWith('mailto:')) {
51-
// Leave absolute paths alone
52-
updatedUrl = url;
53-
} else if (url.startsWith('#')) {
54-
// Leave links to headings alone
50+
if (/^(https?:|mailto:|\/\/)/.exec(url)) {
51+
// Skip rewriting for external URLs (http(s), mailto)
52+
return url;
53+
} else if (url.startsWith('#')||url.startsWith('/')) {
54+
// Skip rewriting for heading links and root-relative internal paths
5555
updatedUrl = url;
5656
} else {
5757
// Convert relative paths to '../' (because pages that started as files in the same directory
@@ -81,4 +81,4 @@ export const rewriteRelativeLink = (url: string): string => {
8181
}
8282

8383
return updatedUrl;
84-
};
84+
};

0 commit comments

Comments
 (0)