whistyun / Markdown.Avalonia

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

I am here again #89

Closed dayAndnight2018 closed 1 year ago

dayAndnight2018 commented 1 year ago

I am here again just want to ask one question: could we upgrade the ui style ? first, I want the there has indent before subItems following head tags. just like this:

image

that must more beautiful if relative css style is supported.

then, a little bit not polite, do we consider Material Design?

dayAndnight2018 commented 1 year ago

Besides, could we set the image's width and height ?

dayAndnight2018 commented 1 year ago

@whistyun

whistyun commented 1 year ago

first, I want the there has indent before subItems following head tags. just like this:

Because of setence element is used in various elements, we should overwrite style various element.

If you use Fluent style, the bellow sample helps indent sentence element.

<!-- xmlns:md="clr-namespace:Markdown.Avalonia;assembly=Markdown.Avalonia" -->
<!-- xmlns:ctxt="clr-namespace:ColorTextBlock.Avalonia;assembly=ColorTextBlock.Avalonia" -->

<md:MarkdownScrollViewer>
  <md:MarkdownScrollViewer.Styles>
    <Style Selector="ctxt|CTextBlock">
      <Style.Setters>
        <Setter Property="Margin" Value="20,5,0,5" />
      </Style.Setters>
    </Style>

    <!-- revert margin for heading -->
    <Style Selector="ctxt|CTextBlock.Heading1, ctxt|CTextBlock.Heading2, ctxt|CTextBlock.Heading3, ctxt|CTextBlock.Heading4">
      <Style.Setters>
        <Setter Property="Margin" Value="0,5" />
      </Style.Setters>
    </Style>

    <!-- revert margin for table -->
    <Style Selector="Grid.Table > Border > ctxt|CTextBlock">
      <Style.Setters>
        <Setter Property="Margin" Value="0,5" />
      </Style.Setters>
    </Style>

    <!-- revert margin for list -->
    <Style Selector=".List ctxt|CTextBlock">
      <Style.Setters>
        <Setter Property="Margin" Value="0,5" />
      </Style.Setters>
    </Style>

    <!-- re-revert margin for list marker -->
    <Style Selector="ctxt|CTextBlock.ListMarker">
      <Style.Setters>
        <Setter Property="Margin" Value="0,5,5,5"/>
      </Style.Setters>
    </Style>
  </md:MarkdownScrollViewer.Styles>
</md:MarkdownScrollViewer>

image

whistyun commented 1 year ago

that must more beautiful if relative css style is supported.

I think so too. However, I think that the conversion from css to Avalonia style shoud be done via another library instead of Markdown library.

There are no plans to build a css parser now. If it does, it will be another library.

whistyun commented 1 year ago

Do we consider Material Design?

I are not considering adding proprietary styles that apply only within Markdown controls.

To avoid style inconsistencies, Markdown.Avalonia refers to the style theme used in the application (e.g. Avalonia.Themes.Fluent or Avalonia.Themes.Simple) to determine the style (e.g. SimpleTheme or FluentTheme).

I are considering adding styles for third parties that have their own styles (Aura.UI, FluentAvalonia, Material.Avalonia, etc.), but this approach risks library bloat and I'm wondering if I should really adopt it.