Skip to content

Commit ffce589

Browse files
committed
Build text and title references and live examples from authored rows
1 parent 69c3e2b commit ffce589

19 files changed

Lines changed: 368 additions & 142 deletions

‎examples/official-site/README.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ Function pages in `content/functions/` use their filename as the public function
4444
name. Keep the argument list in signature order and mark mandatory arguments with
4545
`required: true`. The Markdown body can include SQL examples without escaping.
4646

47+
## Component reference
48+
49+
Component pages in `content/components/` list parameters under `top` and `row`.
50+
Each `examples/*.md` file can contain `rows` in its YAML metadata. These rows
51+
drive both the live preview and the copyable SQL. The Markdown body is the
52+
example caption. Use numbered filenames to keep the examples in order.
53+
References that have not moved still come from the SQL migrations.
54+
4755
## Landing page
4856

4957
The home page is rendered by `index.sql` and the `landing-page` custom template.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
icon: align-left
3+
category: page-layout
4+
summary: Write paragraphs using plain text or Markdown.
5+
top:
6+
- name: article
7+
type: BOOLEAN
8+
description: Makes long texts more readable by increasing the line height, adding margins, using a serif
9+
font, and decorating the initial letter.
10+
- name: center
11+
type: BOOLEAN
12+
description: Whether to center the title.
13+
- name: contents
14+
type: TEXT
15+
description: A top-level paragraph of text to display, without any formatting, without having to make additional
16+
queries.
17+
- name: contents_md
18+
type: TEXT
19+
description: Rich text in the markdown format. Among others, this allows you to write bold text using `**bold**`,
20+
italics using `*italics*`, and links using `[text](https://example.com)`.
21+
- name: html
22+
type: TEXT
23+
description: Raw html code to include on the page. Don't use that if you are not sure what you are doing,
24+
it may have security implications.
25+
- id
26+
- name: title
27+
type: TEXT
28+
description: Text header before the paragraph.
29+
- name: unsafe_contents_md
30+
type: TEXT
31+
description: Markdown format with html blocks. Use this only with trusted content. See the html-blocks
32+
section of the Commonmark spec for additional info.
33+
row:
34+
- name: bold
35+
type: BOOLEAN
36+
description: Whether the span of text should be displayed as bold.
37+
- name: break
38+
type: BOOLEAN
39+
description: Indicates that the current span of text starts a new paragraph.
40+
- name: code
41+
type: BOOLEAN
42+
description: Use a monospace font. Useful to display the text as code.
43+
- name: color
44+
type: COLOR
45+
description: The name of a color for this span of text.
46+
- name: contents
47+
type: TEXT
48+
required: true
49+
description: A span of text to display
50+
- name: contents_md
51+
type: TEXT
52+
description: Rich text in the markdown format. Among others, this allows you to write bold text using `**bold**`,
53+
italics using `*italics*`, and links using `[text](https://example.com)`.
54+
- name: italics
55+
type: BOOLEAN
56+
description: Whether the span of text should be displayed as italics.
57+
- name: link
58+
type: URL
59+
description: An URL to which the user should be taken when they click on this span of text.
60+
- name: size
61+
type: INTEGER
62+
description: A number between 1 and 6 indicating the font size.
63+
- name: underline
64+
type: BOOLEAN
65+
description: Whether the span of text should be underlined.
66+
- name: unsafe_contents_md
67+
type: TEXT
68+
description: Markdown format with html blocks. Use this only with trusted content. See the html-blocks
69+
section of the Commonmark spec for additional info.
70+
---
71+
72+
A paragraph of text. The entire component will render as a single paragraph, with each item being rendered as a span of text inside it, the styling of which can be customized using parameters.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
rows:
3+
- component: text
4+
contents: Hello, world ! <3
5+
---
6+
7+
Rendering a simple text paragraph.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
rows:
3+
- component: text
4+
article: true
5+
contents_md: |+
6+
7+
# Markdown in SQLPage
8+
9+
## Simple formatting
10+
11+
SQLPage supports only plain text as column values, but markdown allows easily adding **bold**, *italics*, [external links](https://github.com/sqlpage/SQLPage), [links to other pages](/index.sql) and [intra-page links](#my-paragraph).
12+
13+
## Lists
14+
### Unordered lists
15+
* SQLPage is easy
16+
* SQLPage is fun
17+
* SQLPage is free
18+
19+
### Ordered lists
20+
1. SQLPage is fast
21+
2. SQLPage is safe
22+
3. SQLPage is open-source
23+
24+
## Code
25+
```sql
26+
SELECT 'list' AS component;
27+
SELECT name as title FROM users;
28+
```
29+
30+
## Tables
31+
32+
| SQLPage component | Description | Documentation link |
33+
| --- | --- | --- |
34+
| text | A paragraph of text. | [Documentation](https://sql-page.com/documentation.sql?component=text) |
35+
| list | A list of items. | [Documentation](https://sql-page.com/documentation.sql?component=list) |
36+
| steps | A progress indicator. | [Documentation](https://sql-page.com/documentation.sql?component=steps) |
37+
| form | A series of input fields. | [Documentation](https://sql-page.com/documentation.sql?component=form) |
38+
39+
## Quotes
40+
> Fantastic.
41+
>
42+
> — [HackerNews User](https://news.ycombinator.com/item?id=36194473#36209061) about SQLPage
43+
44+
## Images
45+
![SQLPage logo](https://sql-page.com/favicon.ico)
46+
47+
## Horizontal rules
48+
---
49+
50+
---
51+
52+
Rendering rich text using markdown
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
rows:
3+
- component: text
4+
title: About SQL
5+
- contents: SQL
6+
bold: true
7+
italics: true
8+
- contents: ' is a domain-specific language used in programming and designed for managing data held in a '
9+
- contents: relational database management system
10+
link: https://en.wikipedia.org/wiki/Relational_database
11+
- contents: . It is particularly useful in handling structured data.
12+
---
13+
14+
Rendering a paragraph with links and styling.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
rows:
3+
- component: text
4+
contents_md: This is a link to the [next paragraph](#my-paragraph). You can open this link in a new tab
5+
and the page will scroll to the paragraph on load.
6+
- component: text
7+
id: my-paragraph
8+
contents_md: This **is** the next paragraph.
9+
---
10+
11+
An intra-page link to a section of the page.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
icon: letter-case-upper
3+
since: 0.19.0
4+
category: page-layout
5+
summary: Add a heading and choose its level.
6+
top:
7+
- name: center
8+
type: BOOLEAN
9+
description: Whether to center the title.
10+
- class
11+
- name: contents
12+
type: TEXT
13+
required: true
14+
description: A text to display.
15+
- id
16+
- name: level
17+
type: INTEGER
18+
description: Set the heading level (default level is 1)
19+
---
20+
21+
`level` sets the HTML heading (`h1` through `h6`). Use level 1 for the page title, level 2 for sections, and level 3 for subsections so readers can navigate by heading.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
rows:
3+
- component: title
4+
contents: Level 1
5+
- component: title
6+
contents: Level 2
7+
level: 2
8+
- component: title
9+
contents: Level 3
10+
level: 3
11+
---
12+
13+
Displays several titles with different levels.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
rows:
3+
- component: title
4+
contents: Level 1
5+
center: true
6+
---
7+
8+
Displays a centered title.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
id:
2+
name: id
3+
type: TEXT
4+
description: id attribute added to the container in HTML. It can be used to target this item through css
5+
or for scrolling to this item through links (use "#id" in link url).
6+
class:
7+
name: class
8+
type: TEXT
9+
description: class attribute added to the container in HTML. It can be used to apply custom styling to this
10+
item through css. Added in v0.18.0.

0 commit comments

Comments
 (0)