doc: update daleth syntax

This commit is contained in:
Artemy Egorov 2024-08-08 09:16:16 +03:00
parent e8dd2c8f35
commit 4258f3296d
2 changed files with 95 additions and 92 deletions

116
README.md
View file

@ -21,123 +21,123 @@ This is Daleth (high level language that compiles to Daletl).
```yaml
# multilines
#
# (text) - input is trimmed with indent
# `text` - input is trimmed with indent
#
# (~n text) - n is number of minimum spaces to add after trimming with indent
# `~n text` - n is number of minimum spaces to add after trimming with indent
# for each line
#
# (# text) - input not modified
# `# text` - input not modified
#
# tag syntax
#
# tag: text body
# tag (multiline text body)
# tag { multiline text body }
# body text always trimmed
#
# tag { multiple tags body }
# tag [ multiple tags body ]
#
# Arguments
# tag[argument]
# tag(argument)
#
# Tags without body and argument also supported
meta[title]: Daleth syntax concept
meta[description]: This document describes Daleth syntax and some tags
meta(title): Daleth syntax concept
meta(description): This document describes Daleth syntax and some tags
h[1]: TxtDot revolution
h(1): TxtDot revolution
p: TxtDot is a cool project
# If no tag is specified, then the 'el' tag is placed
This is element
br
# if no tag is specified but a '()' is present, then the 'p' tag is placed
# if no tag is specified but a '{}' is present, then the 'p' tag is placed
# '\n' is deleted only in this format. If a break line is needed in a paragraph, use ' \n'.
(
{
Check Dalet too
This is one paragraph
)
( This is another paragraph )
# [ ] for argument
row[center] {
link[https://github.com/txtdot/txtdot]: Homepage
btn[https://example.com/donate] {
# tag without body
img[https://example.com/donate.png]
Donate
}
}
# {} for multiple objects
row {
{
h[2]: Features
{ This is another paragraph }
ul {
# ( ) for argument
row(center) [
link(https://github.com/txtdot/txtdot): Homepage
btn(https://example.com/donate) [
# tag without body
img(https://example.com/donate.png)
Donate
]
]
# [] for multiple tags
row [
[
h(2): Features
ul [
Server-side page simplification
Media proxy
Image compression with Sharp
Rendering client-side apps (Vanilla, React, Vue, etc) with webder
Rendering client-side apps `Vanilla, React, Vue, etc` with webder
Search with SearXNG
Handy API endpoints
No client JavaScript
Some kind of Material Design 3
Customization with plugins, see @txtdot/sdk and @txtdot/plugins
}
]
}
]
{
h[2]: Running
[
h(2): Running
{
h[3]: Dev
[
h(3): Dev
# () for multiline strings, indent is automatically trimmed
code (
# {} for multiline strings, indent is automatically trimmed
code {
npm install
npm run dev
)
}
# (~n Text) n is number of minimum spaces
code[markdown] (~4
# {~n Text} n is number of minimum spaces
code[markdown] {~4
this is codeblock
)
}
# (# Text) Text after "(# " not modified
code[markdown] (# this is codeblock)
}
# {# Text} Text after "`# " not modified
code[markdown] {# this is codeblock}
]
{
h[3]: Production
[
h(3): Production
code (
code {
npm install
npm run build
npm run start
)
}
}
]
{
h[3]: Docker
[
h(3): Docker
code: docker compose up -d
}
]
}
}
]
]
# Table has custom format if text used
# +| cells | - primary column
# | cells | - secondary column
# | Element | Description | - converts to
# tcol {
# tcol [
# Element
# Description
# }
table (
# ]
table {
+| Tag | Description |
| h | Heading |
| p | Paragraph |
@ -147,5 +147,5 @@ table (
| ul | Unordered list |
| br | Line break |
+| quantity | 7 |
)
}
```

View file

@ -15,7 +15,9 @@ Most primitive tag. Also used if no tag is specified.
```yaml
el: I am Element
el: { h[1]: I am first level heading }
el: [
h(1): I am first level heading
]
Element also used if no tag is specified.
```
@ -33,11 +35,11 @@ Heading is used for text formatting.
**Daleth example**:
```yaml
h[1]: Dalet
h[2]: Daleth
h[3]: High level
h[2]: Daletl
h[3]: Low level
h(1): Dalet
h(2): Daleth
h(3): High level
h(2): Daletl
h(3): Low level
```
## 2. Paragraph
@ -55,6 +57,7 @@ Paragraph is used for text formatting.
```yaml
p: This is a paragraph
{ Paragraph also used if no tag specified but with `{\}` }
```
## 3. Line break
@ -88,10 +91,10 @@ Unordered list is used to create a list.
**Daleth example**:
```txt
ul: {
ul [
Item 1
Item 2
}
]
```
## 5. Ordered list
@ -108,11 +111,11 @@ Ordered list is used to create a list with increasing numbers.
**Daleth example**:
```txt
ol: {
ol [
Item
Item
Item
}
]
```
## 6. Row
@ -128,15 +131,15 @@ Splits the text into rows. The alignment argument specifies how the items inside
**Daleth example**:
```txt
row: {
row [
Left
Right
}
]
row[start]: {
row(start) [
Left
Right
}
]
```
Argument converts to numbers in daletl.
@ -158,7 +161,7 @@ Link to other sites. On click the link opens in new tab.
**Daleth example**:
```yaml
link[https://example.com]: I am Link
link(https://example.com): I am Link
```
## 8. Navlink
@ -175,7 +178,7 @@ Link to the same site. On click the link opens in current tab.
**Daleth example**:
```yaml
navlink[/specification]: I am Navlink
navlink(/specification): I am Navlink
```
## 9. Button
@ -192,7 +195,7 @@ Same as link, but with button style.
**Daleth example**:
```yaml
btn[https://example.com]: I am Button
btn(https://example.com): I am Button
```
## 10. NavButton
@ -209,7 +212,7 @@ Same as navlink, but with button style.
**Daleth example**:
```yaml
navbtn[https://example.com]: I am NavButton
navbtn(https://example.com): I am NavButton
```
## 11. Image
@ -226,7 +229,7 @@ Displays an image.
**Daleth example**:
```yaml
img[/dalet.png]
img(/dalet.png)
```
## 12. Table
@ -243,9 +246,9 @@ Creates a table.
**Daleth example**:
```txt
table: {
table {
Name | Age
Elon | 53,
Elon | 53
}
```
@ -263,10 +266,10 @@ Creates a table column.
**Daleth example**:
```txt
tcol: {
tcol [
Name
Age
}
]
```
## 14. Table Primary Column
@ -283,10 +286,10 @@ Like table column, but with primary background.
**Daleth example**:
```txt
tpcol: {
tpcol [
Name
Age
}
]
```
## 15. Horizontal rule
@ -371,7 +374,7 @@ Link to footnote.
**Daleth example**:
```yaml
footlnk[1]
footlnk(1)
```
## 20. Footnote
@ -388,7 +391,7 @@ Creates footnote.
**Daleth example**:
```yaml
footn[1]: I am Footnote
footn(1): I am Footnote
```
## 21. Anchor
@ -398,14 +401,14 @@ footn[1]: I am Footnote
| name | a |
| id | 21 |
| body | no |
| argument | text , number |
| argument | text, number |
Creates anchor. Like `<a href="#argument"></a>` in HTML.
**Daleth example**:
```yaml
a[0]
a(0)
```
## 22. Strikethrough
@ -473,7 +476,7 @@ Creates disclosure element.
**Daleth example**:
```yaml
disc[Click to expand]: I am Disclosure
disc(Click to expand): I am Disclosure
```
## 26. Block
@ -512,10 +515,10 @@ Creates carousel.
**Daleth example**:
```txt
carousel: {
carousel [
Example 1
Example 2,
}
]
```
## 28. Code
@ -532,7 +535,7 @@ Creates code block.
**Daleth example**:
```txt
code[js]: let code = "js"
code(js): let code = "js"
```
## 29. Pre-formatted text
@ -566,5 +569,5 @@ Not displayed. Specifies metadata such as title, description. Must be before all
**Daleth example**:
```yaml
meta[description]: I am description
meta(description): I am description
```