Open MichaelMure opened 5 years ago
I kinda bruteforced the parser with a custom renderer that output the node relationship in a plantUML format and feeded it all the test samples that are in this repo. I end up with the following which seems to make much more sense. Is that correct ? Is there everything ?
I probably have all the cases now ..
FYI, I moved the WIP renderer into its own package over there: https://github.com/MichaelMure/go-term-markdown
MIT license.
It would be super useful to have a short documentation on the AST to explain:
For some context, I'm in the process of writing a renderer for the terminal, with ANSI escape code for the formatting and proper text wrapping, and it's fairly complicated to extract from the code exactly what is possible.
Here is my current understanding, is that correct ?
PlantUML code to generate it
``` @startuml (*) --> Document Document --> BlockQuote Document --> List Document --> Paragraph Document --> Heading Document --> Emph Document --> Strong Document --> Del Document --> Link Document --> Image Document --> Table Document --> HorizontalRule Document --> Text Document --> HTMLBlock Document --> CodeBlock Document --> Softbreak Document --> Hardbreak Document --> Code Document --> HTMLSpan BlockQuote --> BlockQuote BlockQuote --> List BlockQuote --> Paragraph BlockQuote --> Heading BlockQuote --> Emph BlockQuote --> Strong BlockQuote --> Del BlockQuote --> Link BlockQuote --> Image BlockQuote --> Table BlockQuote --> HorizontalRule BlockQuote --> Text BlockQuote --> HTMLBlock BlockQuote --> CodeBlock BlockQuote --> Softbreak BlockQuote --> Hardbreak BlockQuote --> Code BlockQuote --> HTMLSpan Item --> BlockQuote Item --> List Item --> Paragraph Item --> Heading Item --> Emph Item --> Strong Item --> Del Item --> Link Item --> Image Item --> Table Item --> HorizontalRule Item --> Text Item --> HTMLBlock Item --> CodeBlock Item --> Softbreak Item --> Hardbreak Item --> Code Item --> HTMLSpan List --> Item Table --> TableHead Table --> TableBody TableHead --> TableRow TableBody --> TableRow TableRow --> TableCell @enduml ```WIP renderer is hover there: https://github.com/MichaelMure/git-bug/pull/165 Of course, any help with that is much welcome. I can also re-license when it's done so it can be integrated here.
Some rendering examples:
![image](https://user-images.githubusercontent.com/294669/59146020-3ec69680-89ec-11e9-87ed-4364a3f598b0.png)