LoveIt
LoveIt copied to clipboard
[BUG] adoc 的渲染有点问题
Describe the bug 描述你遇到的错误
我比较喜欢使用 asciidoc 来写博客。使用 LoveIt 主题之后,发现对 adoc 的支持有两个问题
- codeblock 渲染
- toc 渲染
codeblock 渲染
关于 codeblock 渲染,adoc 代码和渲染结果如下:
[source,java]
----
@Bean
public MutableAclService mutableAclService() {
JdbcMutableAclService jdbcMutableAclService = new JdbcMutableAclService(datasource, lookupStrategy(), aclCache());
jdbcMutableAclService.setAclClassIdSupported(true); <1>
jdbcMutableAclService.setClassIdentityQuery("SELECT @@IDENTITY"); <2>
jdbcMutableAclService.setSidIdentityQuery("SELECT @@IDENTITY"); <3>
return jdbcMutableAclService;
}
----
<1> 如果要支持 `acl_class.class_id_type` 字段,则需要将 `aclClassIdSupported` 设置为 `true`。这样 `JdbcAclService` 在查询时和 `JdbcMutableAclService` 更新时才会考虑这个字段的值。
<2> `classIdentityQuery` 会在创建 `Acl` 对象时用到,用来获取刚刚插入的 `acl_class.id`。默认值是 `call identity()`,这是 `H2` 数据库的方言,这里的例子是 `MySql` 的方言。
<3> 与 2 相同,只是用来获取刚刚插入的 `acl_sid.id`
可以发现代码块没有高亮,同时右边超出了文章渲染的范围。
toc 渲染
adoc 需要在文章开头添加 :toc:
以获取 Hugo 的 toc 支持,并且可以使用 :toclevels: 4
来指定渲染多少级目录。https://gohugo.io/content-management/toc/#usage-with-asciidoc
使用之后发现:
-
:toclevels:
参数没有生效 - 目录只渲染了一级
- 目录没有跟随屏幕滚动到相应的位置而高亮
我的目录结构和渲染效果:
== 导入 Jar 包
== 存储 ACL
=== 基于 JDBC 的持久化
==== 创建数据库
==== 配置 JdbcAclService
===== 注入 JdbcMutableAclService
===== 注入 LookupStrategy
===== 注入 AclAuthorizationStrategy
===== 注入 PermissionGrantingStrategy
===== 注入 AclCache
=== 创建 ACL
==== insertAce
=== 更新 ACL
==== 添加新的 ACE
==== 更新已有的 ACE
==== 删除已有的 ACE
=== 删除 ACL
== 使用 ACL 保护业务调用
=== 启用 Method Security
== 总结
配置信息
baseURL = "http://example.org/"
languageCode = "en-us"
title = "My New Hugo Site"
theme = "loveit"
[params]
# LoveIt 主题版本
version = "0.2.X"
[params.page.toc]
enable = true
[menu]
[[menu.main]]
identifier = "posts"
# 你可以在名称 (允许 HTML 格式) 之前添加其他信息, 例如图标
pre = ""
# 你可以在名称 (允许 HTML 格式) 之后添加其他信息, 例如图标
post = ""
name = "文章"
url = "/posts/"
# 当你将鼠标悬停在此菜单链接上时, 将显示的标题
title = ""
weight = 1
[[menu.main]]
identifier = "tags"
pre = ""
post = ""
name = "标签"
url = "/tags/"
title = ""
weight = 2
[[menu.main]]
identifier = "categories"
pre = ""
post = ""
name = "分类"
url = "/categories/"
title = ""
weight = 3
# Hugo 解析文档的配置
[markup]
# 语法高亮设置 (https://gohugo.io/content-management/syntax-highlighting)
[markup.highlight]
# false 是必要的设置 (https://github.com/dillonzq/LoveIt/issues/158)
noClasses = false
Hugo 新手,不确定是不是哪里的配置没有对。但是尝试过其他主题,adoc 的渲染是没有问题的。
Hello Soajelny developer abandoned this project, the last activity was at the end of May. I volunteered to maintain and develop this template, you can open the issue in the new repository
https://github.com/uPagge/uBlogger
P.S. It is desirable to use the English language to describe the problem