diff --git a/components/MarkdownTextBlock/samples/MarkdownTextBlockCustomSample.xaml b/components/MarkdownTextBlock/samples/MarkdownTextBlockCustomSample.xaml
index 69430b398..5660a44ae 100644
--- a/components/MarkdownTextBlock/samples/MarkdownTextBlockCustomSample.xaml
+++ b/components/MarkdownTextBlock/samples/MarkdownTextBlockCustomSample.xaml
@@ -1,4 +1,4 @@
-
+
+ DisableHtml="{x:Bind DisableHtml, Mode=OneWay}"
+ Text="{x:Bind MarkdownTextBox.Text, Mode=OneWay}"
+ UseAutoLinks="{x:Bind UseAutoLinks, Mode=OneWay}"
+ UseEmphasisExtras="{x:Bind UseEmphasisExtras, Mode=OneWay}"
+ UseListExtras="{x:Bind UseListExtras, Mode=OneWay}"
+ UsePipeTables="{x:Bind UsePipeTables, Mode=OneWay}"
+ UseSoftlineBreakAsHardlineBreak="{x:Bind UseSoftlineBreakAsHardlineBreak, Mode=OneWay}"
+ UseTaskLists="{x:Bind UseTaskLists, Mode=OneWay}" />
diff --git a/components/MarkdownTextBlock/samples/MarkdownTextBlockCustomSample.xaml.cs b/components/MarkdownTextBlock/samples/MarkdownTextBlockCustomSample.xaml.cs
index 413bd1d6e..6b411430f 100644
--- a/components/MarkdownTextBlock/samples/MarkdownTextBlockCustomSample.xaml.cs
+++ b/components/MarkdownTextBlock/samples/MarkdownTextBlockCustomSample.xaml.cs
@@ -9,6 +9,13 @@ namespace MarkdownTextBlockExperiment.Samples;
///
/// An example sample page of a custom control inheriting from Panel.
///
+[ToolkitSampleBoolOption("UseEmphasisExtras", false, Title = "UseEmphasisExtras")]
+[ToolkitSampleBoolOption("UsePipeTables", false, Title = "UsePipeTables")]
+[ToolkitSampleBoolOption("UseListExtras", false, Title = "UseListExtras")]
+[ToolkitSampleBoolOption("UseTaskLists", false, Title = "UseTaskLists")]
+[ToolkitSampleBoolOption("UseAutoLinks", false, Title = "UseAutoLinks")]
+[ToolkitSampleBoolOption("DisableHtml", false, Title = "DisableHtml")]
+[ToolkitSampleBoolOption("UseSoftlineBreakAsHardlineBreak", false, Title = "UseSoftlineBreakAsHardlineBreak")]
[ToolkitSample(id: nameof(MarkdownTextBlockCustomSample), "Custom control", description: $"A sample for showing how to create and use a {nameof(CommunityToolkit.Labs.WinUI.MarkdownTextBlock)} custom control.")]
public sealed partial class MarkdownTextBlockCustomSample : Page
{
diff --git a/components/MarkdownTextBlock/src/MarkdownTextBlock.Properties.cs b/components/MarkdownTextBlock/src/MarkdownTextBlock.Properties.cs
index fb0bd4180..c72d17814 100644
--- a/components/MarkdownTextBlock/src/MarkdownTextBlock.Properties.cs
+++ b/components/MarkdownTextBlock/src/MarkdownTextBlock.Properties.cs
@@ -70,7 +70,16 @@ public partial class MarkdownTextBlock
nameof(UseAutoLinks),
typeof(bool),
typeof(MarkdownTextBlock),
- new PropertyMetadata(false));
+ new PropertyMetadata(false));
+
+ ///
+ /// Identifies the dependency property.
+ ///
+ private static readonly DependencyProperty DisableHtmlProperty = DependencyProperty.Register(
+ nameof(DisableHtmlProperty),
+ typeof(bool),
+ typeof(MarkdownTextBlock),
+ new PropertyMetadata(false));
///
/// Identifies the dependency property.
@@ -148,7 +157,16 @@ public bool UseAutoLinks
{
get => (bool)GetValue(UseAutoLinksProperty);
set => SetValue(UseAutoLinksProperty, value);
- }
+ }
+
+ ///
+ /// If true, Disables HTML parsing.
+ ///
+ public bool DisableHtml
+ {
+ get => (bool)GetValue(DisableHtmlProperty);
+ set => SetValue(DisableHtmlProperty, value);
+ }
///
/// If true, considers single newlines as hardline breaks.
diff --git a/components/MarkdownTextBlock/src/MarkdownTextBlock.xaml.cs b/components/MarkdownTextBlock/src/MarkdownTextBlock.xaml.cs
index fb3e6f4aa..818d4249b 100644
--- a/components/MarkdownTextBlock/src/MarkdownTextBlock.xaml.cs
+++ b/components/MarkdownTextBlock/src/MarkdownTextBlock.xaml.cs
@@ -59,7 +59,8 @@ protected override void OnApplyTemplate()
if (UseListExtras) pipelineBuilder = pipelineBuilder.UseListExtras();
if (UseTaskLists) pipelineBuilder = pipelineBuilder.UseTaskLists();
if (UseAutoLinks) pipelineBuilder = pipelineBuilder.UseAutoLinks();
- if (UseSoftlineBreakAsHardlineBreak) pipelineBuilder = pipelineBuilder.UseSoftlineBreakAsHardlineBreak();
+ if (UseSoftlineBreakAsHardlineBreak) pipelineBuilder = pipelineBuilder.UseSoftlineBreakAsHardlineBreak();
+ if (DisableHtml) pipelineBuilder = pipelineBuilder.DisableHtml();
_pipeline = pipelineBuilder.Build();
@@ -110,14 +111,14 @@ private void Build()
_renderer.ObjectRenderers.Add(new ParagraphRenderer());
_renderer.ObjectRenderers.Add(new QuoteBlockRenderer());
_renderer.ObjectRenderers.Add(new ThematicBreakRenderer());
- _renderer.ObjectRenderers.Add(new HtmlBlockRenderer());
+ if (!DisableHtml) _renderer.ObjectRenderers.Add(new HtmlBlockRenderer());
// Default inline renderers
if (UseAutoLinks) _renderer.ObjectRenderers.Add(new AutoLinkInlineRenderer());
_renderer.ObjectRenderers.Add(new CodeInlineRenderer());
_renderer.ObjectRenderers.Add(new DelimiterInlineRenderer());
_renderer.ObjectRenderers.Add(new EmphasisInlineRenderer());
- _renderer.ObjectRenderers.Add(new HtmlEntityInlineRenderer());
+ if (!DisableHtml) _renderer.ObjectRenderers.Add(new HtmlEntityInlineRenderer());
_renderer.ObjectRenderers.Add(new LineBreakInlineRenderer());
_renderer.ObjectRenderers.Add(new LinkInlineRenderer());
_renderer.ObjectRenderers.Add(new LiteralInlineRenderer());
@@ -125,8 +126,8 @@ private void Build()
// Extension renderers
if (UsePipeTables) _renderer.ObjectRenderers.Add(new TableRenderer());
- if (UseTaskLists) _renderer.ObjectRenderers.Add(new TaskListRenderer());
- _renderer.ObjectRenderers.Add(new HtmlInlineRenderer());
+ if (UseTaskLists) _renderer.ObjectRenderers.Add(new TaskListRenderer());
+ if (!DisableHtml) _renderer.ObjectRenderers.Add(new HtmlInlineRenderer());
}
_pipeline.Setup(_renderer);
ApplyText(false);
diff --git a/tooling b/tooling
index 660f1b8d0..64e945b38 160000
--- a/tooling
+++ b/tooling
@@ -1 +1 @@
-Subproject commit 660f1b8d0dc7f75584b62e79f36d03c1636579c0
+Subproject commit 64e945b3850735187c887421ccd23f4e05814e55