diff --git a/assets/css/_common/components/post/index.scss b/assets/css/_common/components/post/index.scss index 0b065ff..179fc44 100644 --- a/assets/css/_common/components/post/index.scss +++ b/assets/css/_common/components/post/index.scss @@ -42,6 +42,32 @@ } } +.autonumber { + h2 { + counter-reset: h3; + &:before{ + counter-increment: h2; + content: counter(h2) ". "; + } + } + + h3 { + counter-reset: h4; + &:before{ + counter-increment: h3; + content: counter(h2) ". " counter(h3) ". "; + } + } + + h4 { + counter-reset: h5; + &:before{ + counter-increment: h4; + content: counter(h2) "." counter(h3) "." counter(h4) ". "; + } + } +} + @import 'post-collapse'; @import 'post-body'; @import 'post-gallery'; diff --git a/assets/css/_common/outline/sidebar/sidebar-toc.scss b/assets/css/_common/outline/sidebar/sidebar-toc.scss index cca699b..c8e373f 100644 --- a/assets/css/_common/outline/sidebar/sidebar-toc.scss +++ b/assets/css/_common/outline/sidebar/sidebar-toc.scss @@ -1,62 +1,67 @@ -@if $toc_enable { - .post-toc { - font-size: $font-size-small; - padding: 0 8px; - ul { - list-style: none; - margin: 0; - padding: 0 2px 5px 10px; - text-align: left; +.post-toc { + font-size: $font-size-small; + padding: 0 8px; + + ul { + list-style: none; + margin: 0; + padding: 0 2px 5px 10px; + text-align: left; + counter-reset: item; - > li { - padding-left: 0; + > li { + padding-left: 0; + } + + a { + transition: all $transition-ease; + + &:before { + content: counters(item, ".") ". "; + counter-increment: item; } + } + } - a { - transition: all $transition-ease; + .nav-item { + line-height: 1.8; + overflow: hidden; + text-overflow: ellipsis; + + @if not $toc_wrap { + white-space: nowrap; + } + } + + .nav { + .nav-child { + display: if($toc_expand_all, block, none); + } + + .active > .nav-child { + display: block; + } + + .active-current > .nav-child { + display: block; + + > .nav-item { + display: block; } } - .nav-item { - line-height: 1.8; - overflow: hidden; - text-overflow: ellipsis; - - @if not $toc_wrap { - white-space: nowrap; - } + .active > a { + border-bottom-color: $sidebar-highlight; + color: $sidebar-highlight; } - .nav { - .nav-child { - display: if($toc_expand_all, block, none); - } + .active-current > a { + color: $sidebar-highlight; - .active > .nav-child { - display: block; - } - - .active-current > .nav-child { - display: block; - - > .nav-item { - display: block; - } - } - - .active > a { - border-bottom-color: $sidebar-highlight; + &:hover { color: $sidebar-highlight; } - - .active-current > a { - color: $sidebar-highlight; - - &:hover { - color: $sidebar-highlight; - } - } } } } diff --git a/assets/css/_common/scaffolding/normalize.scss b/assets/css/_common/scaffolding/normalize.scss index beb43cf..4882b21 100644 --- a/assets/css/_common/scaffolding/normalize.scss +++ b/assets/css/_common/scaffolding/normalize.scss @@ -17,6 +17,7 @@ html { */ body { margin: 0; + counter-reset: h2; } /** diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 07c47c9..c16e35d 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -61,12 +61,6 @@ markup: noHl: false style: monokai tabWidth: 2 - tableOfContents: - # 开始/结束标题级别:1-6 - # Heading title level of start or end: 1-6 - startLevel: 1 - endLevel: 3 - ordered: false # 站点文章导航文件 # Site map of all articles diff --git a/exampleSite/content/flinks.md b/exampleSite/content/flinks.md index 525f67e..1f53a44 100644 --- a/exampleSite/content/flinks.md +++ b/exampleSite/content/flinks.md @@ -4,13 +4,11 @@ type: flinks url: flinks.html --- -如想要交换友情链接,请在评论区留下你的站点信息,格式参考如下: +如想交换本站友情链接,请在评论区留下你的站点信息,格式参考如下: -{{< note success no-icon >}} - - **名称:** NexT 主题
- **说明:** 保持简单的易用性和强大的功能。
- **站标:** https://hugo-next.eu.org/imgs/hugo_next_avatar.png
- **网址:** https://hugo-next.eu.org
- -{{< /note >}} \ No newline at end of file +```yaml +- name: Hugo-NexT + desc: Hugo NexT 官方预览网站。 + avatar: https://hugo-next.eu.org/imgs/hugo_next_avatar.png + link: https://hugo-next.eu.org +``` \ No newline at end of file diff --git a/exampleSite/content/post/custom-files.md b/exampleSite/content/post/custom-files.md index 20132f2..b491936 100644 --- a/exampleSite/content/post/custom-files.md +++ b/exampleSite/content/post/custom-files.md @@ -21,7 +21,7 @@ toc: true -# 打开配置参数 +## 打开配置参数 首先要明确在配置文件的 `params` 区域中有配置如下参数: @@ -40,7 +40,7 @@ customFilePath: 然后在站点的根目录下创建 `layouts/partials` 2个目录,用于存放自定布局设计文件,另外在站点根目录下创建 `statics/css` 2个目录,用于存放自定义 CSS 样式文件。一切就绪后,就可以参考如下的步骤,完成自己的设计想法。 -# 侧边栏设计 +## 侧边栏设计 在前面创建 `partials` 目录中新一个后缀名为 `html` 的文件,可以在里面书写你所想表达的设计或内容,比如引入一些第三方组件内容。示例如下: @@ -52,7 +52,7 @@ customFilePath: 再把该文件的路径配置到相应的参数中,效果请查看左侧边栏底部的效果。 -# 底部设计 +## 底部设计 在前面创建 `partials` 目录中新一个后缀名为 `html` 的文件,可以在里面书写你所想表达的设计或内容,比如引入一些第三方组件内容。示例如下: @@ -65,7 +65,7 @@ Website source code -# 使用说明 +## 使用说明 {{< note info >}} @@ -32,7 +32,7 @@ toc: true {{< /note >}} -# 流程图 +## 流程图 ```shell {{}} @@ -52,7 +52,7 @@ graph TD; C-->D; {{< /mermaid >}} -# 时序图 +## 时序图 ```shell {{}} @@ -84,7 +84,7 @@ sequenceDiagram Bob-->>John: Jolly good! {{< /mermaid >}} -# 类图 +## 类图 ```shell {{}} @@ -121,7 +121,7 @@ Class01 : int gorilla Class08 <--> C2: Cool label {{< /mermaid >}} -# 甘特图 +## 甘特图 ```shell {{}} @@ -150,7 +150,7 @@ Future task : des3, after des2, 5d Future task2 : des4, after des3, 5d {{< /mermaid >}} -# 实体关系图 +## 实体关系图 ```shell {{}} @@ -167,7 +167,7 @@ erDiagram CUSTOMER }|..|{ DELIVERY-ADDRESS : uses {{< /mermaid >}} -# 用户旅程 +## 用户旅程 ```shell {{}} diff --git a/exampleSite/content/post/shortcodes.md b/exampleSite/content/post/shortcodes.md index c6be592..013cf9c 100644 --- a/exampleSite/content/post/shortcodes.md +++ b/exampleSite/content/post/shortcodes.md @@ -18,7 +18,7 @@ url: "post/shortcodes.html" -# 块引用 +## 块引用 在引用一些经典名言名句时,可以采用此短语,语法参考如下: @@ -42,7 +42,7 @@ url: "post/shortcodes.html" {{< /quote >}} -# 信息块 +## 信息块 支持 `default`,`info`,`success`,`warning`,`danger` 等五种不同效果的展示,语法参考如下: diff --git a/exampleSite/content/post/syntax-highlighting.md b/exampleSite/content/post/syntax-highlighting.md index bbedc6f..e370982 100644 --- a/exampleSite/content/post/syntax-highlighting.md +++ b/exampleSite/content/post/syntax-highlighting.md @@ -22,9 +22,9 @@ Hugo 通过 Chroma 提供非常快速的语法高亮显示,现 Hugo 中使用 -# 编程语言 +## 编程语言 -## GO +### GO {{< highlight go "linenos=table,hl_lines=8 15-17,linenostart=199" >}} @@ -41,7 +41,7 @@ func GetTitleFunc(style string) func(s string) string { {{< / highlight >}} -## Java +### Java ```java import javax.swing.JFrame; //Importing class JFrame @@ -58,13 +58,13 @@ public class HelloWorld { } ``` -## Python +### Python ``` python print "Hello, world!" ``` -## Git 对比 +### Git 对比 ``` diff {hl_lines=[4,"6-7"], linenos=true} *** /path/to/original ''timestamp'' @@ -92,9 +92,9 @@ It is important to spell +new line ``` -# 文件 +## 文件 -## Make 文件 +### Make 文件 ``` makefile {linenos=false} CC=gcc @@ -104,7 +104,7 @@ hellomake: hellomake.o hellofunc.o $(CC) -o hellomake hellomake.o hellofunc.o -I. ``` -## Markdown 文档 +### Markdown 文档 ``` markdown **bold** @@ -112,9 +112,9 @@ hellomake: hellomake.o hellofunc.o [link](www.example.com) ``` -# 数据内容 +## 数据内容 -## JSON 数据 +### JSON 数据 ``` json {"employees":[ @@ -122,7 +122,7 @@ hellomake: hellomake.o hellofunc.o ]} ``` -## XML 内容 +### XML 内容 ``` xml @@ -132,7 +132,7 @@ hellomake: hellomake.o hellofunc.o ``` -## SQL 查询 +### SQL 查询 {{< highlight sql >}} diff --git a/exampleSite/content/post/table-of-content.md b/exampleSite/content/post/table-of-content.md index 884653c..ee9637d 100644 --- a/exampleSite/content/post/table-of-content.md +++ b/exampleSite/content/post/table-of-content.md @@ -23,38 +23,38 @@ url: post/table-of-content.html ![禇老](https://wfqqreader-1252317822.image.myqcloud.com/cover/568/814568/t6_814568.jpg) -# 早年的故事 +## 早年的故事 -## 起始 +### 起始 2014年的春天,在云南省华宁县和宜良县的交界处,一座名叫矣则的小山村里,一处已经有上百年历史的古旧四合院宅子被拆掉。村委会正带领村民们进行“美丽乡村”的建设,一年以后,旧有村居将再也看不到,代之而起的是钢筋混凝土的新式民居。就像10年、20年前中国大小城市的改造一样,这个群山围绕的小村子也开始陷入“工地模式”。 -### 童年浪花 +#### 童年浪花 在江河边长大的孩子几乎都有一个当仁不让的特长:善水。褚时健也不例外,他不仅从小就在南盘江和花鱼塘里扑腾出了上佳的游泳技术,五六岁已经可以一个猛子扎出老远,而且从七八岁就可以在南盘江和河滩上的鱼塘里捉鱼了。 -## 少年故事 +### 少年故事 褚时健在乡村自由自在生活的十多年,其实正是中国社会风雨飘摇的十多年。特别是1937年卢沟桥事变后,日本人发动全面侵华战争,短短两三年间,中国的大部分国土相继沦陷 -# 激情的青春十年 +## 激情的青春十年 -## 当上了游击队员 +### 当上了游击队员 1948年夏天,褚时健回乡,在禄丰车站小学做了一名老师,同时也和褚时仁、褚时杰一起继续保持与共产党组织的联系,做一些传递情报的工作 -### 战火纷飞 +#### 战火纷飞 因为战斗力相较悬殊,所以游击队只能是靠打一枪换一个地方的办法,专找敌人薄弱的地方攻击,但更多时候,都是在防御和转移阵地。 -# 生活的断层 +## 生活的断层 -## 跌入生活底层 +### 跌入生活底层 “反右”运动中被打倒的人在“右派”身份确定后,只有一条路可走:下放到农场。农场名副其实,就是干农活儿的地方,必须过和农民一样的生活。 -# 尾声 +## 尾声 -## 岁月像一条河 +### 岁月像一条河 2015年,是褚时健和马静芬结婚60周年,被称为“钻石婚”的纪念年份。这简直是一份人生的奖赏,在中国离婚率愈益升高的当下,60年的婚姻,几乎就像一个前世之梦。一个甲子的相伴相随,褚时健和马静芬共同经历了国家和个人的各种风浪,共同面对过生死。他们两人已经不仅是夫妻,更是一对战友。尽管马静芬偶尔会对褚时健年轻时候的粗心抱怨上两句,但说到最后,她会说一句:“没有我就没有他,没有他也就没有我。” \ No newline at end of file diff --git a/exampleSite/data/flinks.yaml b/exampleSite/data/flinks.yaml index 3a43c14..78d1b96 100644 --- a/exampleSite/data/flinks.yaml +++ b/exampleSite/data/flinks.yaml @@ -16,7 +16,7 @@ - name: 凡梦星尘空间站 desc: 再平凡的人也有属于他的梦想! - avatar: https://lisenhui.cn/img/avatar.png + avatar: https://lisenhui.cn/imgs/avatar.png link: https://lisenhui.cn diff --git a/layouts/partials/post.html b/layouts/partials/post.html index a005bf4..d18cc16 100644 --- a/layouts/partials/post.html +++ b/layouts/partials/post.html @@ -18,7 +18,8 @@
{{ partial "post/header.html" (dict "ctx" .ctx "IsHome" .IsHome) }}
-
+ {{ $tocEnable := .ctx.Params.toc | default .ctx.Site.Params.toc.enable }} +
{{ partial "post/body.html" (dict "ctx" .ctx "IsHome" .IsHome) }}
diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index 176c26c..83c493c 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -4,8 +4,8 @@