You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Cargo.toml
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
[package]
2
2
name = "sqlpage"
3
-
version = "0.6.6"
3
+
version = "0.6.7"
4
4
edition = "2021"
5
5
description = "A SQL-only web application framework. Takes .sql files and formats the query result using pre-made configurable professional-looking components."
6
6
keywords = ["web", "sql", "framework"]
@@ -39,6 +39,7 @@ async-trait = "0.1.61"
39
39
async-recursion = "1.0.0"
40
40
include_dir = "0.7.2"
41
41
config = { version = "0.13.3", features = ["json"] }
42
+
markdown = { version = "1.0.0-alpha.9", features = ["log"] }
Copy file name to clipboardExpand all lines: examples/official-site/sqlpage/migrations/01_documentation.sql
+53-1Lines changed: 53 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,7 @@ INSERT INTO parameter(component, name, description, type, top_level, optional) S
29
29
-- item level
30
30
('title', 'Name of the list item, displayed prominently.', 'TEXT', FALSE, FALSE),
31
31
('description', 'A description of the list item, displayed as greyed-out text.', 'TEXT', FALSE, TRUE),
32
+
('description_md', 'A description of the list item, displayed as greyed-out text, in Markdown format, allowing you to use rich text formatting, including **bold** and *italic* text.', 'TEXT', FALSE, TRUE),
32
33
('link', 'An URL to which the user should be taken when they click on the list item.', 'URL', FALSE, TRUE),
33
34
('icon', 'An icon name (from tabler-icons.io) to display on the left side of the item.', 'TEXT', FALSE, TRUE),
34
35
('color', 'The name of a color, to be displayed as a dot near the list item contents.', 'TEXT', FALSE, TRUE),
@@ -37,6 +38,11 @@ INSERT INTO parameter(component, name, description, type, top_level, optional) S
37
38
38
39
INSERT INTO example(component, description, properties) VALUES
39
40
('list', 'The most basic list', json('[{"component":"list"},{"title":"A"},{"title":"B"},{"title":"C"}]')),
41
+
('list', 'A list with rich text descriptions', json('[{"component":"list"},
42
+
{"title":"SQLPage", "description_md":"A **SQL**-based **page** generator for **PostgreSQL**, **MySQL**, and **SQLite**. [Free on Github](https://github.com/lovasoa/sqlpage)"},
43
+
{"title":"Tabler", "description_md":"A **free** and **open-source** **HTML** template pack based on **Bootstrap**."},
44
+
{"title":"Tabler Icons", "description_md":"A set of over **700** free MIT-licensed high-quality **SVG** icons for you to use in your web projects."}
45
+
]')),
40
46
('list', 'A beautiful list with bells and whistles.',
@@ -52,8 +58,15 @@ INSERT INTO parameter(component, name, description, type, top_level, optional) S
52
58
('columns', 'The number of columns in the grid of cards. This is just a hint, the grid will adjust dynamically to the user''s screen size, rendering fewer columns if needed to fit the contents.', 'INTEGER', TRUE, TRUE),
53
59
-- item level
54
60
('title', 'Name of the card, displayed at the top.', 'TEXT', FALSE, FALSE),
55
-
('description', 'The body of the card.', 'TEXT', FALSE, TRUE),
61
+
('description', 'The body of the card, where you put the main text contents of the card.
62
+
This does not support rich text formatting, only plain text.
63
+
If you want to use rich text formatting, use the `description_md` property instead.', 'TEXT', FALSE, TRUE),
64
+
('description_md', '
65
+
The body of the card, in Markdown format.
66
+
This is useful if you want to display a lot of text in the card, with many options for formatting, such as
'{"title":"Google", "link":"https://google.com", "description": "A search engine", "color": "red", "icon":"brand-google", "footer": "Owned by Alphabet Inc."}, '||
@@ -130,6 +147,8 @@ INSERT INTO parameter(component, name, description, type, top_level, optional) S
130
147
('center', 'Whether to center the title.', 'BOOLEAN', TRUE, TRUE),
131
148
('width', 'How wide the paragraph should be, in characters.', 'INTEGER', TRUE, TRUE),
132
149
('html', 'Raw html code to include on the page. Don''t use that if you are not sure what you are doing, it may have security implications.', 'TEXT', TRUE, TRUE),
150
+
('contents', 'A top-level paragraph of text to display, without any formatting, without having to make additional queries.', 'TEXT', TRUE, TRUE),
151
+
('contents_md', 'Rich text in the markdown format. Among others, this allows you to write bold text using **bold**, italics using *italics*, and links using [text](https://example.com).', 'TEXT', TRUE, TRUE),
133
152
-- item level
134
153
('contents', 'A span of text to display', 'TEXT', FALSE, FALSE),
135
154
('link', 'An URL to which the user should be taken when they click on this span of text.', 'URL', FALSE, TRUE),
@@ -144,6 +163,39 @@ INSERT INTO parameter(component, name, description, type, top_level, optional) S
144
163
145
164
INSERT INTO example(component, description, properties) VALUES
146
165
('text', 'Rendering a simple text paragraph.', json('[{"component":"text", "contents":"Hello, world ! <3"}]')),
166
+
('text', 'Rendering rich text using markdown', json('[{"component":"text", "contents_md":"\n'||
167
+
'# Markdown in SQLPage\n\n'||
168
+
'## Simple formatting\n\n'||
169
+
'SQLPage supports only plain text as column values, but markdown allows easily adding **bold**, *italics*, and [links](index.sql).\n\n'||
170
+
'## Lists\n'||
171
+
'### Unordered lists\n'||
172
+
'* SQLPage is easy\n'||
173
+
'* SQLPage is fun\n'||
174
+
'* SQLPage is free\n\n'||
175
+
'### Ordered lists\n'||
176
+
'1. SQLPage is fast\n'||
177
+
'2. SQLPage is safe\n'||
178
+
'3. SQLPage is open-source\n\n'||
179
+
'## Code\n'||
180
+
'```sql\n'||
181
+
'SELECT ''list'' AS component;\n'||
182
+
'SELECT name as title FROM users;\n'||
183
+
'```\n\n'||
184
+
'## Tables\n\n'||
185
+
'| SQLPage component | Description | Documentation link |\n'||
186
+
'| --- | --- | --- |\n'||
187
+
'| text | A paragraph of text. | [Documentation](https://sql.ophir.dev/documentation.sql?component=text) |\n'||
188
+
'| list | A list of items. | [Documentation](https://sql.ophir.dev/documentation.sql?component=list) |\n'||
189
+
'| steps | A progress indicator. | [Documentation](https://sql.ophir.dev/documentation.sql?component=steps) |\n'||
190
+
'| form | A series of input fields. | [Documentation](https://sql.ophir.dev/documentation.sql?component=form) |\n\n'||
191
+
'## Quotes\n'||
192
+
'> Fantastic.\n>\n'||
193
+
'> — [HackerNews User](https://news.ycombinator.com/item?id=36194473#36209061) about SQLPage\n\n'||
'{"title": "Easy", "description_md": "You can teach yourself enough SQL to use [**SQLPage**](https://sql.ophir.dev) in a weekend.", "icon": "sofa", "color": "blue", "link": "/"}'||']'
Copy file name to clipboardExpand all lines: examples/official-site/sqlpage/migrations/03_alert_component.sql
+23-2Lines changed: 23 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -45,6 +45,14 @@ VALUES (
45
45
TRUE,
46
46
TRUE
47
47
),
48
+
(
49
+
'alert',
50
+
'description_md',
51
+
'Detailed description or content of the alert message, in Markdown format, allowing you to use rich text formatting, including **bold** and *italic* text.',
52
+
'TEXT',
53
+
TRUE,
54
+
TRUE
55
+
),
48
56
(
49
57
'alert',
50
58
'dismissible',
@@ -100,8 +108,7 @@ VALUES (
100
108
'TEXT',
101
109
FALSE,
102
110
TRUE
103
-
)
104
-
;
111
+
);
105
112
-- Insert example(s) for the component
106
113
INSERT INTO example(component, description, properties)
107
114
VALUES (
@@ -164,4 +171,18 @@ VALUES (
164
171
"link_text":"See source code"
165
172
}]'
166
173
)
174
+
),
175
+
(
176
+
'alert',
177
+
'An alert message with a Markdown-formatted description',
178
+
JSON(
179
+
'[
180
+
{
181
+
"component":"alert",
182
+
"title":"Free and open source",
183
+
"icon": "free-rights",
184
+
"color": "info",
185
+
"description_md":"*SQLPage* is entirely free and open source. You can **contribute** to it on [GitHub](https://github.com/lovasoa/SQLPage)."
0 commit comments