### App.xaml Example Source: https://github.com/whistyun/markdown.avalonia/wiki/Setup-AvaloniaEdit-for-syntax-hightlighting Example of how to add SimpleTheme and FluentAvaloniaTheme to App.xaml to enable AvaloniaEdit styles. ```xml ``` -------------------------------- ### AnyView.xaml Example Source: https://github.com/whistyun/markdown.avalonia/wiki/Setup-AvaloniaEdit-for-syntax-hightlighting Example of adding styles to MarkdownScrollViewer.Styles, including AvaloniaEdit's Simple theme. ```xml ``` -------------------------------- ### TextBox Example 1 Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdHtml/Out/UnitTest.Input.approved.txt Example of a multi-line TextBox accepting return and tab. ```XML ``` -------------------------------- ### Local and Resource Image Examples Source: https://github.com/whistyun/markdown.avalonia/blob/master/demos/Markdown.AvaloniaFluentAvaloniaDemo/Assets2/MainWindow.md Examples of how to embed local and resource images using Markdown syntax. ```markdown ![localimage](Assets2/ResourceImage.png) ![ResourceImage](Assets/ResourceImage.png) ``` -------------------------------- ### CheckBox Examples Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdHtml/Out/UnitTest.Input.approved.txt Examples of disabled and checked CheckBoxes. ```XML ``` ```XML ``` -------------------------------- ### TextBox Example 2 Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdHtml/Out/UnitTest.Input.approved.txt Example of a TextBox with specified width and height, accepting return and tab. ```XML ``` -------------------------------- ### Remote Image Examples Source: https://github.com/whistyun/markdown.avalonia/blob/master/demos/Markdown.AvaloniaFluentAvaloniaDemo/Assets2/MainWindow.md Examples of how to embed remote images using standard Markdown syntax. ```markdown ![image1](http://placehold.it/300x25) ![imageleft](http://placehold.it/150x25/0000FF "blue")![imageright](http://placehold.it/150x25/00FFFF "cyan") ``` -------------------------------- ### Slider Examples Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdHtml/Out/UnitTest.Input.approved.txt Examples of disabled Sliders with different configurations. ```XML ``` ```XML ``` ```XML ``` -------------------------------- ### Empty Cell Example 5 Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdHtml/Out/UnitTest.Table.approved.txt An empty cell example. ```XAML ``` -------------------------------- ### Empty Cell Example 6 Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdHtml/Out/UnitTest.Table.approved.txt An empty cell example. ```XAML ``` -------------------------------- ### Empty Cell Example 4 Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdHtml/Out/UnitTest.Table.approved.txt An empty cell example. ```XAML ``` -------------------------------- ### Note Block Syntax Source: https://github.com/whistyun/markdown.avalonia/wiki/How-to-use-Enhanched-syntax Example of proprietary syntax for creating note blocks. ```txt < notetext > some text

