Skip to content
This repository has been archived by the owner on Oct 29, 2022. It is now read-only.

Commit

Permalink
fix: update Markdown, fix HTML in links
Browse files Browse the repository at this point in the history
  • Loading branch information
ouuan committed Jul 27, 2020
1 parent a190d61 commit f130a09
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 40 deletions.
2 changes: 1 addition & 1 deletion config.toml
Expand Up @@ -97,7 +97,7 @@ copyright = "" # default: author.name ↓ # 默认为下面配
# Some global options, you can also close or open something in front matter for a single post, see more information from `archetypes/default.md`.
toc = true # 是否开启目录
autoCollapseToc = true # Auto expand and collapse toc # 目录自动展开/折叠
fancybox = true # see https://github.com/fancyapps/fancybox # 是否启用fancybox(图片可点击)
fancybox = false # see https://github.com/fancyapps/fancybox # 是否启用fancybox(图片可点击)

# mathjax
mathjax = true # see https://www.mathjax.org/ # 是否使用mathjax(数学公式)
Expand Down
2 changes: 1 addition & 1 deletion content/post/2019THUWC-WC冬眠记.md
Expand Up @@ -47,7 +47,7 @@ if (r<=10&&c<=10)

这样写真的爽\_(:з」∠)\_

T1是道期望,输出格式是最简分数,而且不约分的话数会非常大。当时我就在想为什么不取模..然后出考场听说 T1 的式子有一堆可以约分,剩下的形式特别简单...
T1是道期望,输出格式是最简分数,而且不约分的话数会非常大。当时我就在想为什么不取模..然后出考场听说 T1 的式子有一堆可以约分,剩下的形式特别简单...

我的游记好像经常不写题目就瞎bb..还是简单说一下吧。

