]>
Commit | Line | Data |
---|---|---|
8beb2bfa RBR |
1 | # gema_texto |
2 | ||
3 | `gema_texto` parses gemtext and renders html. | |
4 | ||
5 | This library powers [blog](https://r.bdr.sh/blog.html) and | |
6 | [page](https://r.bdr.sh/page.html), so it makes some decisions on | |
7 | for those projects. Here's how each line is handled: | |
8 | ||
9 | - Headings and the content under them is wrapped in a `<section>` tag. | |
10 | - All text lines are `<p>`, even empty ones. | |
5f7e1e31 RBR |
11 | - URLs are wrapped in a `<p>` and .gmi files are changed to .html unless the |
12 | URL starts with gemini: | |
8beb2bfa RBR |
13 | - Alt Text is supported for preformatted-toggles, and is written as |
14 | the aria-label of the `<pre>` tag. | |
15 | - Consecutive list items are wrapped in a `<ul>` and rendered as `<li>` tags. | |
16 | - Quotes are wrapped in a single `<blockquote>` | |
17 | ||
18 | # Usage | |
19 | ||
20 | More in-depth usage docs in the source. This is an overview of the included | |
21 | functionality. | |
22 | ||
23 | - `gemini_parser` deals with parsing the gemini file itself. | |
24 | - `html_renderer` takes a parsed gemini file and renders it to html. | |
25 | ||
26 | ## `gema_texto::gemini_parser::GeminiLine` | |
27 | ||
28 | An `enum` that represents the six different types of lines in gemtext. | |
29 | ||
30 | ## `gema_texto::gemini_parser::parse` | |
31 | ||
32 | Parses a `&str` of gemtext source and returns a `Vec<GeminiLine>`. | |
33 | ||
34 | ## `gema_texto::html_renderer::render_html` | |
35 | ||
36 | Renders a `Vec<GeminiLine>` into some html `String` |