prema 0.2.26

convert markdown to html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
Very simple static site generator from markdown!

Prema is short for Pretty Markdown.

It is based on Tailwind CSS and Flowbite.

### Install

You can install this package using Cargo:

```bash
cargo install prema
```

### Command

```bash
# generate html
# make hierarchy htmls based on selected directory
# make md files to html files in html_directory
prema html {target_directory} {html_directory}

# generate set of md
# make directory of {name} contains {name}.md, option.toml
prema new {name}

```

### Structure

When the conversion is performed, it searches subfolders based on the target directory.
If an index.toml or [index.md](http://index.md/) file exists inside a folder, an index.html file is generated to create a page.
If both files exist, index.toml takes precedence.

# index.toml

### root

In index.toml, the first layout must always be root.
Therefore, a root layout must exist, and the structure should be designed so that layouts propagate outward from the root layout.

```toml
[root]
shape = "column"
width = "100%"
height = "100%"
dark = false

```

### layout

Layouts have a required shape property and optional properties that can be set as needed: width, height, background, path, value, and dark.

- width, height: Adjust the size; can be specified in px, %, or wrap.
- background: Sets the background color.
- path: Makes the layout a clickable button that navigates to the specified value when pressed.
- value: If specified, allows setting values for the layout and its sublayouts using {}.
- dark: Determines whether the layout uses a dark theme. If not set, it inherits the dark theme from the parent layout.

```toml
[root.contents]
shape = "column"
width = "200px"
height = "100%"
background = "#000"
path = "#"
value = { skill_title = "1", skill_image = "duck.jpeg", skill_summary = "index.md" }
dark = false

```

### sub layout

To place a layout as a child of another layout, extend it from the parent layout key.
If a sublayout is needed under the root, extend it as root.{} by inserting the desired name inside the {}.
Multiple sublayouts can exist.

A sublayout is affected by the structure of its parent layout.
If the parent layout is a column, it will be arranged vertically, and if it is a row, it will be arranged horizontally.

```toml
[root]
shape = "column"
width = "100%"
height = "100%"
dark = false

[root.child1]
shape = "text"
width = "100%"
height = "wrap"
text = "Title"
color = "#fff"
size = "24px"
weight = "bold"
custom_class = "pl-[20px]"

[root.child2]
shape = "markdown"
width = "100%"
height = "100%"
markdown_path = "title.md"
custom_class = "pl-[20px] pr-[20px]"

```

### nav

In nav, title refers to the text displayed on the left, and headers refers to the menus displayed on the right.
Menu labels cannot duplicate reserved keywords in the layout (such as width, height, dark, etc.).
If you want to add a submenu to a menu, you can define it like service.etc1 = "" as shown in the example below.
If a submenu exists, defining a non-submenu item for the same menu (e.g., service = "") may cause conflicts.

```toml
[root.nav]
shape = "nav"
width = "100%"
height = "70px"
title = "STAR"
headers = ["home", "service", "menu", "end", "about me"]
home = "/"
end = "doc"
service.etc1 = "etc1"
service.etc2 = "etc2"
service.etc3 = "etc3"
"about me".my = "about_me/my"

```

### embed

Specifies a parent or current layout that is not included in the root.

This is necessary when the same layout is used across multiple views, typically for setting headers or footers.

### column, row, box

Sublayouts can be included, and the arrangement direction is determined by the shape.

```toml
[root]
shape = "column"
width = "100%"
height = "100%"
dark = false

```

### list_column, list_row

In the case of a list, you can specify a layout.
The layout specified can receive values through values.
The injected values can also be passed to the specified layout’s sublayouts using {}.
A layout is generated for each value in values, and whether they are arranged vertically or horizontally is determined by whether it is list_column or list_row.

```toml
[root.contents.skills]
shape = "list_row"
width = "100%"
height = "200px"
layout = "skill_layout"
order_by = "skill_title" # title, date, author, ...
values = [
  { skill_title = "1", skill_image = "duck.jpeg", skill_summary = "index.md" },
  { skill_title = "2", skill_image = "2.png", skill_summary = "skill.md" },
  { skill_title = "3", skill_image = "3.png", skill_summary = "1.md" },
  { skill_title = "3", skill_image = "3.png", skill_summary = "1.md" },
  { skill_title = "3", skill_image = "3.png", skill_summary = "1.md" },
  { skill_title = "3", skill_image = "3.png", skill_summary = "1.md" },
  { skill_title = "3", skill_image = "3.png", skill_summary = "1.md" },
  { skill_title = "3", skill_image = "3.png", skill_summary = "1.md" },
]
background = "#0ff"

[skill_layout]
shape = "column"
width = "100px"
height = "250px"
background = "#00f"

[skill_layout.skill_title]
shape = "text"
width = "100%"
height = "wrap"
size = "24px"
text = "{skill_title}"
color = "#fff"
family = "montserrat"

[skill_layout.skill_summary]
shape = "markdown"
width = "100%"
height = "wrap"
markdown_path = "{skill_summary}"

[skill_layout.skill_image]
shape = "image"
width = "200px"
height = "200px"
image_path = "{skill_image}"
content_size = "cover" # cover, contain, fill

```

### mdlist_column, mdlist_row

Creates a list of Markdown files located in the specified directory.

When the user taps an item in the list, it navigates to the corresponding Markdown file.

The frontmatter and filename of each Markdown file can be accessed and used in the form of {}.

```toml
[root]
shape = "column"
width = "100%"
height = "100%"
dark = true

[root.nav]
shape = "embed"
layout = "nav"

[root.contents]
shape = "mdlist_column"
width = "100%"
height = "wrap"
layout = "markdown_row"
files = "*.md"
custom_class = "pl-[20px] pr-[20px]"

[root.footer]
shape = "embed"
layout = "footer"

[markdown_row]
shape = "row"
width = "wrap"
height = "wrap"

[markdown_row.title]
shape = "text"
width = "wrap"
height = "wrap"
size = "16px"
text = "{title}"
path = "{filename}"
color = "#fff"
```

### text

Text properties such as content, size, font, and alignment can be set. Sublayouts cannot be included.

```toml
[root.contents.title]
shape = "text"
width = "wrap"
height = "wrap"
size = "24px"
text = "Jumbotron!"
color = "#000"
family = "montserrat"
weight = "bold"
path = "#"
vertical_align = "center" # top, center, bottom
horizontal_align = "center" # left, center, right

```

### image

Displays an image and allows setting image_path and content_size. Sublayouts cannot be included.

```toml
[skill_layout.skill_image]
shape = "image"
width = "200px"
height = "200px"
image_path = "image.jpeg" # jpeg, jpg, png, svg
content_size = "cover" # cover, contain, fill

```

### markdown

A Markdown file can be applied, and markdown_path can be set. Sublayouts cannot be included.

```toml
[skill_layout.skill_summary]
shape = "markdown"
width = "100%"
height = "wrap"
markdown_path = "info.md"

```

### grid

- Not yet supported

# [index.md]http://index.md/

If a folder does not have an index.toml configured, [index.md](http://index.md/) is converted instead, and its content is treated as Markdown.

# Markdown

### Link

- Page Link

If you want to link to the rust folder, you can do it like this,

```markdown
[Link](rust "")

```

If there's a rust folder inside the language directory, you can link to it like this,

```markdown
[Link](language/rust "")

```

You can link to it like above.

- Image Link

After adding the image file,

```markdown
![Alt text](image.jpeg "rounded-[10px]")
```

As shown above, simply add an exclamation mark (!), followed by the alt text, and then the file name, such as image.jpeg. The **Title** section supports Tailwind attributes, allowing you to modify the size and properties of the image.

### Supported Markdown

The following Markdown attributes are supported.

```
Heading
# Heading Text
## Heading Text
### Heading Text
#### Heading Text
##### Heading Text
###### Heading Text

List
- ItemText
* ItemText

Line
***
---

Link
[Text](MdLink "Title")
[Text](HttpLink "Title")
![Alt](ImageLink "rounded-[10px]")

TextStyle
**Strong**
*Emphasis*

BlockQuote
> Text

Code
⠀``` rust
fn main() {

}
⠀```

Table
| Month    | Savings |
| -------- | ------  |
| January  | $250    |
| February | $80     |
| March    | $420    |

```

### Frontmatter

To complement the limitations of Markdown, Frontmatter is supported. The following are the reserved keywords that can be used. For **header** and **footer**, a layout must be specified in the parent layout, and the designated names should be targeted.

When **custom_class** is added to the parent `<div>` of the Markdown HTML, Tailwind class attributes are supported.

```markdown
---
title: "Python Minus"
created: 25-10-01
header: nav
footer: footer
dark: false
publish: false
tags: [python, math]
custom_class: mx-auto max-w-screen-xl

---
```

### Image Attr

You can place the Tailwind image attributes in the **Title** section as shown below. The actual **Title** itself is not used.

```markdown
![Profile](profile_small.jpeg "max-w-[400px] rounded-[10px]")
```