fix: the unordered list has no style.
All checks were successful
Build blog docker image / Build-Blog-Image (push) Successful in 3m31s
All checks were successful
Build blog docker image / Build-Blog-Image (push) Successful in 3m31s
Signed-off-by: jackfiled <xcrenchangjun@outlook.com>
This commit is contained in:
@@ -102,17 +102,33 @@ public sealed class EssayStylesPostRenderProcessor : IPostRenderProcessor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 美化各种列表元素
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="document"></param>
|
||||||
private static void BeatifyList(IDocument document)
|
private static void BeatifyList(IDocument document)
|
||||||
{
|
{
|
||||||
foreach (IElement ulElement in from e in document.All
|
foreach (IElement listElement in from e in document.All
|
||||||
where e.LocalName == "ul"
|
where e.LocalName is "ol" or "ul"
|
||||||
select e)
|
select e)
|
||||||
{
|
{
|
||||||
// 首先给<ul>元素添加样式
|
// 给有序或者无序列表添加不同的样式
|
||||||
ulElement.ClassList.Add("list-disc ml-10");
|
listElement.ClassList.Add("ml-10");
|
||||||
|
switch (listElement.LocalName)
|
||||||
|
{
|
||||||
|
case "ul":
|
||||||
|
{
|
||||||
|
listElement.ClassList.Add("list-disc");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "ol":
|
||||||
|
{
|
||||||
|
listElement.ClassList.Add("list-decimal");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (IElement liElement in from e in listElement.Children
|
||||||
foreach (IElement liElement in from e in ulElement.Children
|
|
||||||
where e.LocalName == "li"
|
where e.LocalName == "li"
|
||||||
select e)
|
select e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using YaeBlog.Models;
|
|||||||
|
|
||||||
namespace YaeBlog.Services;
|
namespace YaeBlog.Services;
|
||||||
|
|
||||||
public partial class RendererService(
|
public sealed partial class RendererService(
|
||||||
ILogger<RendererService> logger,
|
ILogger<RendererService> logger,
|
||||||
IEssayScanService essayScanService,
|
IEssayScanService essayScanService,
|
||||||
MarkdownPipeline markdownPipeline,
|
MarkdownPipeline markdownPipeline,
|
||||||
|
|||||||
Reference in New Issue
Block a user