Compare commits

..

4 Commits

Author SHA1 Message Date
91501cd4d3 dev 2025-01-24 16:56:16 +08:00
10b4cef4c1 Merge branch 'master' into feat-highlight
# Conflicts:
#	YaeBlog.Core/Processors/CodeBlockPostRenderProcessor.cs
#	YaeBlog.Core/YaeBlog.Core.csproj
2025-01-24 16:53:57 +08:00
4fd464fd34 Merge branch 'master' into feat-highlight 2024-09-08 22:44:57 +08:00
d9c17720dc dev: CSharp language highlight. 2024-08-28 20:26:41 +08:00
12 changed files with 15 additions and 24 deletions

View File

@ -7,8 +7,7 @@ using YaeBlog.Models;
namespace YaeBlog.Processors;
public class ImagePostRenderProcessor(
ILogger<ImagePostRenderProcessor> logger,
public class ImagePostRenderProcessor(ILogger<ImagePostRenderProcessor> logger,
IOptions<BlogOptions> options)
: IPostRenderProcessor
{
@ -30,27 +29,22 @@ public class ImagePostRenderProcessor(
if (attr is not null)
{
logger.LogDebug("Found image link: '{}'", attr.Value);
attr.Value = GenerateImageLink(attr.Value, essay.FileName, essay.IsDraft);
attr.Value = GenerateImageLink(attr.Value, essay.FileName);
}
}
return essay.WithNewHtmlContent(html.DocumentElement.OuterHtml);
}
public string Name => nameof(ImagePostRenderProcessor);
private string GenerateImageLink(string filename, string essayFilename, bool isDraft)
private string GenerateImageLink(string filename, string essayFilename)
{
// 如果图片路径中没有包含文件名
// 则添加文件名
if (!filename.Contains(essayFilename))
{
filename = Path.Combine(essayFilename, filename);
}
filename = isDraft
? Path.Combine(_options.Root, "drafts", filename)
: Path.Combine(_options.Root, "posts", filename);
filename = Path.Combine(_options.Root, "posts", filename);
if (!Path.Exists(filename))
{

View File

@ -2,8 +2,7 @@
title: 2021年终总结
date: 2022-01-12 16:27:19
tags:
- 杂谈
- 年终总结
- 随笔
---
2021年已经过去2022年已经来临。每每一年开始的时候我都会展开一张纸或者新建一个文档思量着又是一年时光也该同诸大杂志一般写几句意味深长的话语怀念过去的时光也祝福未来的自己。可往往脑海中已是三万字的长篇落在笔头却又是一个字都没有了。

View File

@ -1,8 +1,7 @@
---
title: 2022年终总结
tags:
- 杂谈
- 年终总结
- 随笔
date: 2022-12-30 14:58:12
---

View File

@ -1,7 +1,7 @@
---
title: 2022年暑假碎碎念
tags:
- 杂谈
- 随笔
typora-root-url: 2022-summer-vacation
date: 2022-08-22 15:39:13
---

View File

@ -1,8 +1,7 @@
---
title: 2023年年终总结
tags:
- 杂谈
- 年终总结
- 随笔
date: 2024-2-29 20:18:19
---

View File

@ -1,7 +1,7 @@
---
title: 人生代码大作业初体验
tags:
- 杂谈
- 随笔
typora-root-url: big-homework
date: 2022-07-27 11:34:49
---

View File

@ -2,7 +2,7 @@
title: 日用Linux挑战 第0篇 初见Arch Linux
tags:
- Linux
- 杂谈
- 随笔
date: 2023-01-15 22:23:08
typora-root-url: daily-linux-0
---

View File

@ -2,7 +2,7 @@
title: 日用Linux挑战 第1篇 问题与挑战
tags:
- Linux
- 杂谈
- 随笔
date: 2023-03-08 22:37:29
---

View File

@ -1,7 +1,7 @@
---
title: 日用Linux挑战 第2篇 Wayland
tags:
- 杂谈
- 随笔
- Linux
date: 2023-07-23 11:44:34
typora-root-url: daily-linux-2

View File

@ -1,7 +1,7 @@
---
title: 日用Linux挑战 第3篇 放弃Wayland
tags:
- 杂谈
- 随笔
- Linux
typora-root-url: daily-linux-3
date: 2023-09-04 14:47:46

View File

@ -2,7 +2,7 @@
title: 日用Linux挑战 第4篇 新的开始
tags:
- Linux
- 杂谈
- 随笔
date: 2024/03/09 14:00:00
---

View File

@ -1,7 +1,7 @@
---
title: 大学生用啥配置——计算机专业
tags:
- 杂谈
- 随笔
typora-root-url: laptop-for-computer
date: 2022-06-13 16:17:27
---