Giter Site home page Giter Site logo

gemrest / germ Goto Github PK

View Code? Open in Web Editor NEW
8.0 0.0 2.0 188 KB

๐Ÿฆ  The Definitive Gemini Protocol Toolkit

Home Page: https://crates.io/crates/germ

License: GNU General Public License v3.0

Rust 100.00%
converter gemini lexer markdown parser gemini-protocol

germ's Introduction

Germ

crates.io docs.rs github.com

The Ultimate Gemini Toolkit

Germ is a toolkit for the Gemini protocol which aims to have a little something for everyone. At the moment, Germ has ZERO dependencies (unless you use the request feature), and Germ will continue to try its hardest to have as few dependencies as possible.

Features

  • AST builder to easily construct and manipulate AST trees from raw Gemtext
  • Converters to easily convert from Gemtext to markup formats such as HTML or Markdown
  • Blocking and non-blocking request suite
  • Structured meta section manipulation
  • And more!

Check out the rest of the features in the Features section under Usage

Usage

Current version: crates.io

# Cargo.toml

[dependencies]
# To enable only the base (default) features: ast, convert, meta, request
# germ = "*" # Use current version show above!

# To enable only certain features
[dependencies.germ]
version = "*" # Use current version show above!
default-features = false
features = ["ast"] # Enable the features you would like to use!

Features

Feature Description
default ast, convert, meta, request
ast Construct AST trees from raw Gemtext
blocking Blocking equivalent of request
convert Convert Gemtext to markup formats such as HTML or Markdown
request Make Gemini requests, get sane, structured results
meta Structure-ise a Gemini response's meta section
macros Macros to aid with various Germ-related functionalities
quick Tiny functions to create valid Gemtext elements from structured input

Examples

Thoroughly commented examples can be found within the examples/ directory.

License

This project is licensed with the GNU General Public License v3.0.

germ's People

Contributors

fuwn avatar marceline-cramer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

germ's Issues

Emoji in heading messes up the level calculation

Another issue I found when using the library to access my own Gemfeed. If you have an emoji at the start of a heading, it will mess up the level calculation:

  • # MyHeading => reported as heading level 1.
  • # ๐Ÿ–Š๏ธ MyHeading => reported as heading level 0.

This seems to only happen if the emoji is at the start of the header.

Not sure if it affects level 2 or 3 headings.

Meta requires a 'static String?

I'm making good use of your library in a small project. But I can't parse the meta from a Gemini response into a structured representation, because the from_string function requires a 'static lifetime. This seems like an oversight maybe?

let resp = germ::request::request(url)?;
let meta = germ::meta::Meta::from_string(resp.meta());

This is not possible, because resp.meta() does not have a 'static lifetime. Is there a way to parse the response Meta into the struct?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.