Assistance Request: Displaying Markdown in WPF Application #90

Closed
opened 2026-01-29 14:26:01 +00:00 by claunia · 3 comments
Owner

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!

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!
claunia added the question label 2026-01-29 14:26:01 +00:00
Author
Owner

@xoofx commented on GitHub (Feb 14, 2017):

Either use a HTML browser control or try to help developing @Kryptos-FR initiative markdig-wpf

@xoofx commented on GitHub (Feb 14, 2017): Either use a HTML browser control or try to help developing @Kryptos-FR initiative [markdig-wpf](https://github.com/Kryptos-FR/markdig-wpf)
Author
Owner

@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.

@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.
Author
Owner

@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, and WebBrowserHostUiHandler.

@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, and `WebBrowserHostUiHandler`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#90