]> git.r.bdr.sh - rbdr/gema_texto/blame_incremental - README.md
Add the library
[rbdr/gema_texto] / README.md
... / ...
CommitLineData
1# gema_texto
2
3`gema_texto` parses gemtext and renders html.
4
5This library powers [blog](https://r.bdr.sh/blog.html) and
6[page](https://r.bdr.sh/page.html), so it makes some decisions on
7for 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.
11- URLs are wrapped in a `<p>`
12- Alt Text is supported for preformatted-toggles, and is written as
13 the aria-label of the `<pre>` tag.
14- Consecutive list items are wrapped in a `<ul>` and rendered as `<li>` tags.
15- Quotes are wrapped in a single `<blockquote>`
16
17# Usage
18
19More in-depth usage docs in the source. This is an overview of the included
20functionality.
21
22- `gemini_parser` deals with parsing the gemini file itself.
23- `html_renderer` takes a parsed gemini file and renders it to html.
24
25## `gema_texto::gemini_parser::GeminiLine`
26
27An `enum` that represents the six different types of lines in gemtext.
28
29## `gema_texto::gemini_parser::parse`
30
31Parses a `&str` of gemtext source and returns a `Vec<GeminiLine>`.
32
33## `gema_texto::html_renderer::render_html`
34
35Renders a `Vec<GeminiLine>` into some html `String`