-
Notifications
You must be signed in to change notification settings - Fork 26
How to use Enhanched syntax
Markdown.Avalonia support italic, bold, strikethrough, underline, and color text.
Below table shows each idioms.
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%
Markdown.Avalonia support text-alignment. It is base on textile.
- If put 'p<.' to paragraph-start, Markdown.Avalonia arrange paragraph left-side.
- If put 'p>.' to paragraph-start, Markdown.Avalonia arrange paragraph right-side.
- If put 'p=.' to paragraph-start, Markdown.Avalonia arrange paragraph center.
p<. arrange paragraph left-side.
p>. arrange paragraph right-side.
p=. arrange paragraph center.
p=>. inner paragraph is ignored.
#### 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
Markdown.Avalonia treats '\n' which is contained in the cell of tables as linebreak. If you don't want it, use escape sequence.
| column1\nwith linebreak | column2 |
|-----------------------------|---------------|
| text\nwith\nlinebreak | text\\nnobreak|
Markdown.Avalonia extends table format to explain colspan and rowspan. Its format is Influenced by textile.
| column1 | column2 | column4 | column5 |
|-------------|---------------|---------------|----------|
|\2. colspan2 |/3\2. row3&col2 |
|/2. rowspan2 |<. left-algn |
|=. center-algn |
| hoge |>. right-align | hoge | hoge |
Type any character between pipe(|) and period(.), and Markdown.Avalonia parse it.
char | details |
---|---|
\ | column span: after character parse as the number as columns. |
/ | row span: after character parse as the number as rows. |
< | left alignment |
> | right alignment |
= | center |
If you don't want to parse, type space after pipe(|).
| column1 | column2 |
|-------------|---------------|
|\2. parse as column span |
| \2. ignore | hoge |
Markdown.Avalonia provide four type rules (---
, ===
, ***
and ___
).
---
, ***
and ___
are provided with standard.
However Markdown.Avalonia render theirs with different looks.
single line
---
two lines
===
bold line
***
bold with single
___
< notetext >
some text
<p>. notetext
This is partial support of https://talk.commonmark.org/t/generic-directives-plugins-syntax/444. This feature allows to expand markdown functionality with pluggable content handling.
::: plugin_name
some lines
:::
How to create a container block handler
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}]"
}
};
}
}
How to include container block handlers
<md:MarkdownScrollViewer>
<md:MarkdownScrollViewer.Engine>
<md:Markdown>
<md:Markdown.ContainerBlockHandler>
<md:ContainerSwitch>
<markdownEx:MyBlockHandler1 x:Key="plugin_name1"/>
<markdownEx:MyBlockHandler2 x:Key="plugin_name2"/>
</md:ContainerSwitch>
</md:Markdown.ContainerBlockHandler>
</md:Markdown>
</md:MarkdownScrollViewer.Engine>
</md:MarkdownScrollViewer>
demo
Markdown.Avalonia has a build-in plugin for ChatGPT; ChatAISetup
.
This plugin disables some ehnaced syntax and enable code pre-rendering.
<!--
xmlns:md=
"https://github.com/whistyun/Markdown.Avalonia"
or
"https://github.com/whistyun/Markdown.Avalonia.Tight"
xmlns:mdt=
"https://github.com/whistyun/Markdown.Avalonia.Tight"
-->
<md:MarkdownScrollViewer>
<md:MarkdownScrollViewer.Plugins>
<md:MdAvPlugins>
<mdt:ChatAISetup/>
</md:MdAvPlugins>
</md:MarkdownScrollViewer.Plugins>
</md:MarkdownScrollViewer>