---
title: "code-along: a guide in steps beside an editor and a live preview"
resources:
  - url: https://github.com/vite-hub/drop/pull/269
    title: "PR #269"
---

Each page is `node skills/code-along/scripts/build.mjs <lesson>.md <lesson>.html`, opened in headless Chromium at 1440x900, light, 2x.

## A step opens on the file its guide links to first.

::screenshot{src="https://drop.vitehub.dev/f/4bdb241b-f36d-4e07-966b-2ed8b4877d90.png" alt="Plurals lesson at step 2: guide on the left, preview on top, file tree and editor below" viewport="1440x900"}
:::annotation{x=1.4 y=37 w=8.3 h=2.6 mark="none" side="bottom" at=20 to="9.7,38.3"}
The guide links messages.js first…
:::

:::annotation{x=41.2 y=41.4 w=9.2 h=1.9 mark="none" side="top" at=58 to="50.4,42.3"}
…so the step opens on it.
:::

:::annotation{x=38.6 y=51.6 w=0.9 h=5.6 mark="bracket" side="bottom" at=50}
Dots mark the files this step writes.
:::

Step 2 of 3 of a code-with-me lesson. The preview reruns the step's files, and the guide asks for a fix in messages.js.
::

## Edits rerun the preview and stay until Reset.

::screenshot{src="https://drop.vitehub.dev/f/a939fc3f-c09b-454e-b278-be1881ec42de.png" alt="Split the bill prototype after adding a fourth person in people.js" viewport="1440x900"}
:::annotation{x=18 y=55.1 w=17 h=2.4 mark="none" side="bottom" at=40 to="35,56.3"}
A fourth person typed into people.js…
:::

:::annotation{x=24.6 y=35.8 w=25 h=4.3 mark="none" side="top" at=62 to="49.6,38"}
…shows up in the preview as you type.
:::

:::annotation{x=13 y=55.4 w=0.5 h=1.6 mark="none" side="bottom" at=12 to="13.2,57"}
The tree marks the edit; Reset brings the step back.
:::

A one-step prototype with the guide on the right, so the page hides the step controls.
::

## A lesson without index.html shows the code with no preview.

::screenshot{src="https://drop.vitehub.dev/f/5de9e210-21ab-4f7a-80c2-30b12d6ef489.png" alt="Lesson about Drop's HTML middleware at step 2: guide with a table, editor filling the right side" viewport="1440x900"}
:::annotation{x=40.3 y=1 w=59 h=98 mark="none" side="top" at=85 to="75,45"}
No index.html, so the editor takes the preview's place.
:::

:::annotation{x=1.4 y=71.1 w=22.6 h=4.8 mark="none" side="bottom" at=35 to="12.7,75.9"}
Tables, callouts and folded answers work as on GitHub.
:::

A lesson on a codebase: real code cut to the lines the step explains.
::

## Publishing a lesson no longer warns about paths inside its Markdown.

The lesson sits in the page as a `text/markdown` script, and the link check read its file paths as missing files of the app.

::diff{file="shared/project-bundle.ts" line=229 label="Skip scripts of a data type in the link check"}
```ts
      const html = text.replace(/<!--[\s\S]*?-->/g, "")
```
```ts
      const html = text
        .replace(/<!--[\s\S]*?-->/g, "")
        .replace(/<script\b[^>]*\btype=["']?([^"'\s>]+)[^>]*>[\s\S]*?<\/script>/gi, (tag, type: string) =>
          /^(?:module|importmap|(?:text|application)\/(?:java|ecma)script)$/i.test(type) ? tag : "",
        )
```
::
