xoofx / markdig

A fast, powerful, CommonMark compliant, extensible Markdown processor for .NET
BSD 2-Clause "Simplified" License
4.21k stars 444 forks source link

Guidance for implementing a SkiaSharp renderer #804

Open kpko opened 2 weeks ago

kpko commented 2 weeks ago

Hi!

I'm interested in implementing a custom renderer for Markdig to render to SkiaSharp. SkiaSharp provides a "Canvas" element with methods like DrawLine, DrawImage, DrawText etc. That would make it possible to render to PNGs, PDFs...

Could somebody give me a starting point? I got a bit confused by the Normalize-Render classes, ObjectRenderers.. What would be the easiest point to start an implementation? Also, what would be the best thing to make the implementation as complete as possible (i.e. no missing renderers for components)?

Thank you very much!

xoofx commented 6 days ago

You can try to get some inspiration from https://github.com/Kryptos-FR/markdig.wpf/tree/main/src/Markdig.Wpf/Renderers/Wpf which translates a Markdown document to WPF elements.