feat: simple-mode code-block highlighting, prompt, and copy rules
Add a custom Shiki grammar for the simple-mode command language (src/grammars/rdbms.mjs), registered with Expressive Code. Two language ids share it: rdbms (real commands) and rdbms-syntax (abstract templates). Simple-mode blocks now highlight; advanced examples keep sql. Separation + copy ergonomics via CSS (global.css): a decorative, copy-safe "> " prompt on rdbms command lines (not in the copy buffer), and the copy button hidden on multi-command rdbms blocks and on rdbms-syntax templates (the app input is single-line, so a multi-command paste is not runnable); single-command, sql, and sh blocks keep copy. Content: convert 22 simple-mode fences to rdbms; lead the simplest examples (first project, Tables reference) with bare "with pk" (the beginner default that creates a ready-made id key), pointing to the named form. Record the fence + prompt conventions in STYLE.md.
This commit is contained in:
@@ -80,8 +80,25 @@ This is planned and not yet available.
|
||||
- Where both modes apply, show the **simple-mode** form and its
|
||||
**advanced-mode (SQL)** equivalent — the in-app teaching echo already
|
||||
pairs these, so docs mirror it.
|
||||
- Prefer **worked examples** (a real command on the library schema) over
|
||||
abstract prose, and **always cross-link** the related reference/guide
|
||||
pages (use stubs so links resolve before a page is written).
|
||||
- Code blocks for exact input/output; reserve casts for motion/flow.
|
||||
|
||||
### Code-block fences
|
||||
|
||||
- **Simple-mode commands → ` ```rdbms `** — custom highlight grammar in
|
||||
`src/grammars/rdbms.mjs`, registered with Expressive Code in
|
||||
`astro.config.mjs` (keywords + types coloured).
|
||||
- **Advanced-mode SQL → ` ```sql `**; shell / install → ` ```sh `.
|
||||
- A decorative `> ` prompt is prepended to `rdbms` lines via CSS
|
||||
(`src/styles/global.css`) — **do not type `>` in the fence**. It is
|
||||
copy-safe (Expressive Code's copy button uses `data-code`) and
|
||||
`user-select:none`.
|
||||
- **One command per line** in an `rdbms` block; a multi-line single
|
||||
statement (e.g. advanced `CREATE TABLE`) belongs in a ` ```sql ` block,
|
||||
where no prompt is added.
|
||||
|
||||
### Canonical library schema (source of truth for examples)
|
||||
|
||||
Use these exact names/types in every example:
|
||||
|
||||
Reference in New Issue
Block a user