GithubHelp home page GithubHelp logo

n0x1m / md2gmi Goto Github PK

View Code? Open in Web Editor NEW
14.0 14.0 3.0 54 KB

Converts Markdown to Gemini gemtext with Go. Working with streams and UNIX pipes, utilizing Go channels. Processes streams of input line by line and forwards blocks to the next pipeline stage.

License: ISC License

Go 100.00%
converter gemini go golang hugo markdown

md2gmi's People

Contributors

n0x1m avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jgarte kallisti5

md2gmi's Issues

Links do not translate well

Given the example:

[some description](/test.html)

Is translated to:

some description[1]
=> /test.html 1: some description

I think the desired output for gmi would be:

=> /test.html some description

Which will be properly rendered by gemini browsers.

Tables don't seem to be processed

I'm not sure what's the best way to process tables in gemtext, but I think that it could be rendering those as a monospace block.

To do this effectively, we would need a way to "inflate" the markdown tables to the shape of an "ASCII" table.

What I mean is having a function that takes

Score | Skilled|Unskilled
------|--------|----------
6 | Succ + Bonus | Succ + Bonus or Learn 
5 |  Succ | Succ
4 |  Succ |  Succ + Cost
3 |  Succ + Cost | Twist
2 |  Twist | Twist
1 |   Twist + Cost | Twist + Cost

and returns

 Score |      Skilled |             Unskilled
-------|--------------|-----------------------
     6 | Succ + Bonus | Succ + Bonus or Learn 
     5 |         Succ |                  Succ
     4 |         Succ |           Succ + Cost
     3 |  Succ + Cost |                 Twist
     2 |        Twist |                 Twist
     1 | Twist + Cost |          Twist + Cost

Sub-lists should translate into something

Just like with other entities in Markdown that don't have a counterpart in Gemtext, we need to come up with some translation ourselves.

What I normally do by hand is when I find a non-flat list is I translate each depth level into a level of outline. It is not a generic solution and actually I don't think it should be implemented like this.

I think an acceptable translation would be to insert line breaks and pad each depth level with a number, this way

1. Introductory questions about overall background.
	1. Music, computers and work at REDACTED.
	2. Working with humans in non-tech
		1. at work with REDACTED.
		2. in an activist / advocacy group with REDACTED.
	3. How it helped to make a jump to become a tech lead.

would become

1. Introductory questions about overall background.
1.1. Music, computers and work at REDACTED.
1.2. Working with humans in non-tech
1.2.1. at work with REDACTED.
1.2.2. in an activist / advocacy group with REDACTED.
1.3. How it helped to make a jump to become a tech lead.

It doesn't look half-bad in Lagrange either:

The same list rendered in Lagrange

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.