mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-08 05:44:58 +00:00
Assistance Request: Displaying Markdown in WPF Application #90
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @amkuchta on GitHub (Feb 14, 2017).
Question
Hello all! What would be the best way to use Markdig to render markdown into a WPF control (e.g.
FlowDocument)? Is this even possible using this library?Use Case:
I want to include a "user Gudie" in my application, which I already have some markdown files generated for 9they are currently housed on the Wiki, but not all users will have internet connectivity when using the app). I want to be able to parse these files and display the content within a control in the application - my initial thought is to use a
FlowDocument, but if there is a better way, I am all for it.Thank in advance!
@xoofx commented on GitHub (Feb 14, 2017):
Either use a HTML browser control or try to help developing @Kryptos-FR initiative markdig-wpf
@Kryptos-FR commented on GitHub (Feb 14, 2017):
Thanks @xoofx for mentioning my humble attempt. Currently markdig-wpf works in simple cases (actually only the XAML renderer). I did not have time recently to continue working on it. I'm happy to accept any contribution.
@RickStrahl commented on GitHub (Feb 23, 2017):
@amkuchta The WPF WebBrowser control is the easiest way to display Markdown, but you need to make sure you get it to render in the proper IE mode with edge mode headers, or by tweaking the registry for the executable. Running in IE 11 mode works very well, and easy if you're only rendering (MM also uses it for the editor using ACE editor which has a few quirks but still works very well).
If you need to interact with the WebBrowser control and you need to deal with high DPI and a few other things it gets bit more complicated as you have to implement the raw COM interfaces to capture the messaging. I've done all of this in MM and you can look at the code there if that helps. Specifically
InitializePreviewBrowser()in the main form, andWebBrowserHostUiHandler.