mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-03 21:36:36 +00:00
Change Default font in a WinUI3 application (WebView2) #612
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 @BertrandDeSaintBezier on GitHub (Jul 5, 2023).
Hi :)
I'm using Markdig in a WinUI3-type framework to spit out .md files as .html in a WebView2 UIElement. The text comes out in a font that doesn't match well with the rest of the application. I was wondering how you would go about changing the default font (and other properties ?). I'm guessing something to do with ResourceDictionaries ? Unsure how to proceed.
Thanks !
@xoofx commented on GitHub (Jul 5, 2023):
Markdig only generates a HTML fragment, not a full page, so you should have control over the HTML page (the head+body) and where you insert this fragment and then you can change CSS properties the way you want, as for a regular HTML page.
@BertrandDeSaintBezier commented on GitHub (Jul 6, 2023):
Wonderful, thanks very much !
I was using this in a WebView2 so I don't know if this is the best way of going about things, but I essentially just concatenated some css styling to the front of the converted markdown :
This ended up working perfectly as a starting point. I'm still fiddling around with things before I settle on the nicest way of doing it.
Hope this helps someone :)