. notetext ``` -------------------------------- ### RadioButton Example Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdHtml/Out/UnitTest.Input.approved.txt Example of a disabled and checked RadioButton. ```XML ``` -------------------------------- ### Table Row Example 3 Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdHtml/Out/UnitTest.Table.approved.txt Another odd-numbered row example. ```XAML ``` -------------------------------- ### Table Row Example 5 Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdHtml/Out/UnitTest.Table.approved.txt An odd-numbered row example. ```XAML ``` -------------------------------- ### Plugin Block Example Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.Md/Texts/Mixing2.md An example of a plugin block in markdown. ```markdown ::: * one * two * three ::: ``` -------------------------------- ### Empty Cell Example 3 Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdHtml/Out/UnitTest.Table.approved.txt A third example of an empty cell. ```XAML ``` -------------------------------- ### Links Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdSyntax/Out/UnitTestMdSyntax.Transform_givenMixing_generatesExpectedResult.approved.txt Example of a basic link. ```xaml ``` -------------------------------- ### Custom Directive Example Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdSyntax/Texts/Mixing2.md An example of a custom directive with list items. ```markdown ::: plugin * one * two * three ::: ``` -------------------------------- ### Table Structure Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdHtml/Out/UnitTest.Table.approved.txt An example of how to define a table with rows and columns using Grid and Border elements in Avalonia XAML. ```xml ``` -------------------------------- ### Text Styles Example Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.Md/Out/UnitTestMd.Transform_givenTextStyles_generatesExpectedResult.approved.txt An example of how to use ColorTextBlock to render text with different styles. ```xml ``` -------------------------------- ### Markdown List Example Source: https://github.com/whistyun/markdown.avalonia/wiki/How-to-customise-style-List A simple Markdown example demonstrating how to create a list. ```md list example * listitem1 * listitem2 ``` -------------------------------- ### Table Row Example 4 Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdHtml/Out/UnitTest.Table.approved.txt An even-numbered row example. ```XAML ``` -------------------------------- ### Block Code Example Source: https://github.com/whistyun/markdown.avalonia/blob/master/demos/Markdown.AvaloniaDemo/MainWindow.md Demonstrates how to use block code formatting in MdXaml. ```c #include int main() { // printf() displays the string inside quotation printf("Hello, World!"); return 0; } ``` -------------------------------- ### Load .md from AvaloniaResource - .csproj Source: https://github.com/whistyun/markdown.avalonia/wiki/How-to-use Example of how to include a .md file as an AvaloniaResource in the .csproj file. ```xml ... ... ``` -------------------------------- ### Xaml Example Source: https://github.com/whistyun/markdown.avalonia/wiki/How-to-customise-loder This XAML snippet demonstrates how to set a custom bitmap loader for Markdown.Avalonia. ```xml ... ``` -------------------------------- ### Code Block Example Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.Md/Out/UnitTestMd.Transform_givenLists1_generatesExpectedResult.approved.txt A simple code block example. ```text code ``` -------------------------------- ### Markdown Examples with Custom Styles Source: https://github.com/whistyun/markdown.avalonia/wiki/How-to-customise-style-Hyperlink These Markdown examples show how to create hyperlinks, including one that applies the 'green' style by using the title attribute. ```markdown [hyperlinki1](http://example.com) [hyperlinki1](http://example.com "green") ``` -------------------------------- ### Progress Bar Example 2 Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdHtml/Out/UnitTest.Progres.approved.txt An example of a horizontal progress bar with Minimum=100, Maximum=200, and Value=100. ```xml ``` -------------------------------- ### With binding - viewmodel Source: https://github.com/whistyun/markdown.avalonia/wiki/How-to-use ViewModel code for the binding example, demonstrating how to expose markdown text via a property. ```csharp using ReactiveUI; namespace HowToUse { public class UseBindingViewModel : ReactiveObject { private string _MdText; public string MdText { get => _MdText; set => this.RaiseAndSetIfChanged(ref _MdText, value); } } } ``` -------------------------------- ### Table Structure Example 1 Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdHtml/Out/UnitTest.Table.approved.txt Defines the overall table structure with borders and grid layout. ```XAML ``` -------------------------------- ### Links with title Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdSyntax/Out/UnitTestMdSyntax.Transform_givenMixing_generatesExpectedResult.approved.txt Example of a link with a title. ```xaml ``` -------------------------------- ### Progress Bar Example 1 Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdHtml/Out/UnitTest.Progres.approved.txt An example of a horizontal progress bar with Minimum=10, Maximum=60, and Value=25. ```xml ``` -------------------------------- ### Xaml Example Source: https://github.com/whistyun/markdown.avalonia/wiki/How-to-customise-linkaction This XAML snippet demonstrates how to set a custom ICommand for hyperlink actions in Markdown.Avalonia. ```xml ... ``` -------------------------------- ### Load .md from AvaloniaResource Source: https://github.com/whistyun/markdown.avalonia/blob/master/pack_readme/Markdown.Avalonia.Tight.md Example of loading a markdown file from an Avalonia Resource using Markdown.Avalonia. ```xml ``` -------------------------------- ### With binding Source: https://github.com/whistyun/markdown.avalonia/blob/master/pack_readme/Markdown.Avalonia.Tight.md Example of using data binding to provide markdown content to Markdown.Avalonia. ```xml ``` -------------------------------- ### Load .md from AvaloniaResource Source: https://github.com/whistyun/markdown.avalonia/blob/master/pack_readme/Markdown.Avalonia.md Example of loading a markdown file from AvaloniaResource using Markdown.Avalonia. ```xml ``` -------------------------------- ### Ordered Lists - Tight Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdSyntax/Texts/Lists1.md Examples of tight ordered lists. ```markdown 1. First 2. Second 3. Third ``` ```markdown 1. One 2. Two 3. Three ``` -------------------------------- ### List Item Separators Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdSyntax/Texts/Lists1.md Examples demonstrating list item separators. ```markdown * one * one * one * * * * two ``` code ``` * three > quote * four # head * four ## head ``` ```markdown * one * * * * two ``` code ``` * three > quote * four # head * four ## head ``` -------------------------------- ### MyBitmapLoader.cs Example Source: https://github.com/whistyun/markdown.avalonia/wiki/How-to-customise-loder This C# code defines a custom bitmap loader class that implements the IBitmapLoader interface. ```csharp // using Markdown.Avalonia.Utils; public class MyBitmapLoader : IBitmapLoader { // local file root path, the default is current directory. public string AssetPathRoot { set; private get; } // The url of the image described in markdown is passed to urlTxt as it is. // relative path remains relative path, absolute path remain absolute path. public Bitmap Get(string urlTxt) { // load any image. // If you return null, Markdown.Avalonia considers it a load failure // and displays an alternative error image. return null; } } ``` -------------------------------- ### Write markdown in xaml - Sample Source: https://github.com/whistyun/markdown.avalonia/wiki/How-to-use Example of writing markdown directly within a MarkdownScrollViewer in an .axaml file. ```xml # Heading1 Hello Markdown.Avalonia! * listitem1 * listitem2 | col1 | col2 | col3 | |------|------|------| | one |------|------| | two |------|------| ``` -------------------------------- ### Write markdown in xaml Source: https://github.com/whistyun/markdown.avalonia/blob/master/pack_readme/Markdown.Avalonia.Tight.md Example of writing markdown directly within XAML using Markdown.Avalonia. ```xml # Heading1 Hello Markdown.Avalonia! ``` -------------------------------- ### Text Decoration Source: https://github.com/whistyun/markdown.avalonia/wiki/How-to-use-Enhanched-syntax This example shows how to use standard and proprietary syntax for italic, bold, strikethrough, underline, and color text. ```txt Name |Type |Format ---------------|-----------|---------------------------- italic |Standard | *italic* bold |Standard | **bold** bold-italic |Standard | ***bold-italic*** strikethrough |Standard | ~~strikethrough~~ underline |Proprietary| __underline__ color-text(1) |Proprietary| %{color:red}colortext% color-text(2) |Proprietary| %{color:#00FF00}colortext% bgcolor-text(1)|Proprietary| %{background:red}colortext% bgcolor-text(2)|Proprietary| %{background:#FF00FF}colortext% color&bgcolor |Proprietary| %{color:red; background:yellow}colortext% ``` -------------------------------- ### Custom Container Block Handlers Source: https://github.com/whistyun/markdown.avalonia/wiki/How-to-use-Enhanched-syntax Example C# code demonstrating how to create custom container block handlers by implementing the IContainerBlockHandler interface. ```cs using Markdown.Avalonia.Utils; class MyBlockHandler1 : IContainerBlockHandler { public Border ProvideControl(string assetPathRoot, string blockName, string lines) { return new Border() { Child = new Button() { Content = $"MyBlockHandler1[{blockName}]\nlines[{lines}]" } }; } } class MyBlockHandler2 : IContainerBlockHandler { public Border ProvideControl(string assetPathRoot, string blockName, string lines) { return new Border() { Child = new TextBox() { Text = $"MyBlockHandler2[{blockName}]\nlines[{lines}]" } }; } } ``` -------------------------------- ### Setting up ChatAI Mode Source: https://github.com/whistyun/markdown.avalonia/wiki/How-to-use-Enhanched-syntax Example XAML code for setting up the ChatAI mode plugin in Markdown.Avalonia, which disables some enhanced syntax and enables code pre-rendering. ```xml ``` -------------------------------- ### Text Alignment Source: https://github.com/whistyun/markdown.avalonia/wiki/How-to-use-Enhanched-syntax This example demonstrates proprietary syntax for left, right, and center text alignment within paragraphs. ```txt p<. arrange paragraph left-side. p>. arrange paragraph right-side. p=. arrange paragraph center. p=>. inner paragraph is ignored. ``` -------------------------------- ### List Formatting Source: https://github.com/whistyun/markdown.avalonia/wiki/How-to-use-Enhanched-syntax Examples of proprietary adaptations for ordered lists using alphabetic (lowercase and uppercase) and roman numerals (lowercase and uppercase). ```txt #### alphabet-ol (Proprietary adaptations) a. one b. two #### alphabet-ol (Proprietary adaptations) A. one B. two #### roman-ol (Proprietary adaptations) i, one ii, two #### roman-ol (Proprietary adaptations) I, one II, two ``` -------------------------------- ### Disabled Button Example Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdHtml/Out/UnitTest.Button.approved.txt An example of a disabled button with no content. ```xml ``` -------------------------------- ### Markdown Examples Source: https://github.com/whistyun/markdown.avalonia/wiki/How-to-customise-style-Code Demonstrates inline code and code blocks in Markdown format, including a standard code block and a C-language specific code block. ```md inline code: `this is inline.` ``` #include int main() { // printf() displays the string inside quotation printf("Hello, World!"); return 0; } ``` --- ```c #include int main() { // printf() displays the string inside quotation printf("Hello, World!"); return 0; } ``` ``` -------------------------------- ### Empty Cell Example 2 Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdHtml/Out/UnitTest.Table.approved.txt Another representation of an empty cell. ```XAML ``` -------------------------------- ### Table Colspan and Rowspan Source: https://github.com/whistyun/markdown.avalonia/wiki/How-to-use-Enhanched-syntax Example of proprietary table syntax for colspan and rowspan, influenced by textile format. ```txt | column1 | column2 | column4 | column5 | |-------------|---------------|---------------|----------| |\2. colspan2 |/3\2. row3&col2 | |/2. rowspan2 |<. left-algn | |=. center-algn | | hoge |>. right-align | hoge | hoge | ``` -------------------------------- ### Empty Cell Example Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdHtml/Out/UnitTest.Table.approved.txt Represents an empty cell within the table grid. ```XAML ``` -------------------------------- ### View Example Source: https://github.com/whistyun/markdown.avalonia/wiki/Image-loading-priority XAML snippet demonstrating how to use MarkdownScrollViewer with AssetPathRoot to specify the base path for loading assets. ```xml ``` -------------------------------- ### Table Row Example 2 Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdHtml/Out/UnitTest.Table.approved.txt This snippet shows an even-numbered table row with a single cell. ```XAML ``` -------------------------------- ### Table Linebreak Handling Source: https://github.com/whistyun/markdown.avalonia/wiki/How-to-use-Enhanched-syntax Demonstrates how Markdown.Avalonia treats newline characters within table cells as linebreaks and how to use escape sequences to prevent this. ```txt | column1\nwith linebreak | column2 | |-----------------------------|---------------| | text\nwith\nlinebreak | text\\nnobreak| ``` -------------------------------- ### Custom Link Command Implementation Source: https://github.com/whistyun/markdown.avalonia/wiki/How-to-customise-linkaction This C# code shows a sample implementation of a custom ICommand to handle hyperlink clicks, demonstrating how to access the URL and use a default command to navigate. ```cs public class MyLinkCommand : ICommand { public event EventHandler CanExecuteChanged; public bool CanExecute(object parameter) => true; // parameter is only string. // The url described in markdown is passed to parameter as it is. // relative path remains relative path, absolute path remain absolute path. public void Execute(object parameter) { var urlTxt = (string)parameter; Markdown.Avalonia.Utils.DefaultHyperlinkCommand.GoTo("http://example.com"); } } ``` -------------------------------- ### Table Row Example 1 Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdHtml/Out/UnitTest.Table.approved.txt This snippet demonstrates the structure for an odd-numbered table row with a single cell containing text. ```XAML ``` -------------------------------- ### ViewModel Example Source: https://github.com/whistyun/markdown.avalonia/wiki/Image-loading-priority C# snippet showing ViewModel properties and a method to load markdown content and set the asset path root for image loading. ```cs public string Text { ... } public string RootDir { ... } public void OpenFile(string filepath){ Text = File.ReadAllText(filepath); RootDir = Path.GetDirectoryName(filepath); } ``` -------------------------------- ### Nested Lists Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdSyntax/Texts/Lists1.md Examples of nested unordered and ordered lists. ```markdown * Tab * Tab * Tab ``` ```markdown 1. First 2. Second: * Fee * Fie * Foe 3. Third ``` ```markdown 1. First 2. Second: * Fee * Fie * Foe 3. Third ``` ```markdown * this * sub that ``` -------------------------------- ### Grid Row Definitions Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdHtml/Out/UnitTest.Table.approved.txt Defines the row structure for the grid. ```XAML ``` -------------------------------- ### Markdown.Avalonia.Tight csproj configuration Source: https://github.com/whistyun/markdown.avalonia/wiki/migrates/How-to-migrages-to-ver11 This snippet shows how to add the Markdown.Avalonia.Tight package to your project file. ```xml ``` -------------------------------- ### Grid Column Definitions Source: https://github.com/whistyun/markdown.avalonia/blob/master/tests/UnitTest.MdHtml/Out/UnitTest.Table.approved.txt Defines the column structure for the grid. ```XAML ```