Comments (4)
For now, Sasabune***
style only works on MarkdownScrollViewer
.
And It don't references FlowDocument properties but MarkdownScrollViewer
properties.
Markdown engine = new();
FlowDocument document = engine.Transform("# Heading1\n## Heading2\n### Heading3\n#### Heading3\nfoo bar text\n|head1|head2|\n|-|-|\n|body1|body2|");
document.Style = MarkdownStyle.SasabuneStandard;
// MarkdownScrollViewer MSV = new();
MSV.Document = document;
MSV.Background = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0));
MSV.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));
from mdxaml.
as soon, I have style, Header 1 2 3 don't work anymore for me,
only R0C0 with no style ( style in Xaml, but don't work header is not red or blue ).
`
Markdown engine = new();
//string markdownTxt = "";
string markdownTxt = "# Heading1\n## Heading2\n### Heading3\n#### Heading3\nfoo bar text\n|head1|head2|\n|-|-|\n|body1|body2|";
//string markdownTxt = System.IO.File.ReadAllText("example.md");
FlowDocument document1 = engine.Transform("# Heading1\n## Heading2\n# 1-R0C0 Style XAML\n" + markdownTxt);
FlowDocument document2 = engine.Transform("# Heading1\n## Heading2\n# 2-R1C0 Sasabune\n" + markdownTxt);
FlowDocument document3 = engine.Transform("# Heading1\n## Heading2\n# 3-R0C1 SasabuneCompact\n" + markdownTxt);
FlowDocument document4 = engine.Transform("# Heading1\n## Heading2\n# 4-R1C1 SasabuneStandard\n" + markdownTxt);
// Document.Style = MarkdownStyle.Sasabune; ( style in xaml )
MSV_R0C0.Document = document1;
MSV_R0C0.Document.Background = new SolidColorBrush( Color.FromArgb(255, 0, 0, 0)); // a,r,g,b
MSV_R0C0.Document.Foreground = new SolidColorBrush( Color.FromArgb(255, 255, 255,255));
document2.Style = MarkdownStyle.Sasabune;
MSV_R1C0.Document = document2;
MSV_R1C0.Document.Background = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0));
MSV_R1C0.Document.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));
document3.Style = MarkdownStyle.SasabuneCompact;
MSV_R0C1.Document = document3;
MSV_R0C1.Document.Background = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0));
MSV_R0C1.Document.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));
document4.Style = MarkdownStyle.SasabuneStandard;
MSV_R1C1.Document = document4;
MSV_R1C1.Document.Background = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0));
MSV_R1C1.Document.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));
`
`
xmlns:mdxam="clr-namespace:MdXaml;assembly=MdXaml"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800"
Loaded="Window_Loaded">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50*"/>
<RowDefinition Height="50*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50*"/>
<ColumnDefinition Width="50*"/>
</Grid.ColumnDefinitions>
<Grid.Resources>
<Style x:Key="MdStyle" TargetType="FlowDocument">
<Style.Resources>
<Style TargetType="Paragraph">
<Style.Triggers>
<Trigger Property="Tag" Value="Heading1">
<Setter Property="FontSize" Value="42" />
<Setter Property="Foreground" Value="Red" />
<Setter Property="FontWeight" Value="Light" />
</Trigger>
<Trigger Property="Tag" Value="Heading2">
<Setter Property="FontSize" Value="20" />
<Setter Property="Foreground" Value="Blue" />
<Setter Property="FontWeight" Value="Light" />
</Trigger>
</Style.Triggers>
</Style>
</Style.Resources>
</Style>
</Grid.Resources>
<mdxam:MarkdownScrollViewer
x:Name="MSV_R0C0"
Grid.Row="0" Grid.Column="0"
MarkdownStyle="{StaticResource ResourceKey=MdStyle}"
xml:space="preserve">
# Heading R0C0
## Heading 2
content
</mdxam:MarkdownScrollViewer>
<mdxam:MarkdownScrollViewer
x:Name="MSV_R1C0"
Grid.Row="1" Grid.Column="0"
xml:space="preserve">
# Heading R1C0
## Heading 2
content
</mdxam:MarkdownScrollViewer>
<mdxam:MarkdownScrollViewer
x:Name="MSV_R0C1"
Grid.Row="0" Grid.Column="1"
xml:space="preserve">
# Heading R0C1
## Heading 2
content
</mdxam:MarkdownScrollViewer>
<mdxam:MarkdownScrollViewer
x:Name="MSV_R1C1"
Grid.Row="1" Grid.Column="1"
xml:space="preserve">
# Heading R1C1
## Heading 2
content
</mdxam:MarkdownScrollViewer>
</Grid>
from mdxaml.
Please modify your code as the bellow.
MSV_R0C0.Document = document1;
MSV_R0C0.Background = new SolidColorBrush( Color.FromArgb(255, 0, 0, 0)); // a,r,g,b
MSV_R0C0.Foreground = new SolidColorBrush( Color.FromArgb(255, 255, 255,255));
document2.Style = MarkdownStyle.Sasabune;
MSV_R1C0.Document = document2;
MSV_R1C0.Background = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0));
MSV_R1C0.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));
document3.Style = MarkdownStyle.SasabuneCompact;
MSV_R0C1.Document = document3;
MSV_R0C1.Background = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0));
MSV_R0C1.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));
document4.Style = MarkdownStyle.SasabuneStandard;
MSV_R1C1.Document = document4;
MSV_R1C1.Background = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0));
MSV_R1C1.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));
Sasabune***(Sasabune, SasabuneCompact and SasabuneStandard) refers only to the direct properties of MarkdownScrollViewer.
from mdxaml.
merci @whistyun
Yes it's work fine, sorry I don't see in your first post, the subtle difference between set at document level vs set at Viewer level.
Have a good day.
Laura
from mdxaml.
Related Issues (20)
- Bolding first word in unordered list not rendering correctly HOT 3
- Document is null in class constructor HOT 6
- Is there a way to turn off specific list markers (question) HOT 3
- Table of contents or links to anchors HOT 2
- How to Copy code from code block in md ? HOT 1
- Image Scaling and Gif support HOT 1
- Spoilers support (details) HOT 7
- Different code styles HOT 4
- scroll-wheel-hijack HOT 1
- Open Hyper Link crashes when no web browser is installed HOT 1
- Extension point for code highligting
- Aligning headers?
- [Question] Is there a easy way to activate smooth scrolling ?
- Escape character \ not working correctly
- Navigating to another markdown file, and anchors HOT 2
- [Question] Is there any way to adjust the width of columns in a table?
- Memory Leak in MarkdownScrollViewer HOT 1
- MdXaml 1.24.0 depends on AvalonEdit (>= 6.3.0) but AvalonEdit 6.3.0 was not found. An approximate best match of AvalonEdit 6.3.0.90 was resolved.
- image question.
- Many styles are not fully rendered
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mdxaml.