I’m new in GTK but looking for C or C++ library to simply convert Markdown document to it Pango representation.
Is any solutions for these needs?
I’m new in GTK but looking for C or C++ library to simply convert Markdown document to it Pango representation.
Is any solutions for these needs?
There is absolutely nothing “simple” about Markdown. First of all: which Markdown? The original, John Gruber flavour? CommonMark’s? GitHub’s? Python-Markdown’s? Then: what happens to embedded HTML blocks, which Markdown specifically allows?
The only solution for presenting Markdown to users is to go through a proper Markdown parser and turn it into HTML, which means using a web renderer.
By the fact, I’m working on GTK browser for Gemini protocol, where it own “simplified” markdown fork available that called Gemtext.
I’ve successfully wrote Gemtext converter for pango in PHP, by using available Pango tags.
Now re-writing my app in C++ and thoughts maybe some libraries available for similar needs, to not make it from zero… I believe most of tags there could be converted to the Pango representation for reading in Label widget, for example.
If you made your own flavour of Markdown then you also get to write your own parser/converter.
I’d actually strongly recommend you ignore the markup entirely, and directly use PangoAttribute
; this way, at least, you’ll be able to ignore anything that does not conform to your Markdown.
Okay, thanks much for a tip!