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:
@@ -11,16 +11,24 @@ in the Reference.
|
||||
|
||||
## Create a table (simple mode)
|
||||
|
||||
Every table is created with its primary key. The `with pk` clause lists the
|
||||
primary-key column(s):
|
||||
The simplest way to create a table is `with pk` on its own — it gives the
|
||||
table a ready-made primary-key column named `id` that the database fills in
|
||||
for you:
|
||||
|
||||
```text
|
||||
```rdbms
|
||||
create table authors with pk
|
||||
```
|
||||
|
||||
Prefer to name the key, or give it a specific type? Name it in the `with pk`
|
||||
clause:
|
||||
|
||||
```rdbms
|
||||
create table authors with pk author_id(serial)
|
||||
```
|
||||
|
||||
Other columns are added afterwards with `add column`:
|
||||
Either way, the rest of the columns are added afterwards with `add column`:
|
||||
|
||||
```text
|
||||
```rdbms
|
||||
add column to authors: name (text)
|
||||
add column to authors: birth_year (int)
|
||||
```
|
||||
@@ -30,14 +38,14 @@ add column to authors: birth_year (int)
|
||||
To make the primary key span more than one column, list them, comma
|
||||
separated:
|
||||
|
||||
```text
|
||||
```rdbms
|
||||
create table loans with pk book_id(int), member_id(int)
|
||||
```
|
||||
|
||||
**Syntax**
|
||||
|
||||
```text
|
||||
create table <Name> with pk <col>(<type>)[, ...]
|
||||
```rdbms-syntax
|
||||
create table <Name> with pk [<col>(<type>)[, ...]]
|
||||
```
|
||||
|
||||
## Create a table (advanced mode)
|
||||
@@ -58,13 +66,13 @@ keys — see the Constraints and Relationships references.
|
||||
|
||||
**Syntax**
|
||||
|
||||
```text
|
||||
```rdbms-syntax
|
||||
create table [if not exists] <Name> (<col> <type> [constraints], ...)
|
||||
```
|
||||
|
||||
## Drop a table
|
||||
|
||||
```text
|
||||
```rdbms
|
||||
drop table authors
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user