md2gmi/README.md

55 lines
2 KiB
Markdown
Raw Normal View History

2021-07-03 18:26:27 +03:00
## md2gmi
2021-07-04 07:31:51 +03:00
Convert Markdown to Gemini [gemtext](https://gemini.circumlunar.space/docs/gemtext.gmi) markup with
Go. Working with streams and pipes for UNIX like behavior utilizing Go channels. Processing streams
2021-07-04 15:31:45 +03:00
line by line is slightly more complex than it needs to be as I'm playing with channels and state
machines here.
2021-07-04 07:31:51 +03:00
2021-07-04 15:31:45 +03:00
Internally md2gmi does a 1st pass that constructs the blocks of single lines for gemtext. This is
then streamed to the 2nd pass line by line. The 2nd pass will convert links, fix headings and stream
line by line to the output sink. The sink is either a file or stdout.
2021-07-03 18:26:27 +03:00
2021-07-04 10:22:55 +03:00
### Usage
2021-07-03 18:26:27 +03:00
2021-07-04 07:31:51 +03:00
```plain
2021-07-03 18:26:27 +03:00
Usage of ./md2gmi:
2021-07-04 10:03:37 +03:00
-f string
2021-07-03 18:26:27 +03:00
specify a .md (Markdown) file to read from, otherwise stdin (default)
2021-07-04 10:03:37 +03:00
-o string
2021-07-03 18:26:27 +03:00
specify a .gmi (gemtext) file to write to, otherwise stdout (default)
```
### Example
go get github.com/n0x1m/md2gmi
cat file.md | md2gmi
2021-07-04 10:22:55 +03:00
md2gmi -in file.md -out file.gmi
2021-07-04 15:31:45 +03:00
The top part of this readme parses from
2021-07-04 10:22:55 +03:00
```md
2021-07-04 15:31:45 +03:00
Convert Markdown to Gemini [gemtext](https://gemini.circumlunar.space/docs/gemtext.gmi) markup with
Go. Working with streams and pipes for UNIX like behavior utilizing Go channels. Processing streams
line by line is slightly more complex than it needs to be as I'm playing with channels and state
machines here.
2021-07-04 10:22:55 +03:00
2021-07-04 15:31:45 +03:00
> this is
a quote
<!-- testing markdown, this should be deleted, below merged -->
See the [gemini
protocol](https://gemini.circumlunar.space/) and the [protocol
spec](https://gemini.circumlunar.space/docs/specification.gmi).
```
```md
Convert Markdown to Gemini gemtext[1] markup with Go. Working with streams and pipes for UNIX like behavior utilizing Go channels. Processing streams line by line is slightly more complex than it needs to be as I'm playing with channels and state machines here.
2021-07-04 10:22:55 +03:00
=> https://gemini.circumlunar.space/docs/gemtext.gmi 1: gemtext
2021-07-04 15:31:45 +03:00
> this is a quote
2021-07-04 10:50:08 +03:00
See the gemini protocol[1] and the protocol spec[2].
2021-07-04 10:22:55 +03:00
=> https://gemini.circumlunar.space/ 1: gemini protocol
=> https://gemini.circumlunar.space/docs/specification.gmi 2: protocol spec
```