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:
@@ -15,9 +15,13 @@ from scratch in simple mode: two tables, a relationship between them, and a
|
||||
few rows. By the end you will have used the create → add column → relate →
|
||||
insert → query loop end to end.
|
||||
|
||||
We give each table a **named** primary key (like `author_id`) so the
|
||||
relationship reads clearly — but `with pk` on its own gives you a default
|
||||
`id` if you prefer, as in [Your first project](/getting-started/first-project/).
|
||||
|
||||
## 1. Create the authors table
|
||||
|
||||
```text
|
||||
```rdbms
|
||||
create table authors with pk author_id(serial)
|
||||
add column to authors: name (text)
|
||||
add column to authors: birth_year (int)
|
||||
@@ -25,7 +29,7 @@ add column to authors: birth_year (int)
|
||||
|
||||
## 2. Create the books table
|
||||
|
||||
```text
|
||||
```rdbms
|
||||
create table books with pk book_id(serial)
|
||||
add column to books: title (text)
|
||||
add column to books: author_id (int)
|
||||
@@ -37,7 +41,7 @@ add column to books: published (int)
|
||||
An author has many books, so `books.author_id` should point at
|
||||
`authors.author_id`. Declare that one-to-many relationship:
|
||||
|
||||
```text
|
||||
```rdbms
|
||||
add 1:n relationship from authors.author_id to books.author_id
|
||||
```
|
||||
|
||||
@@ -48,7 +52,7 @@ the `books` side.
|
||||
|
||||
`author_id` and `book_id` are `serial`, so they fill themselves in:
|
||||
|
||||
```text
|
||||
```rdbms
|
||||
insert into authors (name, birth_year) values ('Ada Lovelace', 1815)
|
||||
insert into authors (name, birth_year) values ('Alan Turing', 1912)
|
||||
insert into books (title, author_id, published) values ('Notes on the Analytical Engine', 1, 1843)
|
||||
@@ -56,7 +60,7 @@ insert into books (title, author_id, published) values ('Notes on the Analytical
|
||||
|
||||
## 5. Look at your data
|
||||
|
||||
```text
|
||||
```rdbms
|
||||
show data authors
|
||||
show data books
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user