Expand Down
52 changes: 37 additions & 15 deletions content/post/from-hexo-to-hugo.md
Expand Up @@ -40,34 +40,56 @@ hugo 的配置步骤就不说了,网上很多教程,而且这个博客是 [

hugo 还支持 [aliases](https://gohugo.io/content-management/urls/#aliases),所以链接改动可以轻松处理。

如果对我博客的配置感兴趣,还可以参考 [config.toml](https://github.com/ouuan/hugo-blog/commits/master/config.toml)[even 主题](https://github.com/ouuan/hugo-theme-even/commits/) 的历史记录。

几个值得提醒的地方:(大约是我认为“已经完全搞好了!”之后遇到的问题,也就是你按网上的教程搞完之后仍然容易遇到的问题)

1. 站内搜索
### 站内搜索

可以参考 [1d0901f](https://github.com/ouuan/hugo-blog/commit/1d0901fca6725480450581bb7bec28e0b2afc4d6),如果主题不是 even 的话我这个应该就不太能直接用了,得改一下 `layout/_default/search.html` 还有 `static/js/search.js` 中的 `render` 函数。其实如果主题不是 even 的话建议以 [Client side searching for Hugo.io with Fuse.js](https://gist.github.com/eddiewebb/735feb48f50f0ddd65ae5606a1cb41ae) 为基础而不是以我魔改过的版本为基础修改,可以以我的作参考
可以参考 [1d0901f](https://github.com/ouuan/hugo-blog/commit/1d0901fca6725480450581bb7bec28e0b2afc4d6),如果主题不是 even 的话我这个应该就不太能直接用了,得改一下 `layout/_default/search.html` 还有 `static/js/search.js` 中的 `render` 函数。

2. 代码高亮
### 代码高亮

推荐使用 highlight.js 而不是 chroma。even 主题把 highlight.js 的 CSS 放到了自己的 `_code.scss` 里,所以光是加上一个 highlight.js 的 CSS 是不够的,还得在 `_code.scss` 里把 hljs 相关的删掉,如果是 dark theme 还得修改背景颜色。
推荐使用 highlight.js 而不是 chroma。even 主题把 highlight.js 的 CSS 放到了自己的 `_code.scss` 里,所以光是加上一个 highlight.js 的 CSS 是不够的,还得在 `_code.scss` 里把 hljs 相关的删掉,如果是 dark theme 还得修改背景颜色。

3. 代码复制按钮
### 代码复制按钮

可以参考 [8347acf](https://github.com/ouuan/hugo-theme-even/commit/8347acfe30f386f00dd81c843a879755377cccf5)。全靠搜索引擎学来的 CSS 果然不够..就这么点东西我搞了四个小时,主要是滚动条、字体大小、行高、padding 之类杂七杂八的问题。
可以参考 [8347acf](https://github.com/ouuan/hugo-theme-even/commit/8347acfe30f386f00dd81c843a879755377cccf5)。全靠搜索引擎学来的 CSS 果然不够..就这么点东西我搞了四个小时,主要是滚动条、字体大小、行高、padding 之类杂七杂八的问题。

4. GitInfo with Unicode
### GitInfo with Unicode

如果路径有中文,想用 GitInfo 的话就得 `git config --global core.quotePath false`,参见 [gohugoio/hugo#3071](https://github.com/gohugoio/hugo/issues/3071)
如果路径有中文,想用 GitInfo 的话就得 `git config --global core.quotePath false`,参见 [gohugoio/hugo#3071](https://github.com/gohugoio/hugo/issues/3071)

5. Table Of Content with h1
### Table Of Content with h1

默认情况下右侧目录是从 `<h2>` 开始的,如果你的文章中含有 `<h1>`(也就是 Markdown 中的单个 `#`),目录就会挂掉。在文章中使用 `<h1>`**不被推荐** 的,但我自己一年前写的一些博客里有 `<h1>`,虽然批量修改也不难,但还有一种解决方案:在 `config.toml` 中加入:
默认情况下右侧目录是从 `<h2>` 开始的,如果你的文章中含有 `<h1>`(也就是 Markdown 中的单个 `#`),目录就会挂掉。在文章中使用 `<h1>`**不被推荐** 的,但我自己一年前写的一些博客里有 `<h1>`,虽然批量修改也不难,但还有一种解决方案:在 `config.toml` 中加入:

```toml
[markup.tableOfContents]
startLevel = 1
```
```toml
[markup.tableOfContents]
startLevel = 1
```

如果对我博客的配置感兴趣,还可以参考 [config.toml](https://github.com/ouuan/hugo-blog/commits/master/config.toml)[even 主题](https://github.com/ouuan/hugo-theme-even/commits/) 的历史记录。
### HTML in links

例如:`[~~qwq~~](/post/from-hexo-to-hugo)`, `[![favicon](/favicon.ico)](/favicon.ico)`

默认情况下会渲染成这样:

[\<del\>qwq\</del\>](/post/from-hexo-to-hugo)

[\<img src="/favicon.ico" alt="favicon"\>](/favicon.ico)

可以将 `/layouts/_default/_markup/render-link.html` 设成这样:(这个板子还包含了外链打开新标签页,不被渲染成 HTML 源码的关键在于 `safeHTML`

```html
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank"{{ end }}>{{ safeHTML .Text }}</a>
```

然后就好了:

[<del>qwq</del>](/post/from-hexo-to-hugo)

[![favicon](/favicon.ico)](/favicon.ico)

## Issues

Expand Down
2 changes: 1 addition & 1 deletion content/post/莫队、带修莫队、树上莫队详解.md
Expand Up @@ -282,7 +282,7 @@ int gcd(int a,int b)
由于一般的题目都不会告诉你修改和询问分别的个数,所以统一用 $m​$ 表示,即 $O\left(\frac{mn^2}{B^2}+mB+\frac{n^2}{B}\right)​$ 。
那么 $B$ 取多少呢...Mathematica告诉我大约是这个: ![](dxmdfkdx.jpg)
那么 $B$ 取多少呢...Mathematica告诉我大约是这个: ![dxmdfkdx](/post_img/莫队、带修莫队、树上莫队详解/dxmdfkdx.jpg)
所以还是不要纠结带修莫队的最佳分块大小好了...视作 $n=m​$ 的话,就可以得到总移动次数为 $O\left(\frac{n^3}{B^2}+nB+\frac{n^2}{B}\right)​$,那么 $B=n^{\frac{2}{3}}​$ 时取最小值 $O\left(n^{\frac{5}{3}}\right)​$ 。
Expand Down

0 comments on commit f130a09

Please sign in to comment.