diff --git a/assets/css/_common/outline/sidebar/sidebar-toc.scss b/assets/css/_common/outline/sidebar/sidebar-toc.scss index d378d7c..cca699b 100644 --- a/assets/css/_common/outline/sidebar/sidebar-toc.scss +++ b/assets/css/_common/outline/sidebar/sidebar-toc.scss @@ -1,14 +1,15 @@ @if $toc_enable { .post-toc { font-size: $font-size-small; + padding: 0 8px; - ol { + ul { list-style: none; margin: 0; padding: 0 2px 5px 10px; text-align: left; - > ol { + > li { padding-left: 0; } diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 0daee31..576644e 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -1,15 +1,13 @@ -# =============================================================== +#:============================================================== # It's recommended to use Alternate Theme Config to configure NexT # Modifying this file may result in merge conflict # See: https://theme-next.js.org/docs/getting-started/configuration -# =============================================================== +#:============================================================== baseURL: / theme: hugo-theme-next - -paginate: 8 - +paginate: 10 enableEmoji: true # Make markdown content support HTML syntax @@ -17,6 +15,15 @@ markup: goldmark: renderer: unsafe: true + highlight: + codeFences: true + lineNos: true + lineNumbersInTable: true + noClasses: true + tableOfContents: + endLevel: 3 + ordered: false + startLevel: 1 defaultContentLanguage: zh-cn languages: @@ -305,11 +312,11 @@ params: # Beian ICP and gongan information for Chinese users. See: https://beian.miit.gov.cn, http://www.beian.gov.cn beian: enable: true - icp: 粤ICP备18047355-1号 + icp: 粤ICP备 18047355-1 号 # The digit in the num of gongan beian. provinceAbbr: 沪 # The full num of gongan beian. - gonganNum: 11010102001808 + gonganNum: 31011402009770 # The icon for gongan beian. See: http://www.beian.gov.cn/portal/download #gongan_icon_url: @@ -763,7 +770,7 @@ params: # AddThis Share. See: https://www.addthis.com # Go to https://www.addthis.com/dashboard to customize your tools. - addThisId: + addThisId: ra-6049e46e9ee22127 # --------------------------------------------------------------- diff --git a/exampleSite/content/about.md b/exampleSite/content/about.md new file mode 100644 index 0000000..ae17cc8 --- /dev/null +++ b/exampleSite/content/about.md @@ -0,0 +1,19 @@ +--- +title: "关于 Hugo NexT 组织" +description: "" + +date: 2022-06-09T20:12:52+08:00 +lastmod: 2022-06-09T20:12:52+08:00 + +share: false +followme: false +nav: false +copyright: false +url: about.html +--- + +`Hugo NexT` 组织是由众多喜爱 `NexT` 主题及风格的世界各地友人共同组建而成,为的就是让这个主题继续在 `Hugo` 引擎中也能得到发扬光大,在此也欢迎你的加入! + +# 我们的愿景 + +延续 `NexT` 经典的黑白调搭配,保持简单的易用性及强大的功能。 \ No newline at end of file diff --git a/exampleSite/content/posts/markdown-syntax.md b/exampleSite/content/posts/markdown-syntax.md index 9618861..43ab71d 100644 --- a/exampleSite/content/posts/markdown-syntax.md +++ b/exampleSite/content/posts/markdown-syntax.md @@ -43,10 +43,28 @@ url: markdown-syntax.html ## 图像 +### Markdown 语法 + +```markdown +![图像说明](图像地址) +``` ![hugo-next-primary](//lisenhui.gitee.io/imgs/hugo-next/logo/hugo-next-primary.png) +### HTML IMG 标签 + +```html + +``` +### SVG 格式 + +```html +xxxxxx +``` + + + ## 列表类型 ### 有序列表 diff --git a/exampleSite/content/posts/syntax-highlighting.md b/exampleSite/content/posts/syntax-highlighting.md new file mode 100644 index 0000000..2c3c05b --- /dev/null +++ b/exampleSite/content/posts/syntax-highlighting.md @@ -0,0 +1,147 @@ +--- +title: "Hugo 内置的 Chroma 语法高亮" +description: "描述下 Chroma 所支持的各种语法及高亮效果展示" +keywords: "Chroma,语法,高亮" + +date: 2022-06-07T19:09:52+08:00 +lastmod: 2022-06-07T19:09:52+08:00 + +categories: + - 示例 +tags: + - 语法 + - 高亮 + - Chroma + +url: "syntax-highlighting.html" +--- + +Hugo 通过 Chroma 提供非常快速的语法高亮显示,现 Hugo 中使用 Chroma 作为代码块高亮支持,它内置在 Go 语言当中,速度是真的非常、非常快,而且最为重要的是它也兼容之前我们使用的 Pygments 方式。 + +以下通过 Hugo 内置短代码 `highlight` 和 `Markdown` 代码块方式分别验证不同语言的代码块渲染效果并能正确高亮显示,有关优化语法突出显示的更多信息,请参阅 [Hugo 文档](https://gohugo.io/getting-started/configuration-markup#highlight)。 + + + +# 编程语言 + +## GO + +{{< highlight go "linenos=table,hl_lines=8 15-17,linenostart=199" >}} + +func GetTitleFunc(style string) func(s string) string { + switch strings.ToLower(style) { + case "go": + return strings.Title + case "chicago": + return transform.NewTitleConverter(transform.ChicagoStyle) + default: + return transform.NewTitleConverter(transform.APStyle) + } +} + +{{< / highlight >}} + +## Java + +```java +import javax.swing.JFrame; //Importing class JFrame +import javax.swing.JLabel; //Importing class JLabel +public class HelloWorld { + public static void main(String[] args) { + JFrame frame = new JFrame(); //Creating frame + frame.setTitle("Hi!"); //Setting title frame + frame.add(new JLabel("Hello, world!"));//Adding text to frame + frame.pack(); //Setting size to smallest + frame.setLocationRelativeTo(null); //Centering frame + frame.setVisible(true); //Showing frame + } +} +``` + +## Python + +``` python +print "Hello, world!" +``` + +## Git 对比 + +``` diff {hl_lines=[4,"6-7"], linenos=true} +*** /path/to/original ''timestamp'' +--- /path/to/new ''timestamp'' +*************** +*** 1 **** +! This is a line. +--- 1 --- +! This is a replacement line. +It is important to spell +-removed line ++new line +``` + +```diff {hl_lines=[4,"6-7"], linenos=false} +*** /path/to/original ''timestamp'' +--- /path/to/new ''timestamp'' +*************** +*** 1 **** +! This is a line. +--- 1 --- +! This is a replacement line. +It is important to spell +-removed line ++new line +``` + +# 文件 + +## Make 文件 + +``` makefile {linenos=false} +CC=gcc +CFLAGS=-I. + +hellomake: hellomake.o hellofunc.o + $(CC) -o hellomake hellomake.o hellofunc.o -I. +``` + +## Markdown 文档 + +``` markdown +**bold** +*italics* +[link](www.example.com) +``` + +# 数据内容 + +## JSON 数据 + +``` json +{"employees":[ + {"firstName":"John", "lastName":"Doe"}, +]} +``` + +## XML 内容 + +``` xml + + + John Doe + + +``` + +## SQL 查询 + +{{< highlight sql >}} + +SELECT column_name,column_name +FROM + Table +WHERE column_name = "condition" +{{< / highlight >}} + + +除以上列举的代码高亮显示外,还支持诸如:C 语言、C++、HTML、CSS、Shell脚本等各主流的代码语言高亮显示,可自行测试效果。 + diff --git a/exampleSite/content/posts/table-of-content.md b/exampleSite/content/posts/table-of-content.md new file mode 100644 index 0000000..d21993d --- /dev/null +++ b/exampleSite/content/posts/table-of-content.md @@ -0,0 +1,58 @@ +--- +title: "文章目录导航" +description: "描述下 NexT 主题下的文章目录导航效果。" +keywords: "文章,目录,导航" + +date: 2022-06-08T21:12:52+08:00 +lastmod: 2022-06-08T21:12:52+08:00 + +categories: + - 示例 +tags: + - 目录 + - 导航 + - 博客 + +toc: true +url: "table-of-content.html" +--- + +巴顿将军说过:“衡量一个人是否成功,不是看他站到顶峰,而是从顶峰跌落之后的反弹力”,褚时健的人生便是如此,中年发家致富,名利双收,之后又跌落到谷底,等到74岁再创业,10年后带着褚橙归来,东山再起收获亿万财富,他的发展轨迹就是反弹的过程。 + + + +![禇老](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/layouts/partials/post/footer.html b/layouts/partials/post/footer.html index 2c258b6..34c3afc 100644 --- a/layouts/partials/post/footer.html +++ b/layouts/partials/post/footer.html @@ -10,11 +10,18 @@
{{- else }} {{ partial "post/footer_meta/tags.html" . }} +{{- if and (not (isset .Params "share")) (not .Params.share) }} {{ partial "_thirdparty/share/addthis.html" . }} +{{- end }}
{{ partial "post/footer_meta/reward.html" . }} +{{- if and (not (isset .Params "copyright")) (not .Params.copyright) }} {{ partial "post/footer_meta/copyright.html" . }} +{{- end }} +{{- if and (not (isset .Params "followme")) (not .Params.followme) }} {{ partial "post/footer_meta/followme.html" . }} +{{- end }} +{{- if and (not (isset .Params "nav")) (not .Params.nav) }}
{{- with .NextInSection }} @@ -33,4 +40,5 @@
{{- end }} -{{ end }} \ No newline at end of file +{{- end }} +{{- end }} \ No newline at end of file diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index e000d99..f08c579 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -4,7 +4,7 @@