Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ikskuh/zig-gemtext
A zig library to manipulate gemini text files
https://github.com/ikskuh/zig-gemtext
gemini gemini-language gemini-protocol markup markup-converter parser zig zig-package ziglang
Last synced: 16 days ago
JSON representation
A zig library to manipulate gemini text files
- Host: GitHub
- URL: https://github.com/ikskuh/zig-gemtext
- Owner: ikskuh
- License: mit
- Created: 2021-03-05T00:07:29.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-10-04T10:39:13.000Z (about 1 month ago)
- Last Synced: 2024-10-13T01:25:06.001Z (about 1 month ago)
- Topics: gemini, gemini-language, gemini-protocol, markup, markup-converter, parser, zig, zig-package, ziglang
- Language: Zig
- Homepage:
- Size: 159 KB
- Stars: 12
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Gemini Text Processor
This is a library and a tool to manipulate [gemini text files](https://gemini.circumlunar.space/docs/specification.html).
It provides both an easy-to-use API as well as a streaming parser with minimal allocation requirements and a proper separation between temporary allocations required for parsing and allocations for returned text fragments.
The library is thoroughly tested with a lot of gemini text edge cases and all (tested) cases are handled reasonably.
## Features
- Fully spec-compliant gemini text parsing
- Non-blocking streaming parser
- Provides both a convenient [Zig](src/gemtext.zig) and [C](include/gemtext.h) API
- Rendering to several formats
- Gemini text
- HTML
- Markdown
- RTF## Example
This is a simple example that parses a gemini file and converts it into a HTML file.
```zig
pub fn main() !void {
var document = try gemtext.Document.parse(
std.heap.page_allocator,
std.io.getStdIn().reader(),
);
defer document.deinit();try gemtext.renderer.html(
document.fragments.items,
std.io.getStdOut().writer(),
);
}
```More examples can be found the the examples folder:
- `gem2html` ([C](examples/gem2html.c), [Zig](examples/gem2html.zig))
- `gem2md` ([C](examples/gem2md.c), [Zig](examples/gem2md.zig))
- `streaming-parser` ([C](examples/streaming-parser.c), [Zig](examples/streaming-parser.zig))