n0x1m / md2gmi

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.
ISC License
14 stars 3 forks source link

Tables don't seem to be processed #1

Open cognivore opened 2 years ago

cognivore commented 2 years ago

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
n0x1m commented 2 years ago

two issues, identify table beginning and end, format the table. Any idea if there is a short algorithm around for the formatting part?