Closed Shattienator closed 1 year ago
In v0.10.12 and v11.0.0-a4, We add the UseResource
property.
If this property is set to True, Markdown.Avalonia
looks for images from Resources.
The value, which is set to Resources, should be Avalonia.Media.Imaging.Bitmap
or Avalonia.Controls.Control
If there is no image in Resources, Markdown.Avalonia
searches using the same rules as before.
example
<!-- xmlns:md="clr-namespace:Markdown.Avalonia;assembly=Markdown.Avalonia" -->
<Panel>
<Panel.Resources>
<Image x:Key="MyImage" Source="/Assets/ResourceImage.png"/>
</Panel.Resources>
<md:MarkdownScrollViewer UseResource="True" xml:space="preserve">
<md:MarkdownScrollViewer.Resources>
<Button x:Key="MyButton" Content="Hello Button"/>
</md:MarkdownScrollViewer.Resources>
## Image ##
![](MyButton)
![](MyImage)
</md:MarkdownScrollViewer>
</Panel>
For programmatically generated MD string it is very usefull to feed not only external images from URI or app resources, but from inmemory image - for example I want to add LiveCharts chart as image, but have no find options to feed these kind or images as source. It is possible to save temp image and feed it to MD as a local image, but it is not a good solution.