Skip to content

Commit

Permalink
Allow custom ordering in the ordered list (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
MihailsKuzmins authored Jan 15, 2023
1 parent f0af00c commit cc8fe1d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
10 changes: 9 additions & 1 deletion src/MudBlazor.Markdown/Extensions/StringEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,12 @@ public static bool IsExternalUri(this string? @this, string? baseUri)
return false;
}
}
}

public static int ParseOrDefault(this string? @this)
{
if (!int.TryParse(@this, out var intValue))
intValue = 0;

return intValue;
}
}
9 changes: 6 additions & 3 deletions src/MudBlazor.Markdown/MudBlazor.Markdown.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MudBlazor</RootNamespace>
<Version>0.0.12</Version>
<Version>0.1.0</Version>
<Authors>MyNihongo</Authors>
<Description>Markdown component for MudBlazor (https://mudblazor.com/)</Description>
<Copyright>Copyright © 2022 MyNihongo</Copyright>
<Copyright>Copyright © 2023 MyNihongo</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/MyNihongo/MudBlazor.Markdown</RepositoryUrl>
<PackageProjectUrl>https://mudblazor.com/</PackageProjectUrl>
<PackageIcon>favico.png</PackageIcon>
<PackageTags>mudblazor, blazor, markdown</PackageTags>
<GeneratePackageOnBuild Condition="'$(Configuration)'=='Release'">true</GeneratePackageOnBuild>
<PackageReleaseNotes>https://github.com/MyNihongo/MudBlazor.Markdown/releases</PackageReleaseNotes>
<Title>MudBlazor Markdown</Title>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

<ItemGroup>
Expand All @@ -32,7 +34,8 @@
</Target>

<ItemGroup>
<None Include="..\..\favico.png" Pack="true" PackagePath="" />
<None Include="..\..\favico.png" Pack="true" PackagePath="\" />
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
<Content Remove="**\package*.json" />
<None Remove="*.csproj.DotSettings" />
</ItemGroup>
Expand Down
7 changes: 7 additions & 0 deletions src/MudBlazor.Markdown/MudMarkdown.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,15 @@ private void RenderList(ListBlock list, RenderTreeBuilder builder)
return;

var elementName = list.IsOrdered ? "ol" : "ul";
var orderStart = list.OrderedStart.ParseOrDefault();

builder.OpenElement(_elementIndex++, elementName);

if (orderStart > 1)
{
builder.AddAttribute(_elementIndex++, "start", orderStart);
}

for (var i = 0; i < list.Count; i++)
{
var block = (ListItemBlock)list[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ The following requirements must be met outside this Terraform code in advance.
<ul>
<li><p class='mud-typography mud-typography-body1'>Granted permissions User.Invite.All and GroupMember.ReadWrite.All. Admin consent has been granted</p></li>
</ul>
<ol>
<ol start='6'>
<li><p class='mud-typography mud-typography-body1'>Create a new app registration..</p></li>
<li><p class='mud-typography mud-typography-body1'>Created the key vault..</p></li>
<li><p class='mud-typography mud-typography-body1'>Created secrets..</p></li>
Expand Down

0 comments on commit cc8fe1d

Please sign in to comment.