whistyun / Markdown.Avalonia

render markdown with Avalonia UI
MIT License
301 stars 24 forks source link

Built in styles override custom styles #142

Open eylvisaker opened 8 months ago

eylvisaker commented 8 months ago

I'm trying to make styles for the Markdown viewer that are applied to the whole application, because I intend to use several of them in different places in my app. The problem I'm having is my app is in dark mode, so I can't see heading text, since the built-in style sets it to black. I can only override the style by putting a Styles property on every MarkdownScrollViewer, which is really annoying.

For example: My custom style looks like this:

I get the correct styling on the MarkdownScrollViewer if I do this in a UserControl:

          <md:MarkdownScrollViewer xml:space="preserve" Margin="15,0">
            <md:MarkdownScrollViewer.Styles>
              <StyleInclude Source="/Theming/MarkdownStyles.axaml" />
            </md:MarkdownScrollViewer.Styles>
            # Login
            Please enter your username and password to log in.

But my custom styles are overriden if I do this:

# Login Please enter your username and password to log in.