diff --git a/src/MudBlazor.Markdown/Helpers/MudMarkdownStyling.cs b/src/MudBlazor.Markdown/Helpers/MudMarkdownStyling.cs
index d89dff6d..fd8b2276 100644
--- a/src/MudBlazor.Markdown/Helpers/MudMarkdownStyling.cs
+++ b/src/MudBlazor.Markdown/Helpers/MudMarkdownStyling.cs
@@ -25,23 +25,43 @@ public sealed class TableStyling
///
/// If true, striped table rows will be used.
///
+ ///
+ /// Defaults to true.
+ ///
public bool IsStriped { get; set; } = true;
///
/// If true, table's cells will have left/right borders.
///
+ ///
+ /// Defaults to true.
+ ///
public bool IsBordered { get; set; } = true;
///
/// Child content of component.
///
+ ///
+ /// Defaults to 1.
+ ///
public int Elevation { set; get; } = 1;
///
/// Minimum width (in pixels) for a table cell.
/// If or negative the minimum width is not applied.
///
+ ///
+ /// Defaults to null.
+ ///
public int? CellMinWidth { get; set; }
+
+ ///
+ /// Uses compact padding for all rows.
+ ///
+ ///
+ /// Defaults to false.
+ ///
+ public bool Dense { get; set; }
}
///
@@ -52,6 +72,9 @@ public sealed class LinkStyling
///
/// Underline style.
///
+ ///
+ /// Defaults to Hover.
+ ///
public Underline Underline { get; set; } = Underline.Hover;
}
diff --git a/src/MudBlazor.Markdown/MudMarkdown.razor.cs b/src/MudBlazor.Markdown/MudMarkdown.razor.cs
index f1d28301..c5024499 100644
--- a/src/MudBlazor.Markdown/MudMarkdown.razor.cs
+++ b/src/MudBlazor.Markdown/MudMarkdown.razor.cs
@@ -454,6 +454,7 @@ protected virtual void RenderTable(RenderTreeBuilder builder1, ref int elementIn
builder1.AddComponentParameter(elementIndex1++, nameof(MudSimpleTable.Striped), Styling.Table.IsStriped);
builder1.AddComponentParameter(elementIndex1++, nameof(MudSimpleTable.Bordered), Styling.Table.IsBordered);
builder1.AddComponentParameter(elementIndex1++, nameof(MudSimpleTable.Elevation), Styling.Table.Elevation);
+ builder1.AddComponentParameter(elementIndex1++, nameof(MudSimpleTable.Dense), Styling.Table.Dense);
builder1.AddComponentParameter(elementIndex1++, nameof(MudSimpleTable.ChildContent), (RenderFragment)(builder2 =>
{
var elementIndex2 = 0;
diff --git a/src/MudBlazor.Markdown/Resources/MudBlazor.Markdown.css b/src/MudBlazor.Markdown/Resources/MudBlazor.Markdown.css
index a442933a..fc6c4dec 100644
--- a/src/MudBlazor.Markdown/Resources/MudBlazor.Markdown.css
+++ b/src/MudBlazor.Markdown/Resources/MudBlazor.Markdown.css
@@ -46,6 +46,10 @@ pre code.hljs {
margin: 1.25em 0;
}
+.mud-markdown-body table p {
+ margin-bottom: 0 !important;
+}
+
/* Link */
.mud-markdown-body .mud-link:hover {
cursor: pointer !important;
diff --git a/tests/MudBlazor.Markdown.Tests/Components/MarkdownComponentTests/MarkdownComponentStylingShould.cs b/tests/MudBlazor.Markdown.Tests/Components/MarkdownComponentTests/MarkdownComponentStylingShould.cs
index 84d75ecc..12e94e3b 100644
--- a/tests/MudBlazor.Markdown.Tests/Components/MarkdownComponentTests/MarkdownComponentStylingShould.cs
+++ b/tests/MudBlazor.Markdown.Tests/Components/MarkdownComponentTests/MarkdownComponentStylingShould.cs
@@ -55,7 +55,7 @@ public void RenderTableNotStriped()
using var fixture = CreateFixture(value, styling: styling);
fixture.MarkupMatches(expected);
}
-
+
[Fact]
public void RenderTableNotBordered()
{
@@ -163,12 +163,66 @@ public void RenderTableNoElevation()
using var fixture = CreateFixture(value, styling: styling);
fixture.MarkupMatches(expected);
}
-
+
+ [Fact]
+ public void RenderTableDense()
+ {
+ const string value =
+ """
+ |Column1|Column2|Column3|
+ |-|-|-|
+ |cell1-1|cell1-2|cell1-3|
+ |cell2-1|cell2-2|cell2-3|
+ """;
+
+ const string expected =
+ """
+
+
+
+
+
+
+ Column1 |
+ Column2 |
+ Column3 |
+
+
+
+
+ cell1-1 |
+ cell1-2 |
+ cell1-3 |
+
+
+ cell2-1 |
+ cell2-2 |
+ cell2-3 |
+
+
+
+
+
+
+ """;
+
+ var styling = new MudMarkdownStyling
+ {
+ Table =
+ {
+ Dense = true,
+ },
+ };
+
+ using var fixture = CreateFixture(value, styling: styling);
+ fixture.MarkupMatches(expected);
+ }
+
[Fact]
public void RenderLinkUnderlineAlways()
{
const string value = "[my link](https://www.mynihongo.org/)";
-
+
const string expected =
"""
@@ -185,16 +239,16 @@ public void RenderLinkUnderlineAlways()
Underline = Underline.Always,
},
};
-
+
using var fixture = CreateFixture(value, styling: styling);
fixture.MarkupMatches(expected);
}
-
+
[Fact]
public void RenderLinkUnderlineNone()
{
const string value = "[my link](https://www.mynihongo.org/)";
-
+
const string expected =
"""
@@ -211,7 +265,7 @@ public void RenderLinkUnderlineNone()
Underline = Underline.None,
},
};
-
+
using var fixture = CreateFixture(value, styling: styling);
fixture.MarkupMatches(expected);
}