gemini-fmt idea

Brian Evans b__m__e at mailfence.com
Wed May 20 20:06:34 BST 2020


I liked this idea. I use the go toolchain a lot and really appreciate the options available. 
In particular `go fmt`. I think consistent code is readable code.  The same is possible
for `text/gemini` documents.

In that spirit I have made a tool (it is still a work in progress):
https://tildegit.org/sloum/gemini

(I'm open to changing the name, but I liked the idea of running:
     `gemini fmt ./index.gmi`

Current features:

## fmt
* Normalizes a text/gemini document's style
* Reports errors in markup
* Ability to read a piped file from stdin (coming soon)
* Writes to stdout and stderr
* -o flag to write to file (coming very soon)

## get
* Makes a basic request and prints the result (ala curl)
* Can request just the header; defaults to just the body (for easy redirection/piping)
* Ability to pass cert/key pair (coming soon)
* Automatically follows redirects
* Writes to stdout/stderr
* -o flag to write to file (coming very soon)

## spec
* Makes a get request for the spec
* Writes to stdout/stderr
* -o flag to write to file (coming very soon)
* request a subsection of the spec (coming soon)

## version
* prints the tool version

## serve (coming soon)
* will spin up a really simple gemini file server on localhost
* configurable port



If people would like anything else let me know. I dug through the `text/gemini` to make sure
I was getting everything within spec for the formatting. The only place I break from the spec
is w/ regard to alt text on the opening line of a preformatted block (I allow it and format it). I
have included it, but specifically state in the README.md that it is an experimental feature
that may be removed or changed in the future.

Anyway, hopefully it is useful to someone eventually. I have definitely liked the consistent
output that it provides. It lets me write with a lot of extra spacing and organize my thoughts
how I want, but then cleans it all up nicely. :)


More information about the Gemini mailing list