🚚 Feat: migrate exampleSite to docs submodule
@@ -31,7 +31,7 @@ jobs:
|
||||
ALGOLIA_APP_ID: YKOM6PKLUY
|
||||
ALGOLIA_ADMIN_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }}
|
||||
ALGOLIA_INDEX_NAME: 'index.en'
|
||||
ALGOLIA_INDEX_FILE: './exampleSite/public/index.json'
|
||||
ALGOLIA_INDEX_FILE: './docs/public/index.json'
|
||||
run: |
|
||||
npm run algolia
|
||||
|
||||
@@ -40,6 +40,6 @@ jobs:
|
||||
ALGOLIA_APP_ID: YKOM6PKLUY
|
||||
ALGOLIA_ADMIN_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }}
|
||||
ALGOLIA_INDEX_NAME: 'index.zh-cn'
|
||||
ALGOLIA_INDEX_FILE: './exampleSite/public/zh-cn/index.json'
|
||||
ALGOLIA_INDEX_FILE: './docs/public/zh-cn/index.json'
|
||||
run: |
|
||||
npm run algolia
|
||||
|
||||
@@ -18,4 +18,4 @@ jobs:
|
||||
hugo-version: latest
|
||||
extended: true
|
||||
- name: Build Hugo static files
|
||||
run: hugo -v --source=exampleSite --themesDir ../.. --gc
|
||||
run: hugo -v --source=docs --gc --minify
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
# Hugo default output directory
|
||||
public/
|
||||
/exampleSite/resources/
|
||||
|
||||
node_modules/
|
||||
build/
|
||||
resources/
|
||||
|
||||
# NPM
|
||||
node_modules/
|
||||
|
||||
## OS Files
|
||||
# Windows
|
||||
Thumbs.db
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
[submodule "docs"]
|
||||
path = docs
|
||||
url = https://github.com/Lruihao/FixIt-Docs.git
|
||||
@@ -22,10 +22,12 @@ Head to this [documentation page](https://fixit.lruihao.cn/theme-documentation-b
|
||||
Or run [Documentation Site](https://fixit.lruihao.cn) locally:
|
||||
|
||||
```bash
|
||||
hugo server --source=exampleSite
|
||||
git clone --recursive https://github.com/Lruihao/FixIt.git FixIt
|
||||
cd FixIt
|
||||
hugo server --source=docs
|
||||
```
|
||||
|
||||
Of course, you can also read the [FixIt wiki](https://github.com/Lruihao/FixIt/wiki) directly.
|
||||
In addition, there is the [FixIt wiki](https://github.com/Lruihao/FixIt/wiki).
|
||||
|
||||
## Migrate and Update
|
||||
|
||||
|
||||
@@ -22,10 +22,12 @@ FixIt 主题继承了这些主题的优秀功能,并在此基础上添加了
|
||||
或者,在本地构建 [文档](https://fixit.lruihao.cn/zh-cn/):
|
||||
|
||||
```bash
|
||||
hugo server --source=exampleSite
|
||||
git clone --recursive https://github.com/Lruihao/FixIt.git FixIt
|
||||
cd FixIt
|
||||
hugo server --source=docs
|
||||
```
|
||||
|
||||
当然,你也可以直接阅读 [FixIt 主题维基](https://github.com/Lruihao/FixIt/wiki)
|
||||
除此之外,还有[FixIt 主题维基](https://github.com/Lruihao/FixIt/wiki)。
|
||||
|
||||
## 迁移和升级
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
// ==============================
|
||||
// Custom style
|
||||
// 自定义样式
|
||||
// ==============================
|
||||
@@ -1,4 +0,0 @@
|
||||
// ==============================
|
||||
// Override Variables
|
||||
// 覆盖变量
|
||||
// ==============================
|
||||
|
Before Width: | Height: | Size: 495 KiB |
|
Before Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 262 KiB |
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 130 KiB |
|
Before Width: | Height: | Size: 268 KiB |
@@ -1,36 +0,0 @@
|
||||
/**
|
||||
* @author @Lruihao https://lruihao.cn
|
||||
* @description Custom javascript for the hugo theme FixIt.
|
||||
*/
|
||||
const CustomJS = new (function () {
|
||||
/**
|
||||
* Rest in Peace. R.I.P 🕯️
|
||||
* @2022-3-28 [3.21-mu5735] 沉痛哀悼 132 名遇难同胞:东航航班失事,遇难者含旅客 123 人,机组 9 人
|
||||
* @returns {CustomJS}
|
||||
*/
|
||||
this.RIP = () => {
|
||||
if (new Date() < new Date('2022-03-31')) {
|
||||
document.querySelector('html').style.filter = 'grayscale(100%)';
|
||||
}
|
||||
return this;
|
||||
};
|
||||
/**
|
||||
* Initialize.
|
||||
* @returns {CustomJS}
|
||||
*/
|
||||
this.init = () => {
|
||||
this.RIP();
|
||||
return this;
|
||||
};
|
||||
})();
|
||||
|
||||
/**
|
||||
* Immediate.
|
||||
*/
|
||||
(() => {
|
||||
// CustomJS.init();
|
||||
// It will be executed when the DOM tree is built.
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// console.log('DOM content loaded!')
|
||||
});
|
||||
})();
|
||||
@@ -1,139 +0,0 @@
|
||||
---
|
||||
title: "About FixIt"
|
||||
date: 2019-08-02T11:04:49+08:00
|
||||
draft: false
|
||||
comment: false
|
||||
pageStyle: "wide"
|
||||
|
||||
lightgallery: true
|
||||
|
||||
math:
|
||||
enable: true
|
||||
---
|
||||
|
||||
{{< style "img { height: 1.25rem; }" >}}
|
||||
[](https://github.com/Lruihao/FixIt/releases)
|
||||
[](https://github.com/Lruihao/FixIt/compare/v0.2.10...master)
|
||||
[](https://gohugo.io/)
|
||||
[](https://github.com/Lruihao/FixIt/blob/master/LICENSE)
|
||||
[](https://github.com/Lruihao/FixIt)
|
||||
[](https://github.com/Lruihao/FixIt/fork)
|
||||
{{< /style >}}
|
||||
|
||||
> [<img class="fixit-icon" src="/images/fixit.svg" alt="FixIt logo" /> FixIt](https://github.com/Lruihao/FixIt) is a **clean**, **elegant** but **advanced** blog theme for [Hugo](https://gohugo.io/) developed by [Lruihao](https://lruihao.cn).
|
||||
>
|
||||
> It is based on the original [LoveIt Theme](https://github.com/dillonzq/LoveIt), [LeaveIt Theme](https://github.com/liuzc/LeaveIt) and [KeepIt Theme](https://github.com/Fastbyte01/KeepIt).
|
||||
|
||||

|
||||
|
||||
### Features
|
||||
|
||||
#### Performance and SEO
|
||||
|
||||
* :(fa-solid fa-rocket fa-fw): Optimized for **performance**: [99]/[100] on mobile and [100]/[100] on desktop in [Google PageSpeed Insights](https://developers.google.com/speed/pagespeed/insights)
|
||||
* :(fa-brands fa-searchengin fa-fw): Optimized SEO performance with a correct **SEO SCHEMA** based on JSON-LD
|
||||
* :(fa-brands fa-google fa-fw): **[Google Analytics](https://analytics.google.com/analytics)** supported
|
||||
* :(fa-regular fa-chart-bar fa-fw): **[Fathom Analytics](https://usefathom.com/)** supported
|
||||
* :(fa-solid fa-search fa-fw): Search engine **verification** supported (Google, Bind, Yandex, Baidu, 360 and Sogou)
|
||||
* :(fa-solid fa-tachometer-alt fa-fw): **CDN** for third-party libraries supported
|
||||
* :(fa-solid fa-cloud-download-alt fa-fw): Automatically converted images with **Lazy Load** by [lazysizes](https://github.com/aFarkas/lazysizes)
|
||||
|
||||
#### Appearance and Layout
|
||||
|
||||
* [:(fa-solid fa-desktop):]/[:(fa-solid fa-mobile):] **Responsive** layout
|
||||
* [:(fa-solid fa-sun):]/[:(fa-solid fa-moon):] **[Light]/[Dark]** mode
|
||||
* :(fa-solid fa-layer-group fa-fw): Globally consistent **design language**
|
||||
* :(fa-solid fa-ellipsis-h fa-fw): **Pagination** supported
|
||||
* :(fa-regular fa-list-alt fa-fw): Easy-to-use and self-expanding **table of contents**
|
||||
* :(fa-solid fa-language fa-fw): **Multilanguage** supported and i18n ready
|
||||
* :(fa-brands fa-css3-alt fa-fw): Beautiful **CSS animation**
|
||||
|
||||
#### Social and Comment Systems
|
||||
|
||||
* :(fa-regular fa-user fa-fw): **Gravatar** supported by [Gravatar](https://gravatar.com)
|
||||
* :(fa-solid fa-user-circle fa-fw): Local **Avatar** supported
|
||||
* :(fa-regular fa-id-card fa-fw): Up to **73** social links supported
|
||||
* :(fa-solid fa-share-square fa-fw): Up to **28** share sites supported
|
||||
* :(fa-regular fa-comment fa-fw): **Disqus** comment system supported by [Disqus](https://disqus.com)
|
||||
* :(fa-regular fa-comment-dots fa-fw): **Gitalk** comment system supported by [Gitalk](https://github.com/gitalk/gitalk)
|
||||
* :(fa-regular fa-comment-alt fa-fw): **Valine** comment system supported by [Valine](https://valine.js.org/)
|
||||
* :(fa-regular fa-comment-alt fa-fw): **Waline** comment system supported by [Waline](https://waline.js.org/)
|
||||
* :(fa-regular fa-comments fa-fw): **Facebook comments** system supported by [Facebook](https://developers.facebook.com/docs/plugins/comments/)
|
||||
* :(fa-solid fa-comment fa-fw): **Telegram comments** system supported by [Comments](https://comments.app/)
|
||||
* :(fa-solid fa-comment-dots fa-fw): **Commento** comment system supported by [Commento](https://commento.io/)
|
||||
* :(fa-regular fa-comment-alt fa-fw): **Utterances** comment system supported by [Utterances](https://utteranc.es/)
|
||||
* :(fa-regular fa-comment-alt fa-fw): **Artalk** comment system supported by [Artalk](https://artalk.js.org/)
|
||||
* :(fa-solid fa-comment-alt fa-fw): **Twikoo** comment system supported by [Twikoo](https://twikoo.js.org/)
|
||||
* :(fa-solid fa-comment-alt fa-fw): **giscus** comment system supported by [giscus](https://giscus.app/)
|
||||
|
||||
#### Extended Features
|
||||
|
||||
* :(fa-solid fa-desktop fa-fw): **PWA (Progressive Web App)** supported
|
||||
* :(fa-solid fa-bars fa-fw): **Sub Menu** supported
|
||||
* :(fa-solid fa-lock fa-fw): **Content Encryption** supported (Pages, Partial)
|
||||
* :(fa-solid fa-users fa-fw): **Friends** page embedded template
|
||||
* :(fa-solid fa-search fa-fw): **Search** supported by [Lunr.js](https://lunrjs.com/) or [algolia](https://www.algolia.com/)
|
||||
* :(fa-regular fa-grin-tongue-wink fa-fw): **Twemoji** supported
|
||||
* :(fa-solid fa-code fa-fw): Automatically **highlighting** code
|
||||
* :(fa-regular fa-copy fa-fw): **Copy code** to clipboard with one click
|
||||
* :(fa-regular fa-images fa-fw): **Images gallery** supported by [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js)
|
||||
* :(fa-brands fa-font-awesome fa-fw): Extended Markdown syntax for **[Font Awesome](https://fontawesome.com/) icons**
|
||||
* :(fa-regular fa-sticky-note fa-fw): Extended Markdown syntax for **ruby annotation**
|
||||
* :(fa-solid fa-percentage fa-fw): Extended Markdown syntax for **fraction**
|
||||
* :(fa-solid fa-square-root-alt fa-fw): **Mathematical formula** supported by [$ \KaTeX $](https://katex.org/)
|
||||
* :(fa-solid fa-project-diagram fa-fw): **Diagrams** shortcode supported by [mermaid](https://github.com/knsv/mermaid)
|
||||
* :(fa-solid fa-chart-pie fa-fw): **Interactive data visualization** shortcode supported by [ECharts](https://echarts.apache.org/)
|
||||
* :(fa-solid fa-map-marked-alt fa-fw): **Mapbox** shortcode supported by [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js)
|
||||
* :(fa-solid fa-music fa-fw): **Music player** shortcode supported by [APlayer](https://github.com/MoePlayer/APlayer) and [MetingJS](https://github.com/metowolf/MetingJS)
|
||||
* :(fa-solid fa-video fa-fw): **Bilibili player** shortcode
|
||||
* :(fa-regular fa-bell fa-fw): Kinds of **admonitions** shortcode
|
||||
* :(fa-solid fa-align-left fa-fw): **Custom style** shortcode
|
||||
* :(fa-brands fa-js-square fa-fw): **Custom script** shortcode
|
||||
* :(fa-solid fa-i-cursor fa-fw): **Animated typing** supported by [TypeIt](https://typeitjs.com/)
|
||||
* :(fa-solid fa-cookie-bite fa-fw): **Cookie consent banner** supported by [cookieconsent](https://github.com/osano/cookieconsent)
|
||||
* :(fa-solid fa-signature fa-fw): **Web Watermark** supported by [cell-watermark](https://github.com/Lruihao/watermark)
|
||||
* :(fa-solid fa-language fa-fw): **Chinese typesetting** supported by [pangu.js](https://github.com/vinta/pangu.js)
|
||||
* ...
|
||||
|
||||
### Acknowledgements
|
||||
|
||||
<details>
|
||||
<summary>Thanks to the authors of following resources included in the theme:</summary>
|
||||
|
||||
* [normalize.css](https://github.com/necolas/normalize.css)
|
||||
* [Font Awesome](https://fontawesome.com/)
|
||||
* [Simple Icons](https://github.com/simple-icons/simple-icons)
|
||||
* [Animate.css](https://daneden.github.io/animate.css/)
|
||||
* [autocomplete.js](https://github.com/algolia/autocomplete.js)
|
||||
* [Lunr.js](https://lunrjs.com/)
|
||||
* [algoliasearch](https://github.com/algolia/algoliasearch-client-javascript)
|
||||
* [lazysizes](https://github.com/aFarkas/lazysizes)
|
||||
* [object-fit-images](https://github.com/fregante/object-fit-images)
|
||||
* [Twemoji](https://github.com/twitter/twemoji)
|
||||
* [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js)
|
||||
* [Sharer.js](https://github.com/ellisonleao/sharer.js)
|
||||
* [TypeIt](https://typeitjs.com/)
|
||||
* [$ \KaTeX $](https://katex.org/)
|
||||
* [mermaid](https://github.com/knsv/mermaid)
|
||||
* [ECharts](https://echarts.apache.org/)
|
||||
* [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js)
|
||||
* [APlayer](https://github.com/MoePlayer/APlayer)
|
||||
* [MetingJS](https://github.com/metowolf/MetingJS)
|
||||
* [Gitalk](https://github.com/gitalk/gitalk)
|
||||
* [Valine](https://valine.js.org/)
|
||||
* [cookieconsent](https://github.com/osano/cookieconsent)
|
||||
* [cell-watermark](https://github.com/Lruihao/watermark)
|
||||
* [pangu.js](https://github.com/vinta/pangu.js)
|
||||
* [Artalk](https://artalk.js.org/)
|
||||
* [Waline](https://waline.js.org/)
|
||||
* [Twikoo](https://twikoo.js.org/)
|
||||
* [github-corners](https://github.com/tholman/github-corners)
|
||||
* [giscus](https://giscus.app/)
|
||||
* [crypto-js](https://github.com/brix/crypto-js)
|
||||
* [vConsole](https://github.com/Tencent/vConsole)
|
||||
* [eruda](https://github.com/liriliri/eruda)
|
||||
</details>
|
||||
|
||||
### License
|
||||
|
||||
FixIt is licensed under the **MIT** license. Check the [LICENSE file](https://github.com/Lruihao/FixIt/blob/master/LICENSE) for details.
|
||||
@@ -1,140 +0,0 @@
|
||||
---
|
||||
title: "关于 FixIt"
|
||||
date: 2019-08-02T11:04:49+08:00
|
||||
draft: false
|
||||
comment: false
|
||||
comment: false
|
||||
pageStyle: "wide"
|
||||
|
||||
lightgallery: true
|
||||
|
||||
math:
|
||||
enable: true
|
||||
---
|
||||
|
||||
{{< style "img { height: 1.25rem; }" >}}
|
||||
[](https://github.com/Lruihao/FixIt/releases)
|
||||
[](https://github.com/Lruihao/FixIt/compare/v0.2.10...master)
|
||||
[](https://gohugo.io/)
|
||||
[](https://github.com/Lruihao/FixIt/blob/master/LICENSE)
|
||||
[](https://github.com/Lruihao/FixIt)
|
||||
[](https://github.com/Lruihao/FixIt/fork)
|
||||
{{< /style >}}
|
||||
|
||||
> [<img class="fixit-icon" src="/images/fixit.svg" alt="FixIt logo" /> FixIt](https://github.com/Lruihao/FixIt) 是一个由 [Lruihao](https://lruihao.cn) 开发的**简洁**、**优雅**且**高效**的 [Hugo](https://gohugo.io/) 博客主题。
|
||||
>
|
||||
> 它的原型基于 [LoveIt 主题](https://github.com/dillonzq/LoveIt),[LeaveIt 主题](https://github.com/liuzc/LeaveIt) 和 [KeepIt 主题](https://github.com/Fastbyte01/KeepIt)。
|
||||
|
||||

|
||||
|
||||
### 特性
|
||||
|
||||
#### 性能和 SEO
|
||||
|
||||
* :(fa-solid fa-rocket fa-fw): **性能**优化:在 [Google PageSpeed Insights](https://developers.google.com/speed/pagespeed/insights) 中, [99]/[100] 的移动设备得分和 [100]/[100] 的桌面设备得分
|
||||
* :(fa-brands fa-searchengin fa-fw): 使用基于 JSON-LD 格式 的 **SEO SCHEMA** 文件进行 SEO 优化
|
||||
* :(fa-brands fa-google fa-fw): 支持 **[Google Analytics](https://analytics.google.com/analytics)**
|
||||
* :(fa-regular fa-chart-bar fa-fw): 支持 **[Fathom Analytics](https://usefathom.com/)**
|
||||
* :(fa-solid fa-search fa-fw): 支持搜索引擎的**网站验证** (Google, Bind, Yandex, Baidu, 360 and Sogou)
|
||||
* :(fa-solid fa-tachometer-alt fa-fw): 支持所有第三方库的 **CDN**
|
||||
* :(fa-solid fa-cloud-download-alt fa-fw): 基于 [lazysizes](https://github.com/aFarkas/lazysizes) 自动转换图片为**懒加载**
|
||||
|
||||
#### 外观和布局
|
||||
|
||||
* [:(fa-solid fa-desktop):]/[:(fa-solid fa-mobile):] **响应式**布局
|
||||
* [:(fa-solid fa-sun):]/[:(fa-solid fa-moon):] **[浅色]/[深色]** 主题模式
|
||||
* :(fa-solid fa-layer-group fa-fw): 全局一致的**设计语言**
|
||||
* :(fa-solid fa-ellipsis-h fa-fw): 支持**分页**
|
||||
* :(fa-regular fa-list-alt fa-fw): 易用和自动展开的**文章目录**
|
||||
* :(fa-solid fa-language fa-fw): 支持**多语言**和国际化
|
||||
* :(fa-brands fa-css3-alt fa-fw): 美观的 **CSS 动画**
|
||||
|
||||
#### 社交和评论系统
|
||||
|
||||
* :(fa-regular fa-user fa-fw): 支持 **[Gravatar](https://gravatar.com)** 头像
|
||||
* :(fa-solid fa-user-circle fa-fw): 支持本地**头像**
|
||||
* :(fa-regular fa-id-card fa-fw): 支持多达 **73** 种社交链接
|
||||
* :(fa-solid fa-share-square fa-fw): 支持多达 **28** 种网站分享
|
||||
* :(fa-regular fa-comment fa-fw): 支持 **[Disqus](https://disqus.com)** 评论系统
|
||||
* :(fa-regular fa-comment-dots fa-fw): 支持 **[Gitalk](https://github.com/gitalk/gitalk)** 评论系统
|
||||
* :(fa-regular fa-comment-alt fa-fw): 支持 **[Valine](https://valine.js.org/)** 评论系统
|
||||
* :(fa-regular fa-comment-alt fa-fw): 支持 **[Waline](https://waline.js.org/)** 评论系统
|
||||
* :(fa-regular fa-comments fa-fw): 支持 **[Facebook](https://developers.facebook.com/docs/plugins/comments/) 评论**系统
|
||||
* :(fa-solid fa-comment fa-fw): 支持 **[Telegram comments](https://comments.app/) 评论**系统
|
||||
* :(fa-solid fa-comment-dots fa-fw): 支持 **[Commento](https://commento.io/)** 评论系统
|
||||
* :(fa-regular fa-comment-alt fa-fw): 支持 **[Utterances](https://utteranc.es/)** 评论系统
|
||||
* :(fa-regular fa-comment-alt fa-fw): 支持 **[Artalk](https://artalk.js.org/)** 评论系统
|
||||
* :(fa-regular fa-comment-alt fa-fw): 支持 **[Twikoo](https://twikoo.js.org/)** 评论系统
|
||||
* :(fa-regular fa-comment-alt fa-fw): 支持 **[giscus](https://giscus.app/zh-CN/)** 评论系统
|
||||
|
||||
#### 扩展功能
|
||||
|
||||
* :(fa-solid fa-desktop fa-fw): 支持**渐进式网页应用**
|
||||
* :(fa-solid fa-bars fa-fw): 支持**二级菜单**
|
||||
* :(fa-solid fa-lock fa-fw): 支持**内容加密**(页面、局部)
|
||||
* :(fa-solid fa-users fa-fw): 支持**友情链接**的页面模板
|
||||
* :(fa-solid fa-search fa-fw): 支持基于 [Lunr.js](https://lunrjs.com/) 或 [algolia](https://www.algolia.com/) 的**搜索**
|
||||
* :(fa-regular fa-grin-tongue-wink fa-fw): 支持 **Twemoji**
|
||||
* :(fa-solid fa-code fa-fw): 支持**代码高亮**
|
||||
* :(fa-regular fa-copy fa-fw): 一键**复制代码**到剪贴板
|
||||
* :(fa-regular fa-images fa-fw): 支持基于 [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js) 的**图片画廊**
|
||||
* :(fa-brands fa-font-awesome fa-fw): 支持 **[Font Awesome](https://fontawesome.com/) 图标**的扩展 Markdown 语法
|
||||
* :(fa-regular fa-sticky-note fa-fw): 支持**上标注释**的扩展 Markdown 语法
|
||||
* :(fa-solid fa-percentage fa-fw): 支持**分数**的扩展 Markdown 语法
|
||||
* :(fa-solid fa-square-root-alt fa-fw): 支持基于 [$ \KaTeX $](https://katex.org/) 的**数学公式**
|
||||
* :(fa-solid fa-project-diagram fa-fw): 支持基于 [mermaid](https://github.com/knsv/mermaid) 的**图表** shortcode
|
||||
* :(fa-solid fa-chart-pie fa-fw): 支持基于 [ECharts](https://echarts.apache.org/) 的**交互式数据可视化** shortcode
|
||||
* :(fa-solid fa-map-marked-alt fa-fw): 支持基于 [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js) 的 **Mapbox** shortcode
|
||||
* :(fa-solid fa-music fa-fw): 支持基于 [APlayer](https://github.com/MoePlayer/APlayer) 和 [MetingJS](https://github.com/metowolf/MetingJS) 的**音乐播放器** shortcode
|
||||
* :(fa-solid fa-video fa-fw): 支持 **Bilibili 视频** shortcode
|
||||
* :(fa-regular fa-bell fa-fw): 支持多种**注释**的 shortcode
|
||||
* :(fa-solid fa-align-left fa-fw): 支持**自定义样式**的 shortcode
|
||||
* :(fa-brands fa-js-square fa-fw): 支持**自定义脚本**的 shortcode
|
||||
* :(fa-solid fa-i-cursor fa-fw): 支持基于 [TypeIt](https://typeitjs.com/) 的**打字动画** shortcode
|
||||
* :(fa-solid fa-cookie-bite fa-fw): 支持基于 [cookieconsent](https://github.com/osano/cookieconsent) 的 **Cookie 许可横幅**
|
||||
* :(fa-solid fa-signature fa-fw): 支持基于 [cell-watermark](https://github.com/Lruihao/watermark) 的**网页水印**
|
||||
* :(fa-solid fa-language fa-fw): 支持基于 [pangu.js](https://github.com/vinta/pangu.js) 的**中文排版**
|
||||
* ...
|
||||
|
||||
### 致谢
|
||||
|
||||
<details>
|
||||
<summary>FixIt 主题中用到了以下项目,感谢它们的作者:</summary>
|
||||
|
||||
* [normalize.css](https://github.com/necolas/normalize.css)
|
||||
* [Font Awesome](https://fontawesome.com/)
|
||||
* [Simple Icons](https://github.com/simple-icons/simple-icons)
|
||||
* [Animate.css](https://daneden.github.io/animate.css/)
|
||||
* [autocomplete.js](https://github.com/algolia/autocomplete.js)
|
||||
* [Lunr.js](https://lunrjs.com/)
|
||||
* [algoliasearch](https://github.com/algolia/algoliasearch-client-javascript)
|
||||
* [lazysizes](https://github.com/aFarkas/lazysizes)
|
||||
* [object-fit-images](https://github.com/fregante/object-fit-images)
|
||||
* [Twemoji](https://github.com/twitter/twemoji)
|
||||
* [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js)
|
||||
* [Sharer.js](https://github.com/ellisonleao/sharer.js)
|
||||
* [TypeIt](https://typeitjs.com/)
|
||||
* [$ \KaTeX $](https://katex.org/)
|
||||
* [mermaid](https://github.com/knsv/mermaid)
|
||||
* [ECharts](https://echarts.apache.org/)
|
||||
* [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js)
|
||||
* [APlayer](https://github.com/MoePlayer/APlayer)
|
||||
* [MetingJS](https://github.com/metowolf/MetingJS)
|
||||
* [Gitalk](https://github.com/gitalk/gitalk)
|
||||
* [Valine](https://valine.js.org/)
|
||||
* [cookieconsent](https://github.com/osano/cookieconsent)
|
||||
* [cell-watermark](https://github.com/Lruihao/watermark)
|
||||
* [pangu.js](https://github.com/vinta/pangu.js)
|
||||
* [Artalk](https://artalk.js.org/)
|
||||
* [Waline](https://waline.js.org/)
|
||||
* [Twikoo](https://twikoo.js.org/)
|
||||
* [github-corners](https://github.com/tholman/github-corners)
|
||||
* [giscus](https://giscus.app/zh-CN)
|
||||
* [crypto-js](https://github.com/brix/crypto-js)
|
||||
* [vConsole](https://github.com/Tencent/vConsole)
|
||||
* [eruda](https://github.com/liriliri/eruda)
|
||||
</details>
|
||||
|
||||
### 许可协议
|
||||
|
||||
FixIt 根据 **MIT** 许可协议授权。 更多信息请查看 [LICENSE 文件](https://github.com/Lruihao/FixIt/blob/master/LICENSE)。
|
||||
@@ -1,3 +0,0 @@
|
||||
---
|
||||
title: "Documentation"
|
||||
---
|
||||
@@ -1,3 +0,0 @@
|
||||
---
|
||||
title: "文档"
|
||||
---
|
||||
@@ -1,3 +0,0 @@
|
||||
---
|
||||
title: "测试"
|
||||
---
|
||||
@@ -1,21 +0,0 @@
|
||||
---
|
||||
title: "Friends"
|
||||
subtitle: Recording some friends who use FixIt theme
|
||||
type: "friends"
|
||||
description: "Friends tempalate demo of FixIt theme"
|
||||
keywords:
|
||||
- Hugo
|
||||
- friends tempalate
|
||||
comment:
|
||||
giscus:
|
||||
mapping: "number"
|
||||
term: "120"
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
{{< admonition tip "Add your FixIt site" >}}
|
||||
You could add your FixIt site to this page via [making a PR :(fa-solid fa-code-branch fa-fw):](https://github.com/Lruihao/FixIt/pulls). (e.g. [#111](https://github.com/Lruihao/FixIt/pull/111))
|
||||
|
||||
> :(fa-solid fa-exclamation-triangle): *Website failure, stop maintenance and improper content may be unlinked!*
|
||||
{{< /admonition >}}
|
||||
@@ -1,21 +0,0 @@
|
||||
---
|
||||
title: "友情链接"
|
||||
subtitle: 记录一些使用 FixIt 主题的朋友们
|
||||
type: "friends"
|
||||
description: "FixIt 主题的友链模板 Demo"
|
||||
keywords:
|
||||
- Hugo
|
||||
- 友情链接
|
||||
comment:
|
||||
giscus:
|
||||
mapping: "number"
|
||||
term: "120"
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
{{< admonition tip "添加您的 FixIt 网站" >}}
|
||||
您可以通过 [创建 PR :(fa-solid fa-code-branch fa-fw):](https://github.com/Lruihao/FixIt/pulls) 将您的 FixIt 网站添加到此页面。(例如:[#111](https://github.com/Lruihao/FixIt/pull/111))
|
||||
|
||||
> :(fa-solid fa-exclamation-triangle): *网站失效、停止维护、不当内容都可能被取消链接!*
|
||||
{{< /admonition >}}
|
||||
@@ -1,8 +0,0 @@
|
||||
---
|
||||
type: "offline"
|
||||
description: "offline cache page of FixIt theme"
|
||||
keywords:
|
||||
- PWA
|
||||
- offline
|
||||
- 离线
|
||||
---
|
||||
@@ -1,8 +0,0 @@
|
||||
---
|
||||
type: "offline"
|
||||
description: "FixIt 主题的离线缓存页面"
|
||||
keywords:
|
||||
- PWA
|
||||
- offline
|
||||
- 离线
|
||||
---
|
||||
|
Before Width: | Height: | Size: 43 KiB |
@@ -1,763 +0,0 @@
|
||||
---
|
||||
title: "Basic Markdown Syntax"
|
||||
date: 2021-12-18T16:15:22+08:00
|
||||
draft: false
|
||||
description: "This article shows the basic Markdown syntax and format."
|
||||
resources:
|
||||
- name: "featured-image"
|
||||
src: "featured-image.png"
|
||||
|
||||
tags: ["Markdown", "HTML"]
|
||||
categories: ["Markdown"]
|
||||
|
||||
lightgallery: true
|
||||
|
||||
repost:
|
||||
enable: true
|
||||
url: "https://hugoloveit.com/basic-markdown-syntax/"
|
||||
---
|
||||
|
||||
This article offers a sample of basic Markdown syntax that can be used in Hugo content files.
|
||||
|
||||
<!--more-->
|
||||
|
||||
{{< admonition >}}
|
||||
This article is a shameful copy of the great [Grav original page](http://learn.getgrav.org/content/markdown).
|
||||
|
||||
If you want to know about the extented Markdown syntax of **FixIt** theme, please read [extended Markdown syntax page](../theme-documentation-content#extended-markdown-syntax).
|
||||
{{< /admonition >}}
|
||||
|
||||
Let's face it: Writing content for the Web is tiresome. WYSIWYG editors help alleviate this task, but they generally result in horrible code, or worse yet, ugly web pages.
|
||||
|
||||
**Markdown** is a better way to write **HTML**, without all the complexities and ugliness that usually accompanies it.
|
||||
|
||||
Some of the key benefits are:
|
||||
|
||||
1. Markdown is simple to learn, with minimal extra characters, so it's also quicker to write content.
|
||||
2. Less chance of errors when writing in Markdown.
|
||||
3. Produces valid XHTML output.
|
||||
4. Keeps the content and the visual display separate, so you cannot mess up the look of your site.
|
||||
5. Write in any text editor or Markdown application you like.
|
||||
6. Markdown is a joy to use!
|
||||
|
||||
John Gruber, the author of Markdown, puts it like this:
|
||||
|
||||
> The overriding design goal for Markdown’s formatting syntax is to make it as readable as possible.
|
||||
> The idea is that a Markdown-formatted document should be publishable as-is, as plain text,
|
||||
> without looking like it’s been marked up with tags or formatting instructions.
|
||||
> While Markdown’s syntax has been influenced by several existing text-to-HTML filters,
|
||||
> the single biggest source of inspiration for Markdown’s syntax is the format of plain text email.
|
||||
>
|
||||
> {{< style "text-align: right;" >}}-- _John Gruber_{{< /style >}}
|
||||
|
||||
Without further delay, let us go over the main elements of Markdown and what the resulting HTML looks like!
|
||||
|
||||
{{< admonition tip >}}
|
||||
:(fa-regular fa-bookmark fa-fw): Bookmark this page for easy future reference!
|
||||
{{< /admonition >}}
|
||||
|
||||
## 1 Headings
|
||||
|
||||
Headings from `h2` through `h6` are constructed with a `#` for each level:
|
||||
|
||||
```markdown
|
||||
## h2 Heading
|
||||
### h3 Heading
|
||||
#### h4 Heading
|
||||
##### h5 Heading
|
||||
###### h6 Heading
|
||||
```
|
||||
|
||||
The HTML looks like this:
|
||||
|
||||
```html
|
||||
<h2>h2 Heading</h2>
|
||||
<h3>h3 Heading</h3>
|
||||
<h4>h4 Heading</h4>
|
||||
<h5>h5 Heading</h5>
|
||||
<h6>h6 Heading</h6>
|
||||
```
|
||||
|
||||
{{< admonition note "Heading IDs" >}}
|
||||
To add a custom heading ID, enclose the custom ID in curly braces on the same line as the heading:
|
||||
|
||||
```markdown
|
||||
### A Great Heading {#custom-id}
|
||||
```
|
||||
|
||||
The HTML looks like this:
|
||||
|
||||
```html
|
||||
<h3 id="custom-id">A Great Heading</h3>
|
||||
```
|
||||
{{< /admonition >}}
|
||||
|
||||
## 2 Comments
|
||||
|
||||
Comments should be HTML compatible.
|
||||
|
||||
```html
|
||||
<!--
|
||||
This is a comment
|
||||
-->
|
||||
```
|
||||
|
||||
Comment below should **NOT** be seen:
|
||||
|
||||
<!--
|
||||
This is a comment
|
||||
-->
|
||||
|
||||
## 3 Horizontal Rules
|
||||
|
||||
The HTML `<hr>` element is for creating a "thematic break" between paragraph-level elements.
|
||||
In Markdown, you can create a `<hr>` with any of the following:
|
||||
|
||||
* `___`: three consecutive underscores
|
||||
* `---`: three consecutive dashes
|
||||
* `***`: three consecutive asterisks
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
___
|
||||
---
|
||||
***
|
||||
|
||||
## 4 Body Copy
|
||||
|
||||
Body copy written as normal, plain text will be wrapped with `<p></p>` tags in the rendered HTML.
|
||||
|
||||
So this body copy:
|
||||
|
||||
```markdown
|
||||
Lorem ipsum dolor sit amet, graecis denique ei vel, at duo primis mandamus. Et legere ocurreret pri,
|
||||
animal tacimates complectitur ad cum. Cu eum inermis inimicus efficiendi. Labore officiis his ex,
|
||||
soluta officiis concludaturque ei qui, vide sensibus vim ad.
|
||||
```
|
||||
|
||||
The HTML looks like this:
|
||||
|
||||
```html
|
||||
<p>Lorem ipsum dolor sit amet, graecis denique ei vel, at duo primis mandamus. Et legere ocurreret pri, animal tacimates complectitur ad cum. Cu eum inermis inimicus efficiendi. Labore officiis his ex, soluta officiis concludaturque ei qui, vide sensibus vim ad.</p>
|
||||
```
|
||||
|
||||
A **line break** can be done with one blank line.
|
||||
|
||||
## 5 Inline HTML
|
||||
|
||||
If you need a certain HTML tag (with a class) you can simply use HTML:
|
||||
|
||||
```html
|
||||
Paragraph in Markdown.
|
||||
|
||||
<div class="class">
|
||||
This is <b>HTML</b>
|
||||
</div>
|
||||
|
||||
Paragraph in Markdown.
|
||||
```
|
||||
|
||||
## 6 Emphasis
|
||||
|
||||
### Bold
|
||||
|
||||
For emphasizing a snippet of text with a heavier font-weight.
|
||||
|
||||
The following snippet of text is **rendered as bold text**.
|
||||
|
||||
```markdown
|
||||
**rendered as bold text**
|
||||
__rendered as bold text__
|
||||
```
|
||||
|
||||
The HTML looks like this:
|
||||
|
||||
```html
|
||||
<strong>rendered as bold text</strong>
|
||||
```
|
||||
|
||||
### Italics
|
||||
|
||||
For emphasizing a snippet of text with italics.
|
||||
|
||||
The following snippet of text is _rendered as italicized text_.
|
||||
|
||||
```markdown
|
||||
*rendered as italicized text*
|
||||
_rendered as italicized text_
|
||||
```
|
||||
|
||||
The HTML looks like this:
|
||||
|
||||
```html
|
||||
<em>rendered as italicized text</em>
|
||||
```
|
||||
|
||||
### Strikethrough
|
||||
|
||||
In [[GFM]^(GitHub flavored Markdown)](https://github.github.com/gfm/) you can do strikethroughs.
|
||||
|
||||
```markdown
|
||||
~~Strike through this text.~~
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
~~Strike through this text.~~
|
||||
|
||||
The HTML looks like this:
|
||||
|
||||
```html
|
||||
<del>Strike through this text.</del>
|
||||
```
|
||||
|
||||
### Combination
|
||||
|
||||
Bold, italics, and strikethrough can be used in combination.
|
||||
|
||||
```markdown
|
||||
***bold and italics***
|
||||
~~**strikethrough and bold**~~
|
||||
~~*strikethrough and italics*~~
|
||||
~~***bold, italics and strikethrough***~~
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
***bold and italics***
|
||||
|
||||
~~**strikethrough and bold**~~
|
||||
|
||||
~~*strikethrough and italics*~~
|
||||
|
||||
~~***bold, italics and strikethrough***~~
|
||||
|
||||
The HTML looks like this:
|
||||
|
||||
```html
|
||||
<em><strong>bold and italics</strong></em>
|
||||
<del><strong>strikethrough and bold</strong></del>
|
||||
<del><em>strikethrough and italics</em></del>
|
||||
<del><em><strong>bold, italics and strikethrough</strong></em></del>
|
||||
```
|
||||
|
||||
## 7 Blockquotes
|
||||
|
||||
For quoting blocks of content from another source within your document.
|
||||
|
||||
Add `>` before any text you want to quote:
|
||||
|
||||
```markdown
|
||||
> **Fusion Drive** combines a hard drive with a flash storage (solid-state drive) and presents it as a single logical volume with the space of both drives combined.
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
> **Fusion Drive** combines a hard drive with a flash storage (solid-state drive) and presents it as a single logical volume with the space of both drives combined.
|
||||
|
||||
The HTML looks like this:
|
||||
|
||||
```html
|
||||
<blockquote>
|
||||
<p>
|
||||
<strong>Fusion Drive</strong> combines a hard drive with a flash storage (solid-state drive) and presents it as a single logical volume with the space of both drives combined.
|
||||
</p>
|
||||
</blockquote>
|
||||
```
|
||||
|
||||
Blockquotes can also be nested:
|
||||
|
||||
```markdown
|
||||
> Donec massa lacus, ultricies a ullamcorper in, fermentum sed augue.
|
||||
Nunc augue augue, aliquam non hendrerit ac, commodo vel nisi.
|
||||
>> Sed adipiscing elit vitae augue consectetur a gravida nunc vehicula. Donec auctor
|
||||
odio non est accumsan facilisis. Aliquam id turpis in dolor tincidunt mollis ac eu diam.
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
> Donec massa lacus, ultricies a ullamcorper in, fermentum sed augue.
|
||||
Nunc augue augue, aliquam non hendrerit ac, commodo vel nisi.
|
||||
>> Sed adipiscing elit vitae augue consectetur a gravida nunc vehicula. Donec auctor
|
||||
odio non est accumsan facilisis. Aliquam id turpis in dolor tincidunt mollis ac eu diam.
|
||||
|
||||
## 8 Lists
|
||||
|
||||
### Unordered
|
||||
|
||||
A list of items in which the order of the items does not explicitly matter.
|
||||
|
||||
You may use any of the following symbols to denote bullets for each list item:
|
||||
|
||||
```markdown
|
||||
* valid bullet
|
||||
- valid bullet
|
||||
+ valid bullet
|
||||
```
|
||||
|
||||
For example:
|
||||
|
||||
```markdown
|
||||
* Lorem ipsum dolor sit amet
|
||||
* Consectetur adipiscing elit
|
||||
* Integer molestie lorem at massa
|
||||
* Facilisis in pretium nisl aliquet
|
||||
* Nulla volutpat aliquam velit
|
||||
* Phasellus iaculis neque
|
||||
* Purus sodales ultricies
|
||||
* Vestibulum laoreet porttitor sem
|
||||
* Ac tristique libero volutpat at
|
||||
* Faucibus porta lacus fringilla vel
|
||||
* Aenean sit amet erat nunc
|
||||
* Eget porttitor lorem
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
* Lorem ipsum dolor sit amet
|
||||
* Consectetur adipiscing elit
|
||||
* Integer molestie lorem at massa
|
||||
* Facilisis in pretium nisl aliquet
|
||||
* Nulla volutpat aliquam velit
|
||||
* Phasellus iaculis neque
|
||||
* Purus sodales ultricies
|
||||
* Vestibulum laoreet porttitor sem
|
||||
* Ac tristique libero volutpat at
|
||||
* Faucibus porta lacus fringilla vel
|
||||
* Aenean sit amet erat nunc
|
||||
* Eget porttitor lorem
|
||||
|
||||
The HTML looks like this:
|
||||
|
||||
```html
|
||||
<ul>
|
||||
<li>Lorem ipsum dolor sit amet</li>
|
||||
<li>Consectetur adipiscing elit</li>
|
||||
<li>Integer molestie lorem at massa</li>
|
||||
<li>Facilisis in pretium nisl aliquet</li>
|
||||
<li>Nulla volutpat aliquam velit
|
||||
<ul>
|
||||
<li>Phasellus iaculis neque</li>
|
||||
<li>Purus sodales ultricies</li>
|
||||
<li>Vestibulum laoreet porttitor sem</li>
|
||||
<li>Ac tristique libero volutpat at</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Faucibus porta lacus fringilla vel</li>
|
||||
<li>Aenean sit amet erat nunc</li>
|
||||
<li>Eget porttitor lorem</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
### Ordered
|
||||
|
||||
A list of items in which the order of items does explicitly matter.
|
||||
|
||||
```markdown
|
||||
1. Lorem ipsum dolor sit amet
|
||||
2. Consectetur adipiscing elit
|
||||
3. Integer molestie lorem at massa
|
||||
4. Facilisis in pretium nisl aliquet
|
||||
5. Nulla volutpat aliquam velit
|
||||
6. Faucibus porta lacus fringilla vel
|
||||
7. Aenean sit amet erat nunc
|
||||
8. Eget porttitor lorem
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
1. Lorem ipsum dolor sit amet
|
||||
2. Consectetur adipiscing elit
|
||||
3. Integer molestie lorem at massa
|
||||
4. Facilisis in pretium nisl aliquet
|
||||
5. Nulla volutpat aliquam velit
|
||||
6. Faucibus porta lacus fringilla vel
|
||||
7. Aenean sit amet erat nunc
|
||||
8. Eget porttitor lorem
|
||||
|
||||
The HTML looks like this:
|
||||
|
||||
```html
|
||||
<ol>
|
||||
<li>Lorem ipsum dolor sit amet</li>
|
||||
<li>Consectetur adipiscing elit</li>
|
||||
<li>Integer molestie lorem at massa</li>
|
||||
<li>Facilisis in pretium nisl aliquet</li>
|
||||
<li>Nulla volutpat aliquam velit</li>
|
||||
<li>Faucibus porta lacus fringilla vel</li>
|
||||
<li>Aenean sit amet erat nunc</li>
|
||||
<li>Eget porttitor lorem</li>
|
||||
</ol>
|
||||
```
|
||||
|
||||
{{< admonition tip >}}
|
||||
If you just use `1.` for each number, Markdown will automatically number each item. For example:
|
||||
|
||||
```markdown
|
||||
1. Lorem ipsum dolor sit amet
|
||||
1. Consectetur adipiscing elit
|
||||
1. Integer molestie lorem at massa
|
||||
1. Facilisis in pretium nisl aliquet
|
||||
1. Nulla volutpat aliquam velit
|
||||
1. Faucibus porta lacus fringilla vel
|
||||
1. Aenean sit amet erat nunc
|
||||
1. Eget porttitor lorem
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
1. Lorem ipsum dolor sit amet
|
||||
1. Consectetur adipiscing elit
|
||||
1. Integer molestie lorem at massa
|
||||
1. Facilisis in pretium nisl aliquet
|
||||
1. Nulla volutpat aliquam velit
|
||||
1. Faucibus porta lacus fringilla vel
|
||||
1. Aenean sit amet erat nunc
|
||||
1. Eget porttitor lorem
|
||||
{{< /admonition >}}
|
||||
|
||||
### Task Lists
|
||||
|
||||
Task lists allow you to create a list of items with checkboxes. To create a task list, add dashes (`-`) and brackets with a space (`[ ]`) before task list items. To select a checkbox, add an x in between the brackets (`[x]`).
|
||||
|
||||
```markdown
|
||||
- [x] Write the press release
|
||||
- [ ] Update the website
|
||||
- [ ] Contact the media
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
- [x] Write the press release
|
||||
- [ ] Update the website
|
||||
- [ ] Contact the media
|
||||
|
||||
## 9 Code
|
||||
|
||||
### Inline Code
|
||||
|
||||
Wrap inline snippets of code with <code>`</code>.
|
||||
|
||||
```markdown
|
||||
In this example, `<section></section>` should be wrapped as **code**.
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
In this example, `<section></section>` should be wrapped as **code**.
|
||||
|
||||
The HTML looks like this:
|
||||
|
||||
```html
|
||||
<p>
|
||||
In this example, <code><section></section></code> should be wrapped with <strong>code</strong>.
|
||||
</p>
|
||||
```
|
||||
|
||||
### Indented Code
|
||||
|
||||
Or indent several lines of code by at least four spaces, as in:
|
||||
|
||||
```markdown
|
||||
// Some comments
|
||||
line 1 of code
|
||||
line 2 of code
|
||||
line 3 of code
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
// Some comments
|
||||
line 1 of code
|
||||
line 2 of code
|
||||
line 3 of code
|
||||
|
||||
The HTML looks like this:
|
||||
|
||||
```html
|
||||
<pre>
|
||||
<code>
|
||||
// Some comments
|
||||
line 1 of code
|
||||
line 2 of code
|
||||
line 3 of code
|
||||
</code>
|
||||
</pre>
|
||||
```
|
||||
|
||||
### Block Fenced Code
|
||||
|
||||
Use "fences" <code>```</code> to block in multiple lines of code with a language attribute.
|
||||
|
||||
{{< highlight markdown >}}
|
||||
```markdown
|
||||
Sample text here...
|
||||
```
|
||||
{{< / highlight >}}
|
||||
|
||||
The HTML looks like this:
|
||||
|
||||
```html
|
||||
<pre language-html>
|
||||
<code>Sample text here...</code>
|
||||
</pre>
|
||||
```
|
||||
|
||||
### Syntax Highlighting
|
||||
|
||||
[GFM]^(GitHub Flavored Markdown) also supports syntax highlighting.
|
||||
|
||||
To activate it, simply add the file extension of the language you want to use directly after the first code "fence",
|
||||
<code>```js</code>, and syntax highlighting will automatically be applied in the rendered HTML.
|
||||
|
||||
For example, to apply syntax highlighting to JavaScript code:
|
||||
|
||||
{{< highlight markdown >}}
|
||||
```js
|
||||
grunt.initConfig({
|
||||
assemble: {
|
||||
options: {
|
||||
assets: 'docs/assets',
|
||||
data: 'src/data/*.{json,yml}',
|
||||
helpers: 'src/custom-helpers.js',
|
||||
partials: ['src/partials/**/*.{hbs,md}']
|
||||
},
|
||||
pages: {
|
||||
options: {
|
||||
layout: 'default.hbs'
|
||||
},
|
||||
files: {
|
||||
'./': ['src/templates/pages/index.hbs']
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
{{< / highlight >}}
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
```js
|
||||
grunt.initConfig({
|
||||
assemble: {
|
||||
options: {
|
||||
assets: 'docs/assets',
|
||||
data: 'src/data/*.{json,yml}',
|
||||
helpers: 'src/custom-helpers.js',
|
||||
partials: ['src/partials/**/*.{hbs,md}']
|
||||
},
|
||||
pages: {
|
||||
options: {
|
||||
layout: 'default.hbs'
|
||||
},
|
||||
files: {
|
||||
'./': ['src/templates/pages/index.hbs']
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
{{< admonition >}}
|
||||
[Syntax highlighting page](https://gohugo.io/content-management/syntax-highlighting/) in **Hugo** Docs introduces more about syntax highlighting, including highlight shortcode.
|
||||
{{< /admonition >}}
|
||||
|
||||
## 10 Tables
|
||||
|
||||
Tables are created by adding pipes as dividers between each cell, and by adding a line of dashes (also separated by bars) beneath the header. Note that the pipes do not need to be vertically aligned.
|
||||
|
||||
```markdown
|
||||
| Option | Description |
|
||||
| ------ | ----------- |
|
||||
| data | path to data files to supply the data that will be passed into templates. |
|
||||
| engine | engine to be used for processing templates. Handlebars is the default. |
|
||||
| ext | extension to be used for dest files. |
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
| Option | Description |
|
||||
| ------ | ----------- |
|
||||
| data | path to data files to supply the data that will be passed into templates. |
|
||||
| engine | engine to be used for processing templates. Handlebars is the default. |
|
||||
| ext | extension to be used for dest files. |
|
||||
|
||||
The HTML looks like this:
|
||||
|
||||
```html
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Option</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>data</td>
|
||||
<td>path to data files to supply the data that will be passed into templates.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>engine</td>
|
||||
<td>engine to be used for processing templates. Handlebars is the default.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ext</td>
|
||||
<td>extension to be used for dest files.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
```
|
||||
|
||||
{{< admonition note "Right or center aligned text" >}}
|
||||
Adding a colon on the right side of the dashes below any heading will right align text for that column.
|
||||
|
||||
Adding colons on both sides of the dashes below any heading will center align text for that column.
|
||||
|
||||
```markdown
|
||||
| Option | Description |
|
||||
|:------:| -----------:|
|
||||
| data | path to data files to supply the data that will be passed into templates. |
|
||||
| engine | engine to be used for processing templates. Handlebars is the default. |
|
||||
| ext | extension to be used for dest files. |
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
| Option | Description |
|
||||
|:------:| -----------:|
|
||||
| data | path to data files to supply the data that will be passed into templates. |
|
||||
| engine | engine to be used for processing templates. Handlebars is the default. |
|
||||
| ext | extension to be used for dest files. |
|
||||
{{< /admonition >}}
|
||||
|
||||
## 11 Links {#links}
|
||||
|
||||
### Basic Link
|
||||
|
||||
```markdown
|
||||
<https://assemble.io>
|
||||
<contact@revolunet.com>
|
||||
[Assemble](https://assemble.io)
|
||||
```
|
||||
|
||||
The rendered output looks like this (hover over the link, there is no tooltip):
|
||||
|
||||
<https://assemble.io>
|
||||
|
||||
<contact@revolunet.com>
|
||||
|
||||
[Assemble](https://assemble.io)
|
||||
|
||||
The HTML looks like this:
|
||||
|
||||
```html
|
||||
<a href="https://assemble.io">https://assemble.io</a>
|
||||
<a href="mailto:contact@revolunet.com">contact@revolunet.com</a>
|
||||
<a href="https://assemble.io">Assemble</a>
|
||||
```
|
||||
|
||||
### Add a Title
|
||||
|
||||
```markdown
|
||||
[Upstage](https://github.com/upstage/ "Visit Upstage!")
|
||||
```
|
||||
|
||||
The rendered output looks like this (hover over the link, there should be a tooltip):
|
||||
|
||||
[Upstage](https://github.com/upstage/ "Visit Upstage!")
|
||||
|
||||
The HTML looks like this:
|
||||
|
||||
```html
|
||||
<a href="https://github.com/upstage/" title="Visit Upstage!">Upstage</a>
|
||||
```
|
||||
|
||||
### Named Anchors
|
||||
|
||||
Named anchors enable you to jump to the specified anchor point on the same page. For example, each of these chapters:
|
||||
|
||||
```markdown
|
||||
## Table of Contents
|
||||
* [Chapter 1](#chapter-1)
|
||||
* [Chapter 2](#chapter-2)
|
||||
* [Chapter 3](#chapter-3)
|
||||
```
|
||||
|
||||
will jump to these sections:
|
||||
|
||||
```markdown
|
||||
## Chapter 1 <a id="chapter-1"></a>
|
||||
Content for chapter one.
|
||||
|
||||
## Chapter 2 <a id="chapter-2"></a>
|
||||
Content for chapter one.
|
||||
|
||||
## Chapter 3 <a id="chapter-3"></a>
|
||||
Content for chapter one.
|
||||
```
|
||||
|
||||
{{< admonition >}}
|
||||
The specific placement of the anchor tag seems to be arbitrary. They are placed inline here since it seems to be unobtrusive, and it works.
|
||||
{{< /admonition >}}
|
||||
|
||||
## 12 Footnotes
|
||||
|
||||
Footnotes allow you to add notes and references without cluttering the body of the document. When you create a footnote, a superscript number with a link appears where you added the footnote reference. Readers can click the link to jump to the content of the footnote at the bottom of the page.
|
||||
|
||||
To create a footnote reference, add a caret and an identifier inside brackets (`[^1]`). Identifiers can be numbers or words, but they can’t contain spaces or tabs. Identifiers only correlate the footnote reference with the footnote itself — in the output, footnotes are numbered sequentially.
|
||||
|
||||
Add the footnote using another caret and number inside brackets with a colon and text (`[^1]: My footnote.`). You don’t have to put footnotes at the end of the document. You can put them anywhere except inside other elements like lists, block quotes, and tables.
|
||||
|
||||
```markdown
|
||||
This is a digital footnote[^1].
|
||||
This is a footnote with "label"[^label]
|
||||
|
||||
[^1]: This is a digital footnote
|
||||
[^label]: This is a footnote with "label"
|
||||
```
|
||||
|
||||
This is a digital footnote[^1].
|
||||
|
||||
This is a footnote with "label"[^label]
|
||||
|
||||
[^1]: This is a digital footnote
|
||||
[^label]: This is a footnote with "label"
|
||||
|
||||
## 13 Images
|
||||
|
||||
Images have a similar syntax to links but include a preceding exclamation point.
|
||||
|
||||
```markdown
|
||||

|
||||
```
|
||||
|
||||

|
||||
|
||||
or:
|
||||
|
||||
```markdown
|
||||

|
||||
```
|
||||
|
||||

|
||||
|
||||
Like links, images also have a footnote style syntax:
|
||||
|
||||
```markdown
|
||||
![Alt text][id]
|
||||
```
|
||||
|
||||
![Alt text][id]
|
||||
|
||||
With a reference later in the document defining the URL location:
|
||||
|
||||
```markdown
|
||||
[id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat"
|
||||
```
|
||||
|
||||
[id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat"
|
||||
|
||||
{{< admonition tip >}}
|
||||
**FixIt** theme has [special shortcode for image](../theme-documentation-extended-shortcodes#image), which provides more features.
|
||||
{{< /admonition >}}
|
||||
@@ -1,770 +0,0 @@
|
||||
---
|
||||
title: "Markdown 基本语法"
|
||||
date: 2021-12-18T16:15:22+08:00
|
||||
draft: false
|
||||
description: "这篇文章展示了基本的 Markdown 语法和格式。"
|
||||
resources:
|
||||
- name: "featured-image"
|
||||
src: "featured-image.png"
|
||||
|
||||
tags: ["Markdown", "HTML"]
|
||||
categories: ["Markdown"]
|
||||
|
||||
lightgallery: true
|
||||
|
||||
repost:
|
||||
enable: true
|
||||
url: "https://hugoloveit.com/zh-cn/basic-markdown-syntax/"
|
||||
---
|
||||
|
||||
这篇文章提供了可以在 Hugo 的文章中使用的基本 Markdown 语法示例。
|
||||
|
||||
<!--more-->
|
||||
|
||||
{{< admonition >}}
|
||||
这篇文章借鉴了一篇很棒的 [来自 Grav 的文章](http://learn.getgrav.org/content/markdown)。
|
||||
|
||||
如果你想了解 **FixIt** 主题的扩展 Markdown 语法,请阅读 [扩展 Markdown 语法页面](../theme-documentation-content#extended-markdown-syntax)。
|
||||
{{< /admonition >}}
|
||||
|
||||
事实上,编写 Web 内容很麻烦。[WYSIWYG]^(所见即所得) 编辑器帮助减轻了这一任务。但通常会导致代码太糟,或更糟糕的是,网页也会很丑。
|
||||
|
||||
没有通常伴随的所有复杂和丑陋的问题,**Markdown** 是一种更好的生成 **HTML** 内容的方式。
|
||||
|
||||
一些主要好处是:
|
||||
|
||||
1. Markdown 简单易学,几乎没有多余的字符,因此编写内容也更快。
|
||||
2. 用 Markdown 书写时出错的机会更少。
|
||||
3. 可以产生有效的 XHTML 输出。
|
||||
4. 将内容和视觉显示保持分开,这样就不会打乱网站的外观。
|
||||
5. 可以在你喜欢的任何文本编辑器或 Markdown 应用程序中编写内容。
|
||||
6. Markdown 使用起来很有趣!
|
||||
|
||||
John Gruber, Markdown 的作者如是说:
|
||||
|
||||
> Markdown 格式的首要设计目标是更具可读性。
|
||||
> 最初的想法是 Markdown 格式的文档应当以纯文本形式发布,
|
||||
> 而不会看起来像被标签或格式说明所标记。
|
||||
> 虽然 Markdown 的语法受到几种现有的文本到 HTML 转换工具的影响,
|
||||
> 但 Markdown 语法的最大灵感来源是纯文本电子邮件的格式。
|
||||
>
|
||||
> {{< style "text-align: right;" >}}-- _John Gruber_{{< /style >}}
|
||||
|
||||
话不多说,我们来回顾一下 Markdown 的主要语法以及生成的 HTML 样式!
|
||||
|
||||
{{< admonition tip >}}
|
||||
:(fa-regular fa-bookmark fa-fw): 将此页保存为书签,以备将来参考!
|
||||
{{< /admonition >}}
|
||||
|
||||
## 1 标题
|
||||
|
||||
从 `h2` 到 `h6` 的标题在每个级别上都加上一个 `#`:
|
||||
|
||||
```markdown
|
||||
## h2 标题
|
||||
### h3 标题
|
||||
#### h4 标题
|
||||
##### h5 标题
|
||||
###### h6 标题
|
||||
```
|
||||
|
||||
输出的 HTML 看起来像这样:
|
||||
|
||||
```html
|
||||
<h2>h2 标题</h2>
|
||||
<h3>h3 标题</h3>
|
||||
<h4>h4 标题</h4>
|
||||
<h5>h5 标题</h5>
|
||||
<h6>h6 标题</h6>
|
||||
```
|
||||
|
||||
{{< admonition note "标题 ID" >}}
|
||||
要添加自定义标题 ID, 请在与标题相同的行中将自定义 ID 放在花括号中:
|
||||
|
||||
```markdown
|
||||
### 一个很棒的标题 {#custom-id}
|
||||
```
|
||||
|
||||
输出的 HTML 看起来像这样:
|
||||
|
||||
```html
|
||||
<h3 id="custom-id">一个很棒的标题</h3>
|
||||
```
|
||||
{{< /admonition >}}
|
||||
|
||||
## 2 注释
|
||||
|
||||
注释是和 HTML 兼容的:
|
||||
|
||||
```html
|
||||
<!--
|
||||
这是一段注释
|
||||
-->
|
||||
```
|
||||
|
||||
**不能**看到以下的注释:
|
||||
|
||||
<!--
|
||||
这是一段注释
|
||||
-->
|
||||
|
||||
## 3 水平线
|
||||
|
||||
HTML 中的 `<hr>` 标签是用来在段落元素之间创建一个 "专题间隔" 的。
|
||||
使用 Markdown, 你可以用以下方式创建一个 `<hr>` 标签:
|
||||
|
||||
* `___`: 三个连续的下划线
|
||||
* `---`: 三个连续的破折号
|
||||
* `***`: 三个连续的星号
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
___
|
||||
---
|
||||
***
|
||||
|
||||
## 4 段落
|
||||
|
||||
按照纯文本的方式书写段落,纯文本在呈现的 HTML 中将用 `<p>`/`</p>` 标签包裹。
|
||||
|
||||
如下段落:
|
||||
|
||||
```markdown
|
||||
Lorem ipsum dolor sit amet, graecis denique ei vel, at duo primis mandamus. Et legere ocurreret pri,
|
||||
animal tacimates complectitur ad cum. Cu eum inermis inimicus efficiendi. Labore officiis his ex,
|
||||
soluta officiis concludaturque ei qui, vide sensibus vim ad.
|
||||
```
|
||||
|
||||
输出的 HTML 看起来像这样:
|
||||
|
||||
```html
|
||||
<p>Lorem ipsum dolor sit amet, graecis denique ei vel, at duo primis mandamus. Et legere ocurreret pri, animal tacimates complectitur ad cum. Cu eum inermis inimicus efficiendi. Labore officiis his ex, soluta officiis concludaturque ei qui, vide sensibus vim ad.</p>
|
||||
```
|
||||
|
||||
可以使用一个空白行进行**换行**.
|
||||
|
||||
## 5 内联 HTML 元素
|
||||
|
||||
如果你需要某个 HTML 标签 (带有一个类), 则可以简单地像这样使用:
|
||||
|
||||
```html
|
||||
Markdown 格式的段落。
|
||||
|
||||
<div class="class">
|
||||
这是 <b>HTML</b>
|
||||
</div>
|
||||
|
||||
Markdown 格式的段落。
|
||||
```
|
||||
|
||||
## 6 强调
|
||||
|
||||
### 加粗
|
||||
|
||||
用于强调带有较粗字体的文本片段。
|
||||
|
||||
以下文本片段会被 **渲染为粗体**.
|
||||
|
||||
```markdown
|
||||
**渲染为粗体**
|
||||
__渲染为粗体__
|
||||
```
|
||||
|
||||
输出的 HTML 看起来像这样:
|
||||
|
||||
```html
|
||||
<strong>渲染为粗体</strong>
|
||||
```
|
||||
|
||||
### 斜体
|
||||
|
||||
用于强调带有斜体的文本片段。
|
||||
|
||||
以下文本片段被 _渲染为斜体_。
|
||||
|
||||
```markdown
|
||||
*渲染为斜体*
|
||||
_渲染为斜体_
|
||||
```
|
||||
|
||||
输出的 HTML 看起来像这样:
|
||||
|
||||
```html
|
||||
<em>渲染为斜体</em>
|
||||
```
|
||||
|
||||
### 删除线
|
||||
|
||||
按照 [[GFM]^(GitHub flavored Markdown)](https://github.github.com/gfm/) 你可以使用删除线。
|
||||
|
||||
```markdown
|
||||
~~这段文本带有删除线。~~
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
~~这段文本带有删除线。~~
|
||||
|
||||
输出的 HTML 看起来像这样:
|
||||
|
||||
```html
|
||||
<del>这段文本带有删除线。</del>
|
||||
```
|
||||
|
||||
### 组合
|
||||
|
||||
加粗,斜体,和删除线可以 组合使用。
|
||||
|
||||
```markdown
|
||||
***加粗和斜体***
|
||||
~~**删除线和加粗**~~
|
||||
~~*删除线和斜体*~~
|
||||
~~***加粗,斜体和删除线***~~
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
***加粗和斜体***
|
||||
|
||||
~~**删除线和加粗**~~
|
||||
|
||||
~~*删除线和斜体*~~
|
||||
|
||||
~~***加粗,斜体和删除线***~~
|
||||
|
||||
输出的 HTML 看起来像这样:
|
||||
|
||||
```html
|
||||
<em><strong>加粗和斜体</strong></em>
|
||||
<del><strong>删除线和加粗</strong></del>
|
||||
<del><em>删除线和斜体</em></del>
|
||||
<del><em><strong>加粗,斜体和删除线</strong></em></del>
|
||||
```
|
||||
|
||||
## 7 引用
|
||||
|
||||
用于在文档中引用其他来源的内容块。
|
||||
|
||||
在要引用的任何文本之前添加 `>`:
|
||||
|
||||
```markdown
|
||||
> **Fusion Drive** combines a hard drive with a flash storage (solid-state drive) and presents it as a single logical volume with the space of both drives combined.
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
> **Fusion Drive** combines a hard drive with a flash storage (solid-state drive) and presents it as a single logical volume with the space of both drives combined.
|
||||
|
||||
输出的 HTML 看起来像这样:
|
||||
|
||||
```html
|
||||
<blockquote>
|
||||
<p>
|
||||
<strong>Fusion Drive</strong> combines a hard drive with a flash storage (solid-state drive) and presents it as a single logical volume with the space of both drives combined.
|
||||
</p>
|
||||
</blockquote>
|
||||
```
|
||||
|
||||
引用也可以嵌套:
|
||||
|
||||
```markdown
|
||||
> Donec massa lacus, ultricies a ullamcorper in, fermentum sed augue.
|
||||
Nunc augue augue, aliquam non hendrerit ac, commodo vel nisi.
|
||||
>> Sed adipiscing elit vitae augue consectetur a gravida nunc vehicula. Donec auctor
|
||||
odio non est accumsan facilisis. Aliquam id turpis in dolor tincidunt mollis ac eu diam.
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
> Donec massa lacus, ultricies a ullamcorper in, fermentum sed augue.
|
||||
Nunc augue augue, aliquam non hendrerit ac, commodo vel nisi.
|
||||
>> Sed adipiscing elit vitae augue consectetur a gravida nunc vehicula. Donec auctor
|
||||
odio non est accumsan facilisis. Aliquam id turpis in dolor tincidunt mollis ac eu diam.
|
||||
|
||||
## 8 列表
|
||||
|
||||
### 无序列表
|
||||
|
||||
一系列项的列表,其中项的顺序没有明显关系。
|
||||
|
||||
你可以使用以下任何符号来表示无序列表中的项:
|
||||
|
||||
```markdown
|
||||
* 一项内容
|
||||
- 一项内容
|
||||
+ 一项内容
|
||||
```
|
||||
|
||||
例如:
|
||||
|
||||
```markdown
|
||||
* Lorem ipsum dolor sit amet
|
||||
* Consectetur adipiscing elit
|
||||
* Integer molestie lorem at massa
|
||||
* Facilisis in pretium nisl aliquet
|
||||
* Nulla volutpat aliquam velit
|
||||
* Phasellus iaculis neque
|
||||
* Purus sodales ultricies
|
||||
* Vestibulum laoreet porttitor sem
|
||||
* Ac tristique libero volutpat at
|
||||
* Faucibus porta lacus fringilla vel
|
||||
* Aenean sit amet erat nunc
|
||||
* Eget porttitor lorem
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
* Lorem ipsum dolor sit amet
|
||||
* Consectetur adipiscing elit
|
||||
* Integer molestie lorem at massa
|
||||
* Facilisis in pretium nisl aliquet
|
||||
* Nulla volutpat aliquam velit
|
||||
* Phasellus iaculis neque
|
||||
* Purus sodales ultricies
|
||||
* Vestibulum laoreet porttitor sem
|
||||
* Ac tristique libero volutpat at
|
||||
* Faucibus porta lacus fringilla vel
|
||||
* Aenean sit amet erat nunc
|
||||
* Eget porttitor lorem
|
||||
|
||||
输出的 HTML 看起来像这样:
|
||||
|
||||
```html
|
||||
<ul>
|
||||
<li>Lorem ipsum dolor sit amet</li>
|
||||
<li>Consectetur adipiscing elit</li>
|
||||
<li>Integer molestie lorem at massa</li>
|
||||
<li>Facilisis in pretium nisl aliquet</li>
|
||||
<li>Nulla volutpat aliquam velit
|
||||
<ul>
|
||||
<li>Phasellus iaculis neque</li>
|
||||
<li>Purus sodales ultricies</li>
|
||||
<li>Vestibulum laoreet porttitor sem</li>
|
||||
<li>Ac tristique libero volutpat at</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Faucibus porta lacus fringilla vel</li>
|
||||
<li>Aenean sit amet erat nunc</li>
|
||||
<li>Eget porttitor lorem</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
### 有序列表
|
||||
|
||||
一系列项的列表,其中项的顺序确实很重要。
|
||||
|
||||
```markdown
|
||||
1. Lorem ipsum dolor sit amet
|
||||
2. Consectetur adipiscing elit
|
||||
3. Integer molestie lorem at massa
|
||||
4. Facilisis in pretium nisl aliquet
|
||||
5. Nulla volutpat aliquam velit
|
||||
6. Faucibus porta lacus fringilla vel
|
||||
7. Aenean sit amet erat nunc
|
||||
8. Eget porttitor lorem
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
1. Lorem ipsum dolor sit amet
|
||||
2. Consectetur adipiscing elit
|
||||
3. Integer molestie lorem at massa
|
||||
4. Facilisis in pretium nisl aliquet
|
||||
5. Nulla volutpat aliquam velit
|
||||
6. Faucibus porta lacus fringilla vel
|
||||
7. Aenean sit amet erat nunc
|
||||
8. Eget porttitor lorem
|
||||
|
||||
输出的 HTML 看起来像这样:
|
||||
|
||||
```html
|
||||
<ol>
|
||||
<li>Lorem ipsum dolor sit amet</li>
|
||||
<li>Consectetur adipiscing elit</li>
|
||||
<li>Integer molestie lorem at massa</li>
|
||||
<li>Facilisis in pretium nisl aliquet</li>
|
||||
<li>Nulla volutpat aliquam velit</li>
|
||||
<li>Faucibus porta lacus fringilla vel</li>
|
||||
<li>Aenean sit amet erat nunc</li>
|
||||
<li>Eget porttitor lorem</li>
|
||||
</ol>
|
||||
```
|
||||
|
||||
{{< admonition tip >}}
|
||||
如果你对每一项使用 `1.`, Markdown 将自动为每一项编号。例如:
|
||||
|
||||
```markdown
|
||||
1. Lorem ipsum dolor sit amet
|
||||
1. Consectetur adipiscing elit
|
||||
1. Integer molestie lorem at massa
|
||||
1. Facilisis in pretium nisl aliquet
|
||||
1. Nulla volutpat aliquam velit
|
||||
1. Faucibus porta lacus fringilla vel
|
||||
1. Aenean sit amet erat nunc
|
||||
1. Eget porttitor lorem
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
1. Lorem ipsum dolor sit amet
|
||||
1. Consectetur adipiscing elit
|
||||
1. Integer molestie lorem at massa
|
||||
1. Facilisis in pretium nisl aliquet
|
||||
1. Nulla volutpat aliquam velit
|
||||
1. Faucibus porta lacus fringilla vel
|
||||
1. Aenean sit amet erat nunc
|
||||
1. Eget porttitor lorem
|
||||
{{< /admonition >}}
|
||||
|
||||
### 任务列表
|
||||
|
||||
任务列表使你可以创建带有复选框的列表。
|
||||
要创建任务列表,请在任务列表项之前添加破折号 (`-`) 和带有空格的方括号 (`[ ]`),要选择一个复选框,请在方括号之间添加 x (`[x]`)。
|
||||
|
||||
```markdown
|
||||
- [x] Write the press release
|
||||
- [ ] Update the website
|
||||
- [ ] Contact the media
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
- [x] Write the press release
|
||||
- [ ] Update the website
|
||||
- [ ] Contact the media
|
||||
|
||||
## 9 代码
|
||||
|
||||
### 行内代码
|
||||
|
||||
用 <code>`</code> 包装行内代码段。
|
||||
|
||||
```markdown
|
||||
在这个例子中,`<section></section>` 会被包裹成 **代码**。
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
在这个例子中,`<section></section>` 会被包裹成 **代码**。
|
||||
|
||||
输出的 HTML 看起来像这样:
|
||||
|
||||
```html
|
||||
<p>
|
||||
在这个例子中,<code><section></section></code> 会被包裹成 <strong>代码</strong>。
|
||||
</p>
|
||||
```
|
||||
|
||||
### 缩进代码
|
||||
|
||||
将几行代码缩进至少四个空格,例如:
|
||||
|
||||
```markdown
|
||||
// Some comments
|
||||
line 1 of code
|
||||
line 2 of code
|
||||
line 3 of code
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
// Some comments
|
||||
line 1 of code
|
||||
line 2 of code
|
||||
line 3 of code
|
||||
|
||||
输出的 HTML 看起来像这样:
|
||||
|
||||
```html
|
||||
<pre>
|
||||
<code>
|
||||
// Some comments
|
||||
line 1 of code
|
||||
line 2 of code
|
||||
line 3 of code
|
||||
</code>
|
||||
</pre>
|
||||
```
|
||||
|
||||
### 围栏代码块
|
||||
|
||||
使用 "围栏" <code>```</code> 来生成一段带有语言属性的代码块。
|
||||
|
||||
{{< highlight markdown >}}
|
||||
```markdown
|
||||
Sample text here...
|
||||
```
|
||||
{{< / highlight >}}
|
||||
|
||||
输出的 HTML 看起来像这样:
|
||||
|
||||
```html
|
||||
<pre language-html>
|
||||
<code>Sample text here...</code>
|
||||
</pre>
|
||||
```
|
||||
|
||||
### 语法高亮
|
||||
|
||||
[GFM]^(GitHub Flavored Markdown) 也支持语法高亮。
|
||||
|
||||
要激活它,只需在第一个代码 "围栏" 之后直接添加你要使用的语言的文件扩展名,
|
||||
<code>```js</code>, 语法高亮显示将自动应用于渲染的 HTML 中。
|
||||
|
||||
例如,在以下 JavaScript 代码中应用语法高亮:
|
||||
|
||||
{{< highlight markdown >}}
|
||||
```js
|
||||
grunt.initConfig({
|
||||
assemble: {
|
||||
options: {
|
||||
assets: 'docs/assets',
|
||||
data: 'src/data/*.{json,yml}',
|
||||
helpers: 'src/custom-helpers.js',
|
||||
partials: ['src/partials/**/*.{hbs,md}']
|
||||
},
|
||||
pages: {
|
||||
options: {
|
||||
layout: 'default.hbs'
|
||||
},
|
||||
files: {
|
||||
'./': ['src/templates/pages/index.hbs']
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
{{< / highlight >}}
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
```js
|
||||
grunt.initConfig({
|
||||
assemble: {
|
||||
options: {
|
||||
assets: 'docs/assets',
|
||||
data: 'src/data/*.{json,yml}',
|
||||
helpers: 'src/custom-helpers.js',
|
||||
partials: ['src/partials/**/*.{hbs,md}']
|
||||
},
|
||||
pages: {
|
||||
options: {
|
||||
layout: 'default.hbs'
|
||||
},
|
||||
files: {
|
||||
'./': ['src/templates/pages/index.hbs']
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
{{< admonition >}}
|
||||
**Hugo** 文档中的 [语法高亮页面](https://gohugo.io/content-management/syntax-highlighting/) 介绍了有关语法高亮的更多信息,
|
||||
包括语法高亮的 shortcode。
|
||||
{{< /admonition >}}
|
||||
|
||||
## 10 表格
|
||||
|
||||
通过在每个单元格之间添加竖线作为分隔线,并在标题下添加一行破折号 (也由竖线分隔) 来创建表格。注意,竖线不需要垂直对齐。
|
||||
|
||||
```markdown
|
||||
| Option | Description |
|
||||
| ------ | ----------- |
|
||||
| data | path to data files to supply the data that will be passed into templates. |
|
||||
| engine | engine to be used for processing templates. Handlebars is the default. |
|
||||
| ext | extension to be used for dest files. |
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
| Option | Description |
|
||||
| ------ | ----------- |
|
||||
| data | path to data files to supply the data that will be passed into templates. |
|
||||
| engine | engine to be used for processing templates. Handlebars is the default. |
|
||||
| ext | extension to be used for dest files. |
|
||||
|
||||
输出的 HTML 看起来像这样:
|
||||
|
||||
```html
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Option</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>data</td>
|
||||
<td>path to data files to supply the data that will be passed into templates.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>engine</td>
|
||||
<td>engine to be used for processing templates. Handlebars is the default.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ext</td>
|
||||
<td>extension to be used for dest files.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
```
|
||||
|
||||
{{< admonition note "文本右对齐或居中对齐" >}}
|
||||
在任何标题下方的破折号右侧添加冒号将使该列的文本右对齐。
|
||||
|
||||
在任何标题下方的破折号两边添加冒号将使该列的对齐文本居中。
|
||||
|
||||
```markdown
|
||||
| Option | Description |
|
||||
|:------:| -----------:|
|
||||
| data | path to data files to supply the data that will be passed into templates. |
|
||||
| engine | engine to be used for processing templates. Handlebars is the default. |
|
||||
| ext | extension to be used for dest files. |
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
| Option | Description |
|
||||
|:------:| -----------:|
|
||||
| data | path to data files to supply the data that will be passed into templates. |
|
||||
| engine | engine to be used for processing templates. Handlebars is the default. |
|
||||
| ext | extension to be used for dest files. |
|
||||
{{< /admonition >}}
|
||||
|
||||
## 11 链接 {#links}
|
||||
|
||||
### 基本链接
|
||||
|
||||
```markdown
|
||||
<https://assemble.io>
|
||||
<contact@revolunet.com>
|
||||
[Assemble](https://assemble.io)
|
||||
```
|
||||
|
||||
呈现的输出效果如下 (将鼠标悬停在链接上,没有提示):
|
||||
|
||||
<https://assemble.io>
|
||||
|
||||
<contact@revolunet.com>
|
||||
|
||||
[Assemble](https://assemble.io)
|
||||
|
||||
输出的 HTML 看起来像这样:
|
||||
|
||||
```html
|
||||
<a href="https://assemble.io">https://assemble.io</a>
|
||||
<a href="mailto:contact@revolunet.com">contact@revolunet.com</a>
|
||||
<a href="https://assemble.io">Assemble</a>
|
||||
```
|
||||
|
||||
### 添加一个标题
|
||||
|
||||
```markdown
|
||||
[Upstage](https://github.com/upstage/ "Visit Upstage!")
|
||||
```
|
||||
|
||||
呈现的输出效果如下 (将鼠标悬停在链接上,会有一行提示):
|
||||
|
||||
[Upstage](https://github.com/upstage/ "Visit Upstage!")
|
||||
|
||||
输出的 HTML 看起来像这样:
|
||||
|
||||
```html
|
||||
<a href="https://github.com/upstage/" title="Visit Upstage!">Upstage</a>
|
||||
```
|
||||
|
||||
### 定位标记
|
||||
|
||||
定位标记使你可以跳至同一页面上的指定锚点。例如,每个章节:
|
||||
|
||||
```markdown
|
||||
## Table of Contents
|
||||
* [Chapter 1](#chapter-1)
|
||||
* [Chapter 2](#chapter-2)
|
||||
* [Chapter 3](#chapter-3)
|
||||
```
|
||||
|
||||
将跳转到这些部分:
|
||||
|
||||
```markdown
|
||||
## Chapter 1 <a id="chapter-1"></a>
|
||||
Content for chapter one.
|
||||
|
||||
## Chapter 2 <a id="chapter-2"></a>
|
||||
Content for chapter one.
|
||||
|
||||
## Chapter 3 <a id="chapter-3"></a>
|
||||
Content for chapter one.
|
||||
```
|
||||
|
||||
{{< admonition >}}
|
||||
定位标记的位置几乎是任意的。因为它们并不引人注目,所以它们通常被放在同一行了。
|
||||
{{< /admonition >}}
|
||||
|
||||
## 12 脚注
|
||||
|
||||
脚注使你可以添加注释和参考,而不会使文档正文混乱。
|
||||
当你创建脚注时,会在添加脚注引用的位置出现带有链接的上标编号。
|
||||
读者可以单击链接以跳至页面底部的脚注内容。
|
||||
|
||||
要创建脚注引用,请在方括号中添加插入符号和标识符 (`[^1]`)。
|
||||
标识符可以是数字或单词,但不能包含空格或制表符。
|
||||
标识符仅将脚注引用与脚注本身相关联 - 在脚注输出中,脚注按顺序编号。
|
||||
|
||||
在中括号内使用插入符号和数字以及用冒号和文本来添加脚注内容 (`[^1]:这是一段脚注`)。
|
||||
你不一定要在文档末尾添加脚注。可以将它们放在除列表,引用和表格等元素之外的任何位置。
|
||||
|
||||
```markdown
|
||||
这是一个数字脚注 [^1]
|
||||
这是一个带标签的脚注 [^label]
|
||||
|
||||
[^1]: 这是一个数字脚注
|
||||
[^label]: 这是一个带标签的脚注
|
||||
```
|
||||
|
||||
这是一个数字脚注 [^1]
|
||||
|
||||
这是一个带标签的脚注 [^label]
|
||||
|
||||
[^1]: 这是一个数字脚注
|
||||
[^label]: 这是一个带标签的脚注
|
||||
|
||||
## 13 图片
|
||||
|
||||
图片的语法与链接相似,但包含一个在前面的感叹号。
|
||||
|
||||
```markdown
|
||||

|
||||
```
|
||||
|
||||

|
||||
|
||||
或者:
|
||||
|
||||
```markdown
|
||||

|
||||
```
|
||||
|
||||

|
||||
|
||||
像链接一样,图片也具有脚注样式的语法:
|
||||
|
||||
```markdown
|
||||
![Alt text][id]
|
||||
```
|
||||
|
||||
![Alt text][id]
|
||||
|
||||
稍后在文档中提供参考内容,用来定义 URL 的位置:
|
||||
|
||||
```markdown
|
||||
[id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat"
|
||||
```
|
||||
|
||||
[id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat"
|
||||
|
||||
{{< admonition tip >}}
|
||||
**FixIt** 主题提供了一个包含更多功能的 [图片的 shortcode](../theme-documentation-extended-shortcodes#image).
|
||||
{{< /admonition >}}
|
||||
|
Before Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 114 KiB |
@@ -1,58 +0,0 @@
|
||||
---
|
||||
title: "Extended Shortcode - bilibili"
|
||||
date: 2022-07-20T13:55:03+08:00
|
||||
author: "Lruihao"
|
||||
authorLink: "https://lruihao.cn"
|
||||
description: "The bilibili shortcode embeds a responsive video player for bilibili videos."
|
||||
resources:
|
||||
- name: "featured-image"
|
||||
src: "featured-image.jpg"
|
||||
|
||||
tags: ["shortcodes"]
|
||||
categories: ["documentation"]
|
||||
|
||||
hiddenFromHomePage: true
|
||||
---
|
||||
|
||||
{{< version 0.2.0 changed >}}
|
||||
|
||||
The `bilibili` shortcode embeds a responsive video player for bilibili videos.
|
||||
|
||||
<!--more-->
|
||||
|
||||
When the video only has one part, only the BV `id` of the video is required, e.g.:
|
||||
|
||||
```code
|
||||
https://www.bilibili.com/video/BV1Sx411T7QQ
|
||||
```
|
||||
|
||||
Example `bilibili` input:
|
||||
|
||||
```go-html-template
|
||||
{{</* bilibili BV1Sx411T7QQ */>}}
|
||||
Or
|
||||
{{</* bilibili id=BV1Sx411T7QQ */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< bilibili id=BV1Sx411T7QQ >}}
|
||||
|
||||
When the video has multiple parts, in addition to the BV `id` of the video,
|
||||
`p` is also required, whose default value is `1`, e.g.:
|
||||
|
||||
```code
|
||||
https://www.bilibili.com/video/BV1TJ411C7An?p=3
|
||||
```
|
||||
|
||||
Example `bilibili` input with `p`:
|
||||
|
||||
```go-html-template
|
||||
{{</* bilibili BV1TJ411C7An 3 */>}}
|
||||
Or
|
||||
{{</* bilibili id=BV1TJ411C7An p=3 */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< bilibili id=BV1TJ411C7An p=3 >}}
|
||||
@@ -1,57 +0,0 @@
|
||||
---
|
||||
title: "扩展 Shortcode - bilibili"
|
||||
date: 2022-07-20T13:55:03+08:00
|
||||
author: "Lruihao"
|
||||
authorLink: "https://lruihao.cn"
|
||||
description: "bilibili shortcode 提供了一个内嵌的用来播放 bilibili 视频的响应式播放器。"
|
||||
resources:
|
||||
- name: "featured-image"
|
||||
src: "featured-image.jpg"
|
||||
|
||||
tags: ["shortcodes"]
|
||||
categories: ["documentation"]
|
||||
|
||||
hiddenFromHomePage: true
|
||||
---
|
||||
|
||||
{{< version 0.2.0 changed >}}
|
||||
|
||||
`bilibili` shortcode 提供了一个内嵌的用来播放 bilibili 视频的响应式播放器。
|
||||
|
||||
<!--more-->
|
||||
|
||||
如果视频只有一个部分,则仅需要视频的 BV `id`, 例如:
|
||||
|
||||
```code
|
||||
https://www.bilibili.com/video/BV1Sx411T7QQ
|
||||
```
|
||||
|
||||
一个 `bilibili` 示例:
|
||||
|
||||
```go-html-template
|
||||
{{</* bilibili BV1Sx411T7QQ */>}}
|
||||
或者
|
||||
{{</* bilibili id=BV1Sx411T7QQ */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< bilibili id=BV1Sx411T7QQ >}}
|
||||
|
||||
如果视频包含多个部分,则除了视频的 BV `id` 之外,还需要 `p`, 默认值为 `1`, 例如:
|
||||
|
||||
```code
|
||||
https://www.bilibili.com/video/BV1TJ411C7An?p=3
|
||||
```
|
||||
|
||||
一个带有 `p` 参数的 `bilibili` 示例:
|
||||
|
||||
```go-html-template
|
||||
{{</* bilibili BV1TJ411C7An 3 */>}}
|
||||
或者
|
||||
{{</* bilibili id=BV1TJ411C7An p=3 */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< bilibili id=BV1TJ411C7An p=3 >}}
|
||||
|
Before Width: | Height: | Size: 52 KiB |
@@ -1,407 +0,0 @@
|
||||
---
|
||||
title: "Extended Shortcode - echarts"
|
||||
date: 2022-07-20T11:44:15+08:00
|
||||
author: "Lruihao"
|
||||
authorLink: "https://lruihao.cn"
|
||||
description: "The echarts shortcode supports data visualization in Hugo with ECharts library."
|
||||
resources:
|
||||
- name: "featured-image"
|
||||
src: "featured-image.jpg"
|
||||
|
||||
tags: ["shortcodes"]
|
||||
categories: ["documentation"]
|
||||
|
||||
hiddenFromHomePage: true
|
||||
code:
|
||||
maxShownLines: 70
|
||||
---
|
||||
|
||||
The `echarts` shortcode supports data visualization in Hugo with [ECharts](https://echarts.apache.org/) library.
|
||||
|
||||
<!--more-->
|
||||
|
||||
**ECharts** is a library helping you to generate interactive data visualization.
|
||||
|
||||
The basic chart types ECharts supports include [line series](https://echarts.apache.org/en/option.html#series-line), [bar series](https://echarts.apache.org/en/option.html#series-line), [scatter series](https://echarts.apache.org/en/option.html#series-scatter), [pie charts](https://echarts.apache.org/en/option.html#series-pie), [candle-stick series](https://echarts.apache.org/en/option.html#series-candlestick), [boxplot series](https://echarts.apache.org/en/option.html#series-boxplot) for statistics, [map series](https://echarts.apache.org/en/option.html#series-map), [heatmap series](https://echarts.apache.org/en/option.html#series-heatmap), [lines series](https://echarts.apache.org/en/option.html#series-lines) for directional information, [graph series](https://echarts.apache.org/en/option.html#series-graph) for relationships, [treemap series](https://echarts.apache.org/en/option.html#series-treemap), [sunburst series](https://echarts.apache.org/en/option.html#series-sunburst), [parallel series](https://echarts.apache.org/en/option.html#series-parallel) for multi-dimensional data, [funnel series](https://echarts.apache.org/en/option.html#series-funnel), [gauge series](https://echarts.apache.org/en/option.html#series-gauge). And it's extremely easy to create a combinition of them with ECharts.
|
||||
|
||||
Just insert your ECharts option in `JSON`/`YAML`/`TOML` format in the `echarts` shortcode and that’s it.
|
||||
|
||||
Example `echarts` input in `JSON` format:
|
||||
|
||||
```json
|
||||
{{</* echarts */>}}
|
||||
{
|
||||
"title": {
|
||||
"text": "Summary Line Chart",
|
||||
"top": "2%",
|
||||
"left": "center"
|
||||
},
|
||||
"tooltip": {
|
||||
"trigger": "axis"
|
||||
},
|
||||
"legend": {
|
||||
"data": ["Email Marketing", "Affiliate Advertising", "Video Advertising", "Direct View", "Search Engine"],
|
||||
"top": "10%"
|
||||
},
|
||||
"grid": {
|
||||
"left": "5%",
|
||||
"right": "5%",
|
||||
"bottom": "5%",
|
||||
"top": "20%",
|
||||
"containLabel": true
|
||||
},
|
||||
"toolbox": {
|
||||
"feature": {
|
||||
"saveAsImage": {
|
||||
"title": "Save as Image"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xAxis": {
|
||||
"type": "category",
|
||||
"boundaryGap": false,
|
||||
"data": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
|
||||
},
|
||||
"yAxis": {
|
||||
"type": "value"
|
||||
},
|
||||
"series": [
|
||||
{
|
||||
"name": "Email Marketing",
|
||||
"type": "line",
|
||||
"stack": "Total",
|
||||
"data": [120, 132, 101, 134, 90, 230, 210]
|
||||
},
|
||||
{
|
||||
"name": "Affiliate Advertising",
|
||||
"type": "line",
|
||||
"stack": "Total",
|
||||
"data": [220, 182, 191, 234, 290, 330, 310]
|
||||
},
|
||||
{
|
||||
"name": "Video Advertising",
|
||||
"type": "line",
|
||||
"stack": "Total",
|
||||
"data": [150, 232, 201, 154, 190, 330, 410]
|
||||
},
|
||||
{
|
||||
"name": "Direct View",
|
||||
"type": "line",
|
||||
"stack": "Total",
|
||||
"data": [320, 332, 301, 334, 390, 330, 320]
|
||||
},
|
||||
{
|
||||
"name": "Search Engine",
|
||||
"type": "line",
|
||||
"stack": "Total",
|
||||
"data": [820, 932, 901, 934, 1290, 1330, 1320]
|
||||
}
|
||||
]
|
||||
}
|
||||
{{</* /echarts */>}}
|
||||
```
|
||||
|
||||
The same in `YAML` format:
|
||||
|
||||
```yaml
|
||||
{{</* echarts */>}}
|
||||
title:
|
||||
text: Summary Line Chart
|
||||
top: 2%
|
||||
left: center
|
||||
tooltip:
|
||||
trigger: axis
|
||||
legend:
|
||||
data:
|
||||
- Email Marketing
|
||||
- Affiliate Advertising
|
||||
- Video Advertising
|
||||
- Direct View
|
||||
- Search Engine
|
||||
top: 10%
|
||||
grid:
|
||||
left: 5%
|
||||
right: 5%
|
||||
bottom: 5%
|
||||
top: 20%
|
||||
containLabel: true
|
||||
toolbox:
|
||||
feature:
|
||||
saveAsImage:
|
||||
title: Save as Image
|
||||
xAxis:
|
||||
type: category
|
||||
boundaryGap: false
|
||||
data:
|
||||
- Monday
|
||||
- Tuesday
|
||||
- Wednesday
|
||||
- Thursday
|
||||
- Friday
|
||||
- Saturday
|
||||
- Sunday
|
||||
yAxis:
|
||||
type: value
|
||||
series:
|
||||
- name: Email Marketing
|
||||
type: line
|
||||
stack: Total
|
||||
data:
|
||||
- 120
|
||||
- 132
|
||||
- 101
|
||||
- 134
|
||||
- 90
|
||||
- 230
|
||||
- 210
|
||||
- name: Affiliate Advertising
|
||||
type: line
|
||||
stack: Total
|
||||
data:
|
||||
- 220
|
||||
- 182
|
||||
- 191
|
||||
- 234
|
||||
- 290
|
||||
- 330
|
||||
- 310
|
||||
- name: Video Advertising
|
||||
type: line
|
||||
stack: Total
|
||||
data:
|
||||
- 150
|
||||
- 232
|
||||
- 201
|
||||
- 154
|
||||
- 190
|
||||
- 330
|
||||
- 410
|
||||
- name: Direct View
|
||||
type: line
|
||||
stack: Total
|
||||
data:
|
||||
- 320
|
||||
- 332
|
||||
- 301
|
||||
- 334
|
||||
- 390
|
||||
- 330
|
||||
- 320
|
||||
- name: Search Engine
|
||||
type: line
|
||||
stack: Total
|
||||
data:
|
||||
- 820
|
||||
- 932
|
||||
- 901
|
||||
- 934
|
||||
- 1290
|
||||
- 1330
|
||||
- 1320
|
||||
{{</* /echarts */>}}
|
||||
```
|
||||
|
||||
The same in `TOML` format:
|
||||
|
||||
```toml
|
||||
{{</* echarts */>}}
|
||||
[title]
|
||||
text = "Summary Line Chart"
|
||||
top = "2%"
|
||||
left = "center"
|
||||
|
||||
[tooltip]
|
||||
trigger = "axis"
|
||||
|
||||
[legend]
|
||||
data = [
|
||||
"Email Marketing",
|
||||
"Affiliate Advertising",
|
||||
"Video Advertising",
|
||||
"Direct View",
|
||||
"Search Engine"
|
||||
]
|
||||
top = "10%"
|
||||
|
||||
[grid]
|
||||
left = "5%"
|
||||
right = "5%"
|
||||
bottom = "5%"
|
||||
top = "20%"
|
||||
containLabel = true
|
||||
|
||||
[toolbox]
|
||||
[toolbox.feature]
|
||||
[toolbox.feature.saveAsImage]
|
||||
title = "Save as Image"
|
||||
|
||||
[xAxis]
|
||||
type = "category"
|
||||
boundaryGap = false
|
||||
data = [
|
||||
"Monday",
|
||||
"Tuesday",
|
||||
"Wednesday",
|
||||
"Thursday",
|
||||
"Friday",
|
||||
"Saturday",
|
||||
"Sunday"
|
||||
]
|
||||
|
||||
[yAxis]
|
||||
type = "value"
|
||||
|
||||
[[series]]
|
||||
name = "Email Marketing"
|
||||
type = "line"
|
||||
stack = "Total"
|
||||
data = [
|
||||
120.0,
|
||||
132.0,
|
||||
101.0,
|
||||
134.0,
|
||||
90.0,
|
||||
230.0,
|
||||
210.0
|
||||
]
|
||||
|
||||
[[series]]
|
||||
name = "Affiliate Advertising"
|
||||
type = "line"
|
||||
stack = "Total"
|
||||
data = [
|
||||
220.0,
|
||||
182.0,
|
||||
191.0,
|
||||
234.0,
|
||||
290.0,
|
||||
330.0,
|
||||
310.0
|
||||
]
|
||||
|
||||
[[series]]
|
||||
name = "Video Advertising"
|
||||
type = "line"
|
||||
stack = "Total"
|
||||
data = [
|
||||
150.0,
|
||||
232.0,
|
||||
201.0,
|
||||
154.0,
|
||||
190.0,
|
||||
330.0,
|
||||
410.0
|
||||
]
|
||||
|
||||
[[series]]
|
||||
name = "Direct View"
|
||||
type = "line"
|
||||
stack = "Total"
|
||||
data = [
|
||||
320.0,
|
||||
332.0,
|
||||
301.0,
|
||||
334.0,
|
||||
390.0,
|
||||
330.0,
|
||||
320.0
|
||||
]
|
||||
|
||||
[[series]]
|
||||
name = "Search Engine"
|
||||
type = "line"
|
||||
stack = "Total"
|
||||
data = [
|
||||
820.0,
|
||||
932.0,
|
||||
901.0,
|
||||
934.0,
|
||||
1290.0,
|
||||
1330.0,
|
||||
1320.0
|
||||
]
|
||||
{{</* /echarts */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< echarts >}}
|
||||
{
|
||||
"title": {
|
||||
"text": "Summary Line Chart",
|
||||
"top": "2%",
|
||||
"left": "center"
|
||||
},
|
||||
"tooltip": {
|
||||
"trigger": "axis"
|
||||
},
|
||||
"legend": {
|
||||
"data": ["Email Marketing", "Affiliate Advertising", "Video Advertising", "Direct View", "Search Engine"],
|
||||
"top": "10%"
|
||||
},
|
||||
"grid": {
|
||||
"left": "5%",
|
||||
"right": "5%",
|
||||
"bottom": "5%",
|
||||
"top": "20%",
|
||||
"containLabel": true
|
||||
},
|
||||
"toolbox": {
|
||||
"feature": {
|
||||
"saveAsImage": {
|
||||
"title": "Save as Image"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xAxis": {
|
||||
"type": "category",
|
||||
"boundaryGap": false,
|
||||
"data": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
|
||||
},
|
||||
"yAxis": {
|
||||
"type": "value"
|
||||
},
|
||||
"series": [
|
||||
{
|
||||
"name": "Email Marketing",
|
||||
"type": "line",
|
||||
"stack": "Total",
|
||||
"data": [120, 132, 101, 134, 90, 230, 210]
|
||||
},
|
||||
{
|
||||
"name": "Affiliate Advertising",
|
||||
"type": "line",
|
||||
"stack": "Total",
|
||||
"data": [220, 182, 191, 234, 290, 330, 310]
|
||||
},
|
||||
{
|
||||
"name": "Video Advertising",
|
||||
"type": "line",
|
||||
"stack": "Total",
|
||||
"data": [150, 232, 201, 154, 190, 330, 410]
|
||||
},
|
||||
{
|
||||
"name": "Direct View",
|
||||
"type": "line",
|
||||
"stack": "Total",
|
||||
"data": [320, 332, 301, 334, 390, 330, 320]
|
||||
},
|
||||
{
|
||||
"name": "Search Engine",
|
||||
"type": "line",
|
||||
"stack": "Total",
|
||||
"data": [820, 932, 901, 934, 1290, 1330, 1320]
|
||||
}
|
||||
]
|
||||
}
|
||||
{{< /echarts >}}
|
||||
|
||||
The `echarts` shortcode has also the following named parameters:
|
||||
|
||||
* **width** *[optional]* (**first** positional parameter)
|
||||
|
||||
{{< version 0.2.0 >}} Width of the data visualization, default value is `100%`.
|
||||
|
||||
* **height** *[optional]* (**second** positional parameter)
|
||||
|
||||
{{< version 0.2.0 >}} Height of the data visualization, default value is `30rem`.
|
||||
@@ -1,407 +0,0 @@
|
||||
---
|
||||
title: "扩展 Shortcode - echarts"
|
||||
date: 2022-07-20T11:44:15+08:00
|
||||
author: "Lruihao"
|
||||
authorLink: "https://lruihao.cn"
|
||||
description: "echarts shortcode 使用 ECharts 库提供数据可视化的功能。"
|
||||
resources:
|
||||
- name: "featured-image"
|
||||
src: "featured-image.jpg"
|
||||
|
||||
tags: ["shortcodes"]
|
||||
categories: ["documentation"]
|
||||
|
||||
hiddenFromHomePage: true
|
||||
code:
|
||||
maxShownLines: 70
|
||||
---
|
||||
|
||||
`echarts` shortcode 使用 [ECharts](https://echarts.apache.org/) 库提供数据可视化的功能.
|
||||
|
||||
<!--more-->
|
||||
|
||||
**ECharts** 是一个帮助你生成交互式数据可视化的库.
|
||||
|
||||
ECharts 提供了常规的 [折线图](https://echarts.apache.org/zh/option.html#series-line), [柱状图](https://echarts.apache.org/zh/option.html#series-line), [散点图](https://echarts.apache.org/zh/option.html#series-scatter), [饼图](https://echarts.apache.org/zh/option.html#series-pie), [K线图](https://echarts.apache.org/zh/option.html#series-candlestick), 用于统计的 [盒形图](https://echarts.apache.org/zh/option.html#series-boxplot), 用于地理数据可视化的 [地图](https://echarts.apache.org/zh/option.html#series-map), [热力图](https://echarts.apache.org/zh/option.html#series-heatmap), [线图](https://echarts.apache.org/zh/option.html#series-lines), 用于关系数据可视化的 [关系图](https://echarts.apache.org/zh/option.html#series-graph), [treemap](https://echarts.apache.org/zh/option.html#series-treemap), [旭日图](https://echarts.apache.org/zh/option.html#series-sunburst), 多维数据可视化的 [平行坐标](https://echarts.apache.org/zh/option.html#series-parallel), 还有用于 BI 的 [漏斗图](https://echarts.apache.org/zh/option.html#series-funnel), [仪表盘](https://echarts.apache.org/zh/option.html#series-gauge), 并且支持图与图之间的混搭.
|
||||
|
||||
只需在 `echarts` shortcode 中以 `JSON`/`YAML`/`TOML`格式插入 ECharts 选项即可.
|
||||
|
||||
一个 `JSON` 格式的 `echarts` 示例:
|
||||
|
||||
```json
|
||||
{{</* echarts */>}}
|
||||
{
|
||||
"title": {
|
||||
"text": "折线统计图",
|
||||
"top": "2%",
|
||||
"left": "center"
|
||||
},
|
||||
"tooltip": {
|
||||
"trigger": "axis"
|
||||
},
|
||||
"legend": {
|
||||
"data": ["邮件营销", "联盟广告", "视频广告", "直接访问", "搜索引擎"],
|
||||
"top": "10%"
|
||||
},
|
||||
"grid": {
|
||||
"left": "5%",
|
||||
"right": "5%",
|
||||
"bottom": "5%",
|
||||
"top": "20%",
|
||||
"containLabel": true
|
||||
},
|
||||
"toolbox": {
|
||||
"feature": {
|
||||
"saveAsImage": {
|
||||
"title": "保存为图片"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xAxis": {
|
||||
"type": "category",
|
||||
"boundaryGap": false,
|
||||
"data": ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]
|
||||
},
|
||||
"yAxis": {
|
||||
"type": "value"
|
||||
},
|
||||
"series": [
|
||||
{
|
||||
"name": "邮件营销",
|
||||
"type": "line",
|
||||
"stack": "总量",
|
||||
"data": [120, 132, 101, 134, 90, 230, 210]
|
||||
},
|
||||
{
|
||||
"name": "联盟广告",
|
||||
"type": "line",
|
||||
"stack": "总量",
|
||||
"data": [220, 182, 191, 234, 290, 330, 310]
|
||||
},
|
||||
{
|
||||
"name": "视频广告",
|
||||
"type": "line",
|
||||
"stack": "总量",
|
||||
"data": [150, 232, 201, 154, 190, 330, 410]
|
||||
},
|
||||
{
|
||||
"name": "直接访问",
|
||||
"type": "line",
|
||||
"stack": "总量",
|
||||
"data": [320, 332, 301, 334, 390, 330, 320]
|
||||
},
|
||||
{
|
||||
"name": "搜索引擎",
|
||||
"type": "line",
|
||||
"stack": "总量",
|
||||
"data": [820, 932, 901, 934, 1290, 1330, 1320]
|
||||
}
|
||||
]
|
||||
}
|
||||
{{</* /echarts */>}}
|
||||
```
|
||||
|
||||
一个 `YAML` 格式的 `echarts` 示例:
|
||||
|
||||
```yaml
|
||||
{{</* echarts */>}}
|
||||
title:
|
||||
text: 折线统计图
|
||||
top: 2%
|
||||
left: center
|
||||
tooltip:
|
||||
trigger: axis
|
||||
legend:
|
||||
data:
|
||||
- 邮件营销
|
||||
- 联盟广告
|
||||
- 视频广告
|
||||
- 直接访问
|
||||
- 搜索引擎
|
||||
top: 10%
|
||||
grid:
|
||||
left: 5%
|
||||
right: 5%
|
||||
bottom: 5%
|
||||
top: 20%
|
||||
containLabel: true
|
||||
toolbox:
|
||||
feature:
|
||||
saveAsImage:
|
||||
title: 保存为图片
|
||||
xAxis:
|
||||
type: category
|
||||
boundaryGap: false
|
||||
data:
|
||||
- 周一
|
||||
- 周二
|
||||
- 周三
|
||||
- 周四
|
||||
- 周五
|
||||
- 周六
|
||||
- 周日
|
||||
yAxis:
|
||||
type: value
|
||||
series:
|
||||
- name: 邮件营销
|
||||
type: line
|
||||
stack: 总量
|
||||
data:
|
||||
- 120
|
||||
- 132
|
||||
- 101
|
||||
- 134
|
||||
- 90
|
||||
- 230
|
||||
- 210
|
||||
- name: 联盟广告
|
||||
type: line
|
||||
stack: 总量
|
||||
data:
|
||||
- 220
|
||||
- 182
|
||||
- 191
|
||||
- 234
|
||||
- 290
|
||||
- 330
|
||||
- 310
|
||||
- name: 视频广告
|
||||
type: line
|
||||
stack: 总量
|
||||
data:
|
||||
- 150
|
||||
- 232
|
||||
- 201
|
||||
- 154
|
||||
- 190
|
||||
- 330
|
||||
- 410
|
||||
- name: 直接访问
|
||||
type: line
|
||||
stack: 总量
|
||||
data:
|
||||
- 320
|
||||
- 332
|
||||
- 301
|
||||
- 334
|
||||
- 390
|
||||
- 330
|
||||
- 320
|
||||
- name: 搜索引擎
|
||||
type: line
|
||||
stack: 总量
|
||||
data:
|
||||
- 820
|
||||
- 932
|
||||
- 901
|
||||
- 934
|
||||
- 1290
|
||||
- 1330
|
||||
- 1320
|
||||
{{</* /echarts */>}}
|
||||
```
|
||||
|
||||
一个 `TOML` 格式的 `echarts` 示例:
|
||||
|
||||
```toml
|
||||
{{</* echarts */>}}
|
||||
[title]
|
||||
text = "折线统计图"
|
||||
top = "2%"
|
||||
left = "center"
|
||||
|
||||
[tooltip]
|
||||
trigger = "axis"
|
||||
|
||||
[legend]
|
||||
data = [
|
||||
"邮件营销",
|
||||
"联盟广告",
|
||||
"视频广告",
|
||||
"直接访问",
|
||||
"搜索引擎"
|
||||
]
|
||||
top = "10%"
|
||||
|
||||
[grid]
|
||||
left = "5%"
|
||||
right = "5%"
|
||||
bottom = "5%"
|
||||
top = "20%"
|
||||
containLabel = true
|
||||
|
||||
[toolbox]
|
||||
[toolbox.feature]
|
||||
[toolbox.feature.saveAsImage]
|
||||
title = "保存为图片"
|
||||
|
||||
[xAxis]
|
||||
type = "category"
|
||||
boundaryGap = false
|
||||
data = [
|
||||
"周一",
|
||||
"周二",
|
||||
"周三",
|
||||
"周四",
|
||||
"周五",
|
||||
"周六",
|
||||
"周日"
|
||||
]
|
||||
|
||||
[yAxis]
|
||||
type = "value"
|
||||
|
||||
[[series]]
|
||||
name = "邮件营销"
|
||||
type = "line"
|
||||
stack = "总量"
|
||||
data = [
|
||||
120.0,
|
||||
132.0,
|
||||
101.0,
|
||||
134.0,
|
||||
90.0,
|
||||
230.0,
|
||||
210.0
|
||||
]
|
||||
|
||||
[[series]]
|
||||
name = "联盟广告"
|
||||
type = "line"
|
||||
stack = "总量"
|
||||
data = [
|
||||
220.0,
|
||||
182.0,
|
||||
191.0,
|
||||
234.0,
|
||||
290.0,
|
||||
330.0,
|
||||
310.0
|
||||
]
|
||||
|
||||
[[series]]
|
||||
name = "视频广告"
|
||||
type = "line"
|
||||
stack = "总量"
|
||||
data = [
|
||||
150.0,
|
||||
232.0,
|
||||
201.0,
|
||||
154.0,
|
||||
190.0,
|
||||
330.0,
|
||||
410.0
|
||||
]
|
||||
|
||||
[[series]]
|
||||
name = "直接访问"
|
||||
type = "line"
|
||||
stack = "总量"
|
||||
data = [
|
||||
320.0,
|
||||
332.0,
|
||||
301.0,
|
||||
334.0,
|
||||
390.0,
|
||||
330.0,
|
||||
320.0
|
||||
]
|
||||
|
||||
[[series]]
|
||||
name = "搜索引擎"
|
||||
type = "line"
|
||||
stack = "总量"
|
||||
data = [
|
||||
820.0,
|
||||
932.0,
|
||||
901.0,
|
||||
934.0,
|
||||
1290.0,
|
||||
1330.0,
|
||||
1320.0
|
||||
]
|
||||
{{</* /echarts */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< echarts >}}
|
||||
{
|
||||
"title": {
|
||||
"text": "折线统计图",
|
||||
"top": "2%",
|
||||
"left": "center"
|
||||
},
|
||||
"tooltip": {
|
||||
"trigger": "axis"
|
||||
},
|
||||
"legend": {
|
||||
"data": ["邮件营销", "联盟广告", "视频广告", "直接访问", "搜索引擎"],
|
||||
"top": "10%"
|
||||
},
|
||||
"grid": {
|
||||
"left": "5%",
|
||||
"right": "5%",
|
||||
"bottom": "5%",
|
||||
"top": "20%",
|
||||
"containLabel": true
|
||||
},
|
||||
"toolbox": {
|
||||
"feature": {
|
||||
"saveAsImage": {
|
||||
"title": "保存为图片"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xAxis": {
|
||||
"type": "category",
|
||||
"boundaryGap": false,
|
||||
"data": ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]
|
||||
},
|
||||
"yAxis": {
|
||||
"type": "value"
|
||||
},
|
||||
"series": [
|
||||
{
|
||||
"name": "邮件营销",
|
||||
"type": "line",
|
||||
"stack": "总量",
|
||||
"data": [120, 132, 101, 134, 90, 230, 210]
|
||||
},
|
||||
{
|
||||
"name": "联盟广告",
|
||||
"type": "line",
|
||||
"stack": "总量",
|
||||
"data": [220, 182, 191, 234, 290, 330, 310]
|
||||
},
|
||||
{
|
||||
"name": "视频广告",
|
||||
"type": "line",
|
||||
"stack": "总量",
|
||||
"data": [150, 232, 201, 154, 190, 330, 410]
|
||||
},
|
||||
{
|
||||
"name": "直接访问",
|
||||
"type": "line",
|
||||
"stack": "总量",
|
||||
"data": [320, 332, 301, 334, 390, 330, 320]
|
||||
},
|
||||
{
|
||||
"name": "搜索引擎",
|
||||
"type": "line",
|
||||
"stack": "总量",
|
||||
"data": [820, 932, 901, 934, 1290, 1330, 1320]
|
||||
}
|
||||
]
|
||||
}
|
||||
{{< /echarts >}}
|
||||
|
||||
`echarts` shortcode 还有以下命名参数:
|
||||
|
||||
* **width** *[可选]* (**第一个**位置参数)
|
||||
|
||||
{{< version 0.2.0 >}} 数据可视化的宽度, 默认值是 `100%`.
|
||||
|
||||
* **height** *[可选]* (**第二个**位置参数)
|
||||
|
||||
{{< version 0.2.0 >}} 数据可视化的高度, 默认值是 `30rem`.
|
||||
|
Before Width: | Height: | Size: 264 KiB |
@@ -1,97 +0,0 @@
|
||||
---
|
||||
title: "Extended Shortcode - mapbox"
|
||||
date: 2022-07-20T12:22:15+08:00
|
||||
author: "Lruihao"
|
||||
authorLink: "https://lruihao.cn"
|
||||
description: "The mapbox shortcode supports interactive maps in Hugo with Mapbox GL JS library."
|
||||
resources:
|
||||
- name: "featured-image"
|
||||
src: "featured-image.jpg"
|
||||
|
||||
tags: ["shortcodes"]
|
||||
categories: ["documentation"]
|
||||
|
||||
hiddenFromHomePage: true
|
||||
---
|
||||
|
||||
{{< version 0.2.0 >}}
|
||||
|
||||
The `mapbox` shortcode supports interactive maps in Hugo with [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js) library.
|
||||
|
||||
<!--more-->
|
||||
|
||||
[Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js) is a JavaScript library that uses WebGL to render interactive maps from [vector tiles](https://docs.mapbox.com/help/glossary/vector-tiles/) and [Mapbox styles](https://docs.mapbox.com/mapbox-gl-js/style-spec/).
|
||||
|
||||
The `mapbox` shortcode has the following named parameters to use Mapbox GL JS:
|
||||
|
||||
* **lng** *[required]* (**first** positional parameter)
|
||||
|
||||
Longitude of the inital centerpoint of the map, measured in degrees.
|
||||
|
||||
* **lat** *[required]* (**second** positional parameter)
|
||||
|
||||
Latitude of the inital centerpoint of the map, measured in degrees.
|
||||
|
||||
* **zoom** *[optional]* (**third** positional parameter)
|
||||
|
||||
The initial zoom level of the map, default value is `10`.
|
||||
|
||||
* **marked** *[optional]* (**fourth** positional parameter)
|
||||
|
||||
Whether to add a marker at the inital centerpoint of the map, default value is `true`.
|
||||
|
||||
* **light-style** *[optional]* (**fifth** positional parameter)
|
||||
|
||||
Style for the light theme, default value is the value set in the [front matter](../theme-documentation-content#front-matter) or the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
|
||||
* **dark-style** *[optional]* (**sixth** positional parameter)
|
||||
|
||||
Style for the dark theme, default value is the value set in the [front matter](../theme-documentation-content#front-matter) or the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
|
||||
* **navigation** *[optional]*
|
||||
|
||||
Whether to add [NavigationControl](https://docs.mapbox.com/mapbox-gl-js/api#navigationcontrol), default value is the value set in the [front matter](../theme-documentation-content#front-matter) or the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
|
||||
* **geolocate** *[optional]*
|
||||
|
||||
Whether to add [GeolocateControl](https://docs.mapbox.com/mapbox-gl-js/api#geolocatecontrol), default value is the value set in the [front matter](../theme-documentation-content#front-matter) or the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
|
||||
* **scale** *[optional]*
|
||||
|
||||
Whether to add [ScaleControl](https://docs.mapbox.com/mapbox-gl-js/api#scalecontrol), default value is the value set in the [front matter](../theme-documentation-content#front-matter) or the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
|
||||
* **fullscreen** *[optional]*
|
||||
|
||||
Whether to add [FullscreenControl](https://docs.mapbox.com/mapbox-gl-js/api#fullscreencontrol), default value is the value set in the [front matter](../theme-documentation-content#front-matter) or the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
|
||||
* **width** *[optional]*
|
||||
|
||||
Width of the map, default value is `100%`.
|
||||
|
||||
* **height** *[optional]*
|
||||
|
||||
Height of the map, default value is `20rem`.
|
||||
|
||||
Example simple `mapbox` input:
|
||||
|
||||
```go-html-template
|
||||
{{</* mapbox 113.953277 22.559102 11 */>}}
|
||||
Or
|
||||
{{</* mapbox lng=113.953277 lat=22.559102 zoom=11 */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< mapbox 113.953277 22.559102 11 >}}
|
||||
|
||||
Example `mapbox` input with the custom style:
|
||||
|
||||
```go-html-template
|
||||
{{</* mapbox -122.252 37.453 10 false "mapbox://styles/mapbox/navigation-preview-day-v4" "mapbox://styles/mapbox/navigation-preview-night-v4" */>}}
|
||||
Or
|
||||
{{</* mapbox lng=-122.252 lat=37.453 zoom=10 marked=false light-style="mapbox://styles/mapbox/navigation-preview-day-v4" dark-style="mapbox://styles/mapbox/navigation-preview-night-v4" */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< mapbox -122.252 37.453 10 false "mapbox://styles/mapbox/navigation-preview-day-v4?optimize=true" "mapbox://styles/mapbox/navigation-preview-night-v4?optimize=true" >}}
|
||||
@@ -1,101 +0,0 @@
|
||||
---
|
||||
title: "扩展 Shortcode - mapbox"
|
||||
date: 2022-07-20T12:22:15+08:00
|
||||
author: "Lruihao"
|
||||
authorLink: "https://lruihao.cn"
|
||||
description: "mapbox shortcode 使用 Mapbox GL JS 库提供互动式地图的功能。"
|
||||
resources:
|
||||
- name: "featured-image"
|
||||
src: "featured-image.jpg"
|
||||
|
||||
tags: ["shortcodes"]
|
||||
categories: ["documentation"]
|
||||
|
||||
hiddenFromHomePage: true
|
||||
|
||||
mapbox:
|
||||
lightStyle: mapbox://styles/mapbox/light-zh-v1?optimize=true
|
||||
darkStyle: mapbox://styles/mapbox/dark-zh-v1?optimize=true
|
||||
---
|
||||
|
||||
{{< version 0.2.0 >}}
|
||||
|
||||
`mapbox` shortcode 使用 [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js) 库提供互动式地图的功能.
|
||||
|
||||
<!--more-->
|
||||
|
||||
[Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js) 是一个 JavaScript 库,它使用 WebGL, 以 [vector tiles](https://docs.mapbox.com/help/glossary/vector-tiles/) 和 [Mapbox styles](https://docs.mapbox.com/mapbox-gl-js/style-spec/) 为来源,将它们渲染成互动式地图。
|
||||
|
||||
`mapbox` shortcode 有以下命名参数来使用 Mapbox GL JS:
|
||||
|
||||
* **lng** *[必需]*(**第一个**位置参数)
|
||||
|
||||
地图初始中心点的经度,以度为单位。
|
||||
|
||||
* **lat** *[必需]*(**第二个**位置参数)
|
||||
|
||||
地图初始中心点的纬度,以度为单位。
|
||||
|
||||
* **zoom** *[可选]*(**第三个**位置参数)
|
||||
|
||||
地图的初始缩放级别,默认值是 `10`。
|
||||
|
||||
* **marked** *[可选]*(**第四个**位置参数)
|
||||
|
||||
是否在地图的初始中心点添加图钉,默认值是 `true`。
|
||||
|
||||
* **light-style** *[可选]*(**第五个**位置参数)
|
||||
|
||||
浅色主题的地图样式,默认值是 [前置参数](../theme-documentation-content#front-matter) 或者 [网站配置](../theme-documentation-basics#site-configuration) 中设置的值。
|
||||
|
||||
* **dark-style** *[可选]*(**第六个**位置参数)
|
||||
|
||||
深色主题的地图样式,默认值是 [前置参数](../theme-documentation-content#front-matter) 或者 [网站配置](../theme-documentation-basics#site-configuration) 中设置的值。
|
||||
|
||||
* **navigation** *[可选]*
|
||||
|
||||
是否添加 [NavigationControl](https://docs.mapbox.com/mapbox-gl-js/api#navigationcontrol), 默认值是 [前置参数](../theme-documentation-content#front-matter) 或者 [网站配置](../theme-documentation-basics#site-configuration) 中设置的值。
|
||||
|
||||
* **geolocate** *[可选]*
|
||||
|
||||
是否添加 [GeolocateControl](https://docs.mapbox.com/mapbox-gl-js/api#geolocatecontrol), 默认值是 [前置参数](../theme-documentation-content#front-matter) 或者 [网站配置](../theme-documentation-basics#site-configuration) 中设置的值。
|
||||
|
||||
* **scale** *[可选]*
|
||||
|
||||
是否添加 [ScaleControl](https://docs.mapbox.com/mapbox-gl-js/api#scalecontrol), 默认值是 [前置参数](../theme-documentation-content#front-matter) 或者 [网站配置](../theme-documentation-basics#site-configuration) 中设置的值。
|
||||
|
||||
* **fullscreen** *[可选]*
|
||||
|
||||
是否添加 [FullscreenControl](https://docs.mapbox.com/mapbox-gl-js/api#fullscreencontrol), 默认值是 [前置参数](../theme-documentation-content#front-matter) 或者 [网站配置](../theme-documentation-basics#site-configuration) 中设置的值。
|
||||
|
||||
* **width** *[可选]*
|
||||
|
||||
地图的宽度,默认值是 `100%`。
|
||||
|
||||
* **height** *[可选]*
|
||||
|
||||
地图的高度,默认值是 `20rem`。
|
||||
|
||||
一个简单的 `mapbox` 示例:
|
||||
|
||||
```go-html-template
|
||||
{{</* mapbox 113.953277 22.559102 11 */>}}
|
||||
或者
|
||||
{{</* mapbox lng=113.953277 lat=22.559102 zoom=11 */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< mapbox 113.953277 22.559102 11 >}}
|
||||
|
||||
一个带有自定义样式的 `mapbox` 示例:
|
||||
|
||||
```go-html-template
|
||||
{{</* mapbox -122.252 37.453 10 false "mapbox://styles/mapbox/streets-zh-v1" */>}}
|
||||
或者
|
||||
{{</* mapbox lng=-122.252 lat=37.453 zoom=10 marked=false light-style="mapbox://styles/mapbox/streets-zh-v1" */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< mapbox -122.252 37.453 10 false "mapbox://styles/mapbox/streets-zh-v1?optimize=true" >}}
|
||||
|
Before Width: | Height: | Size: 68 KiB |
@@ -1,361 +0,0 @@
|
||||
---
|
||||
title: "Extended Shortcode - mermaid"
|
||||
date: 2022-07-09T17:20:15+08:00
|
||||
author: "Lruihao"
|
||||
authorLink: "https://lruihao.cn"
|
||||
description: "The mermaid shortcode supports diagrams in Hugo with Mermaid library."
|
||||
resources:
|
||||
- name: "featured-image"
|
||||
src: "featured-image.png"
|
||||
|
||||
tags: ["shortcodes"]
|
||||
categories: ["documentation"]
|
||||
|
||||
hiddenFromHomePage: true
|
||||
---
|
||||
|
||||
{{< version 0.2.15 changed >}}
|
||||
|
||||
The `mermaid` shortcode supports diagrams in Hugo with [Mermaid](https://mermaidjs.github.io/) library.
|
||||
|
||||
<!--more-->
|
||||
|
||||
**Mermaid** is a library helping you to generate diagram and flowcharts from text, in a similar manner as Markdown.
|
||||
|
||||
Just insert your mermaid code in the `mermaid` shortcode and that’s it.
|
||||
|
||||
{{< admonition tip >}}
|
||||
You can configure mermaid themes globally in `config.toml` via the `params.mermaid` parameter
|
||||
{{< /admonition >}}
|
||||
|
||||
## Flowchart {#flowchart}
|
||||
|
||||
Example **flowchart** `mermaid` input:
|
||||
|
||||
```markdown
|
||||
{{</* mermaid */>}}
|
||||
graph LR;
|
||||
A[Hard edge] -->|Link text| B(Round edge)
|
||||
B --> C{Decision}
|
||||
C -->|One| D[Result one]
|
||||
C -->|Two| E[Result two]
|
||||
{{</* /mermaid */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< mermaid >}}
|
||||
graph LR;
|
||||
A[Hard edge] -->|Link text| B(Round edge)
|
||||
B --> C{Decision}
|
||||
C -->|One| D[Result one]
|
||||
C -->|Two| E[Result two]
|
||||
{{< /mermaid >}}
|
||||
|
||||
## Sequence Diagram {#sequence-diagram}
|
||||
|
||||
Example **sequence diagram** `mermaid` input:
|
||||
|
||||
```markdown
|
||||
{{</* mermaid */>}}
|
||||
sequenceDiagram
|
||||
participant Alice
|
||||
participant Bob
|
||||
Alice->>John: Hello John, how are you?
|
||||
loop Healthcheck
|
||||
John->John: Fight against hypochondria
|
||||
end
|
||||
Note right of John: Rational thoughts <br/>prevail...
|
||||
John-->Alice: Great!
|
||||
John->Bob: How about you?
|
||||
Bob-->John: Jolly good!
|
||||
{{</* /mermaid */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< mermaid >}}
|
||||
sequenceDiagram
|
||||
participant Alice
|
||||
participant Bob
|
||||
Alice->>John: Hello John, how are you?
|
||||
loop Healthcheck
|
||||
John->John: Fight against hypochondria
|
||||
end
|
||||
Note right of John: Rational thoughts <br/>prevail...
|
||||
John-->Alice: Great!
|
||||
John->Bob: How about you?
|
||||
Bob-->John: Jolly good!
|
||||
{{< /mermaid >}}
|
||||
|
||||
## Gantt {#gantt}
|
||||
|
||||
Example **Gantt** `mermaid` input:
|
||||
|
||||
```markdown
|
||||
{{</* mermaid */>}}
|
||||
gantt
|
||||
dateFormat YYYY-MM-DD
|
||||
title Adding GANTT diagram to mermaid
|
||||
excludes weekdays 2014-01-10
|
||||
|
||||
section A section
|
||||
Completed task :done, des1, 2014-01-06,2014-01-08
|
||||
Active task :active, des2, 2014-01-09, 3d
|
||||
Future task : des3, after des2, 5d
|
||||
Future task2 : des4, after des3, 5d
|
||||
{{</* /mermaid */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< mermaid >}}
|
||||
gantt
|
||||
dateFormat YYYY-MM-DD
|
||||
title Adding GANTT diagram to mermaid
|
||||
excludes weekdays 2014-01-10
|
||||
|
||||
section A section
|
||||
Completed task :done, des1, 2014-01-06,2014-01-08
|
||||
Active task :active, des2, 2014-01-09, 3d
|
||||
Future task : des3, after des2, 5d
|
||||
Future task2 : des4, after des3, 5d
|
||||
{{< /mermaid >}}
|
||||
|
||||
## Class Diagram {#class-diagram}
|
||||
|
||||
Example **class diagram** `mermaid` input:
|
||||
|
||||
```markdown
|
||||
{{</* mermaid */>}}
|
||||
classDiagram
|
||||
Animal <|-- Duck
|
||||
Animal <|-- Fish
|
||||
Animal <|-- Zebra
|
||||
Animal : +int age
|
||||
Animal : +String gender
|
||||
Animal: +isMammal()
|
||||
Animal: +mate()
|
||||
class Duck{
|
||||
+String beakColor
|
||||
+swim()
|
||||
+quack()
|
||||
}
|
||||
class Fish{
|
||||
-int sizeInFeet
|
||||
-canEat()
|
||||
}
|
||||
class Zebra{
|
||||
+bool is_wild
|
||||
+run()
|
||||
}
|
||||
{{</* /mermaid */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< mermaid >}}
|
||||
classDiagram
|
||||
Animal <|-- Duck
|
||||
Animal <|-- Fish
|
||||
Animal <|-- Zebra
|
||||
Animal : +int age
|
||||
Animal : +String gender
|
||||
Animal: +isMammal()
|
||||
Animal: +mate()
|
||||
class Duck{
|
||||
+String beakColor
|
||||
+swim()
|
||||
+quack()
|
||||
}
|
||||
class Fish{
|
||||
-int sizeInFeet
|
||||
-canEat()
|
||||
}
|
||||
class Zebra{
|
||||
+bool is_wild
|
||||
+run()
|
||||
}
|
||||
{{< /mermaid >}}
|
||||
|
||||
## State Diagram {#state-diagram}
|
||||
|
||||
Example **state diagram** `mermaid` input:
|
||||
|
||||
```markdown
|
||||
{{</* mermaid */>}}
|
||||
stateDiagram-v2
|
||||
[*] --> Still
|
||||
Still --> [*]
|
||||
Still --> Moving
|
||||
Moving --> Still
|
||||
Moving --> Crash
|
||||
Crash --> [*]
|
||||
{{</* /mermaid */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< mermaid >}}
|
||||
stateDiagram-v2
|
||||
[*] --> Still
|
||||
Still --> [*]
|
||||
Still --> Moving
|
||||
Moving --> Still
|
||||
Moving --> Crash
|
||||
Crash --> [*]
|
||||
{{< /mermaid >}}
|
||||
|
||||
## Git Graph {#git-graph}
|
||||
|
||||
Example **git graph** `mermaid` input:
|
||||
|
||||
```markdown
|
||||
{{</* mermaid */>}}
|
||||
gitGraph
|
||||
commit
|
||||
commit
|
||||
branch develop
|
||||
checkout develop
|
||||
commit
|
||||
commit
|
||||
checkout main
|
||||
merge develop
|
||||
commit
|
||||
commit
|
||||
{{</* /mermaid */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< mermaid >}}
|
||||
gitGraph
|
||||
commit
|
||||
commit
|
||||
branch develop
|
||||
checkout develop
|
||||
commit
|
||||
commit
|
||||
checkout main
|
||||
merge develop
|
||||
commit
|
||||
commit
|
||||
{{< /mermaid >}}
|
||||
|
||||
## Entity Relationship Diagram {#entity-relationship-diagram}
|
||||
|
||||
Example **entity-relationship diagram** `mermaid` input:
|
||||
|
||||
```markdown
|
||||
{{</* mermaid */>}}
|
||||
erDiagram
|
||||
CUSTOMER ||--o{ ORDER : places
|
||||
ORDER ||--|{ LINE-ITEM : contains
|
||||
CUSTOMER }|..|{ DELIVERY-ADDRESS : uses
|
||||
{{</* /mermaid */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< mermaid >}}
|
||||
erDiagram
|
||||
CUSTOMER ||--o{ ORDER : places
|
||||
ORDER ||--|{ LINE-ITEM : contains
|
||||
CUSTOMER }|..|{ DELIVERY-ADDRESS : uses
|
||||
{{< /mermaid >}}
|
||||
|
||||
## User Journey {#user-journey}
|
||||
|
||||
Example **user journey** `mermaid` input:
|
||||
|
||||
```markdown
|
||||
{{</* mermaid */>}}
|
||||
journey
|
||||
title My working day
|
||||
section Go to work
|
||||
Make tea: 5: Me
|
||||
Go upstairs: 3: Me
|
||||
Do work: 1: Me, Cat
|
||||
section Go home
|
||||
Go downstairs: 5: Me
|
||||
Sit down: 5: Me
|
||||
{{</* /mermaid */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< mermaid >}}
|
||||
journey
|
||||
title My working day
|
||||
section Go to work
|
||||
Make tea: 5: Me
|
||||
Go upstairs: 3: Me
|
||||
Do work: 1: Me, Cat
|
||||
section Go home
|
||||
Go downstairs: 5: Me
|
||||
Sit down: 5: Me
|
||||
{{< /mermaid >}}
|
||||
|
||||
## Pie Chart {#pie-chart}
|
||||
|
||||
Example **pie chart** `mermaid` input:
|
||||
|
||||
```markdown
|
||||
{{</* mermaid */>}}
|
||||
pie
|
||||
"Dogs" : 386
|
||||
"Cats" : 85
|
||||
"Rats" : 15
|
||||
{{</* /mermaid */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< mermaid >}}
|
||||
pie
|
||||
"Dogs" : 386
|
||||
"Cats" : 85
|
||||
"Rats" : 15
|
||||
{{< /mermaid >}}
|
||||
|
||||
## Requirement Diagram {#requirement-diagram}
|
||||
|
||||
Example **requirement diagram** `mermaid` input:
|
||||
|
||||
```markdown
|
||||
{{</* mermaid */>}}
|
||||
requirementDiagram
|
||||
|
||||
requirement test_req {
|
||||
id: 1
|
||||
text: the test text.
|
||||
risk: high
|
||||
verifymethod: test
|
||||
}
|
||||
|
||||
element test_entity {
|
||||
type: simulation
|
||||
}
|
||||
|
||||
test_entity - satisfies -> test_req
|
||||
{{</* /mermaid */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< mermaid >}}
|
||||
requirementDiagram
|
||||
|
||||
requirement test_req {
|
||||
id: 1
|
||||
text: the test text.
|
||||
risk: high
|
||||
verifymethod: test
|
||||
}
|
||||
|
||||
element test_entity {
|
||||
type: simulation
|
||||
}
|
||||
|
||||
test_entity - satisfies -> test_req
|
||||
{{< /mermaid >}}
|
||||
@@ -1,361 +0,0 @@
|
||||
---
|
||||
title: "扩展 Shortcode - mermaid"
|
||||
date: 2022-07-09T17:20:15+08:00
|
||||
author: "Lruihao"
|
||||
authorLink: "https://lruihao.cn"
|
||||
description: "mermaid shortcode 使用 Mermaid 库提供绘制图表和流程图的功能。"
|
||||
resources:
|
||||
- name: "featured-image"
|
||||
src: "featured-image.png"
|
||||
|
||||
tags: ["shortcodes"]
|
||||
categories: ["documentation"]
|
||||
|
||||
hiddenFromHomePage: true
|
||||
---
|
||||
|
||||
{{< version 0.2.15 changed >}}
|
||||
|
||||
`mermaid` shortcode 使用 [Mermaid](https://mermaidjs.github.io/) 库提供绘制图表和流程图的功能.
|
||||
|
||||
<!--more-->
|
||||
|
||||
[mermaid](https://mermaidjs.github.io/) 是一个可以帮助你在文章中绘制图表和流程图的库, 类似 Markdown 的语法.
|
||||
|
||||
只需将你的 mermaid 代码插入 `mermaid` shortcode 中即可.
|
||||
|
||||
{{< admonition tip >}}
|
||||
你可以在 `config.toml` 中通过 `params.mermaid` 参数全局配置 mermaid 的主题
|
||||
{{< /admonition >}}
|
||||
|
||||
## 流程图 {#flowchart}
|
||||
|
||||
一个 **流程图** `mermaid` 示例:
|
||||
|
||||
```markdown
|
||||
{{</* mermaid */>}}
|
||||
graph LR;
|
||||
A[Hard edge] -->|Link text| B(Round edge)
|
||||
B --> C{Decision}
|
||||
C -->|One| D[Result one]
|
||||
C -->|Two| E[Result two]
|
||||
{{</* /mermaid */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< mermaid >}}
|
||||
graph LR;
|
||||
A[Hard edge] -->|Link text| B(Round edge)
|
||||
B --> C{Decision}
|
||||
C -->|One| D[Result one]
|
||||
C -->|Two| E[Result two]
|
||||
{{< /mermaid >}}
|
||||
|
||||
## 时序图 {#sequence-diagram}
|
||||
|
||||
一个 **时序图** `mermaid` 示例:
|
||||
|
||||
```markdown
|
||||
{{</* mermaid */>}}
|
||||
sequenceDiagram
|
||||
participant Alice
|
||||
participant Bob
|
||||
Alice->>John: Hello John, how are you?
|
||||
loop Healthcheck
|
||||
John->John: Fight against hypochondria
|
||||
end
|
||||
Note right of John: Rational thoughts <br/>prevail...
|
||||
John-->Alice: Great!
|
||||
John->Bob: How about you?
|
||||
Bob-->John: Jolly good!
|
||||
{{</* /mermaid */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< mermaid >}}
|
||||
sequenceDiagram
|
||||
participant Alice
|
||||
participant Bob
|
||||
Alice->>John: Hello John, how are you?
|
||||
loop Healthcheck
|
||||
John->John: Fight against hypochondria
|
||||
end
|
||||
Note right of John: Rational thoughts <br/>prevail...
|
||||
John-->Alice: Great!
|
||||
John->Bob: How about you?
|
||||
Bob-->John: Jolly good!
|
||||
{{< /mermaid >}}
|
||||
|
||||
## 甘特图 {#gantt}
|
||||
|
||||
一个 **甘特图** `mermaid` 示例:
|
||||
|
||||
```markdown
|
||||
{{</* mermaid */>}}
|
||||
gantt
|
||||
dateFormat YYYY-MM-DD
|
||||
title Adding GANTT diagram to mermaid
|
||||
excludes weekdays 2014-01-10
|
||||
|
||||
section A section
|
||||
Completed task :done, des1, 2014-01-06,2014-01-08
|
||||
Active task :active, des2, 2014-01-09, 3d
|
||||
Future task : des3, after des2, 5d
|
||||
Future task2 : des4, after des3, 5d
|
||||
{{</* /mermaid */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< mermaid >}}
|
||||
gantt
|
||||
dateFormat YYYY-MM-DD
|
||||
title Adding GANTT diagram to mermaid
|
||||
excludes weekdays 2014-01-10
|
||||
|
||||
section A section
|
||||
Completed task :done, des1, 2014-01-06,2014-01-08
|
||||
Active task :active, des2, 2014-01-09, 3d
|
||||
Future task : des3, after des2, 5d
|
||||
Future task2 : des4, after des3, 5d
|
||||
{{< /mermaid >}}
|
||||
|
||||
## 类图 {#class-diagram}
|
||||
|
||||
一个 **类图** `mermaid` 示例:
|
||||
|
||||
```markdown
|
||||
{{</* mermaid */>}}
|
||||
classDiagram
|
||||
Animal <|-- Duck
|
||||
Animal <|-- Fish
|
||||
Animal <|-- Zebra
|
||||
Animal : +int age
|
||||
Animal : +String gender
|
||||
Animal: +isMammal()
|
||||
Animal: +mate()
|
||||
class Duck{
|
||||
+String beakColor
|
||||
+swim()
|
||||
+quack()
|
||||
}
|
||||
class Fish{
|
||||
-int sizeInFeet
|
||||
-canEat()
|
||||
}
|
||||
class Zebra{
|
||||
+bool is_wild
|
||||
+run()
|
||||
}
|
||||
{{</* /mermaid */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< mermaid >}}
|
||||
classDiagram
|
||||
Animal <|-- Duck
|
||||
Animal <|-- Fish
|
||||
Animal <|-- Zebra
|
||||
Animal : +int age
|
||||
Animal : +String gender
|
||||
Animal: +isMammal()
|
||||
Animal: +mate()
|
||||
class Duck{
|
||||
+String beakColor
|
||||
+swim()
|
||||
+quack()
|
||||
}
|
||||
class Fish{
|
||||
-int sizeInFeet
|
||||
-canEat()
|
||||
}
|
||||
class Zebra{
|
||||
+bool is_wild
|
||||
+run()
|
||||
}
|
||||
{{< /mermaid >}}
|
||||
|
||||
## 状态图 {#state-diagram}
|
||||
|
||||
一个 **状态图** `mermaid` 示例:
|
||||
|
||||
```markdown
|
||||
{{</* mermaid */>}}
|
||||
stateDiagram-v2
|
||||
[*] --> Still
|
||||
Still --> [*]
|
||||
Still --> Moving
|
||||
Moving --> Still
|
||||
Moving --> Crash
|
||||
Crash --> [*]
|
||||
{{</* /mermaid */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< mermaid >}}
|
||||
stateDiagram-v2
|
||||
[*] --> Still
|
||||
Still --> [*]
|
||||
Still --> Moving
|
||||
Moving --> Still
|
||||
Moving --> Crash
|
||||
Crash --> [*]
|
||||
{{< /mermaid >}}
|
||||
|
||||
## Git 图 {#git-graph}
|
||||
|
||||
一个 **Git 图** `mermaid` 示例:
|
||||
|
||||
```markdown
|
||||
{{</* mermaid */>}}
|
||||
gitGraph
|
||||
commit
|
||||
commit
|
||||
branch develop
|
||||
checkout develop
|
||||
commit
|
||||
commit
|
||||
checkout main
|
||||
merge develop
|
||||
commit
|
||||
commit
|
||||
{{</* /mermaid */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< mermaid >}}
|
||||
gitGraph
|
||||
commit
|
||||
commit
|
||||
branch develop
|
||||
checkout develop
|
||||
commit
|
||||
commit
|
||||
checkout main
|
||||
merge develop
|
||||
commit
|
||||
commit
|
||||
{{< /mermaid >}}
|
||||
|
||||
## 实体关系图 {#entity-relationship-diagram}
|
||||
|
||||
一个 **实体关系图** `mermaid` 示例:
|
||||
|
||||
```markdown
|
||||
{{</* mermaid */>}}
|
||||
erDiagram
|
||||
CUSTOMER ||--o{ ORDER : places
|
||||
ORDER ||--|{ LINE-ITEM : contains
|
||||
CUSTOMER }|..|{ DELIVERY-ADDRESS : uses
|
||||
{{</* /mermaid */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< mermaid >}}
|
||||
erDiagram
|
||||
CUSTOMER ||--o{ ORDER : places
|
||||
ORDER ||--|{ LINE-ITEM : contains
|
||||
CUSTOMER }|..|{ DELIVERY-ADDRESS : uses
|
||||
{{< /mermaid >}}
|
||||
|
||||
## 用户体验旅程图 {#user-journey}
|
||||
|
||||
一个 **用户体验旅程图** `mermaid` 示例:
|
||||
|
||||
```markdown
|
||||
{{</* mermaid */>}}
|
||||
journey
|
||||
title My working day
|
||||
section Go to work
|
||||
Make tea: 5: Me
|
||||
Go upstairs: 3: Me
|
||||
Do work: 1: Me, Cat
|
||||
section Go home
|
||||
Go downstairs: 5: Me
|
||||
Sit down: 5: Me
|
||||
{{</* /mermaid */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< mermaid >}}
|
||||
journey
|
||||
title My working day
|
||||
section Go to work
|
||||
Make tea: 5: Me
|
||||
Go upstairs: 3: Me
|
||||
Do work: 1: Me, Cat
|
||||
section Go home
|
||||
Go downstairs: 5: Me
|
||||
Sit down: 5: Me
|
||||
{{< /mermaid >}}
|
||||
|
||||
## 饼图 {#pie}
|
||||
|
||||
一个 **饼图** `mermaid` 示例:
|
||||
|
||||
```markdown
|
||||
{{</* mermaid */>}}
|
||||
pie
|
||||
"Dogs" : 386
|
||||
"Cats" : 85
|
||||
"Rats" : 15
|
||||
{{</* /mermaid */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< mermaid >}}
|
||||
pie
|
||||
"Dogs" : 386
|
||||
"Cats" : 85
|
||||
"Rats" : 15
|
||||
{{< /mermaid >}}
|
||||
|
||||
## 依赖图 {#requirement-diagram}
|
||||
|
||||
一个 **依赖图** `mermaid` 示例:
|
||||
|
||||
```markdown
|
||||
{{</* mermaid */>}}
|
||||
requirementDiagram
|
||||
|
||||
requirement test_req {
|
||||
id: 1
|
||||
text: the test text.
|
||||
risk: high
|
||||
verifymethod: test
|
||||
}
|
||||
|
||||
element test_entity {
|
||||
type: simulation
|
||||
}
|
||||
|
||||
test_entity - satisfies -> test_req
|
||||
{{</* /mermaid */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< mermaid >}}
|
||||
requirementDiagram
|
||||
|
||||
requirement test_req {
|
||||
id: 1
|
||||
text: the test text.
|
||||
risk: high
|
||||
verifymethod: test
|
||||
}
|
||||
|
||||
element test_entity {
|
||||
type: simulation
|
||||
}
|
||||
|
||||
test_entity - satisfies -> test_req
|
||||
{{< /mermaid >}}
|
||||
|
Before Width: | Height: | Size: 23 KiB |
@@ -1,156 +0,0 @@
|
||||
---
|
||||
title: "Extended Shortcode - music"
|
||||
date: 2022-07-20T13:01:03+08:00
|
||||
author: "Lruihao"
|
||||
authorLink: "https://lruihao.cn"
|
||||
description: "The music shortcode embeds a responsive music player based on APlayer and MetingJS library."
|
||||
resources:
|
||||
- name: "featured-image"
|
||||
src: "featured-image.jpg"
|
||||
|
||||
tags: ["shortcodes"]
|
||||
categories: ["documentation"]
|
||||
|
||||
hiddenFromHomePage: true
|
||||
---
|
||||
|
||||
The `music` shortcode embeds a responsive music player based on [APlayer](https://github.com/MoePlayer/APlayer) and [MetingJS](https://github.com/metowolf/MetingJS).
|
||||
|
||||
<!--more-->
|
||||
|
||||
There are three ways to use it the `music` shortcode.
|
||||
|
||||
## 1 Custom Music URL {#custom-music-url}
|
||||
|
||||
{{< version 0.2.10 >}} The complete usage of [local resource references](../theme-documentation-content#contents-organization) is supported.
|
||||
|
||||
The `music` shortcode has the following named parameters by custom music URL:
|
||||
|
||||
* **server** *[required]*
|
||||
|
||||
URL of the custom music.
|
||||
|
||||
* **name** *[optional]*
|
||||
|
||||
Name of the custom music.
|
||||
|
||||
* **artist** *[optional]*
|
||||
|
||||
Artist of the custom music.
|
||||
|
||||
* **cover** *[required]*
|
||||
|
||||
URL of the custom music cover.
|
||||
|
||||
Example `music` input by custom music URL:
|
||||
|
||||
```go-html-template
|
||||
{{</* music url="/music/Wavelength.mp3" name=Wavelength artist=oldmanyoung cover="/images/Wavelength.jpg" */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< music url="/music/Wavelength.mp3" name=Wavelength artist=oldmanyoung cover="/images/Wavelength.jpg" >}}
|
||||
|
||||
## 2 Music Platform URL Automatic Identification {#automatic-identification}
|
||||
|
||||
The `music` shortcode has one named parameter by music platform URL automatic identification:
|
||||
|
||||
* **auto** *[required]* (**first** positional parameter)
|
||||
|
||||
URL of the music platform URL for automatic identification,
|
||||
which supports `netease`, `tencent` and `xiami` music platform.
|
||||
|
||||
Example `music` input by music platform URL automatic identification:
|
||||
|
||||
```go-html-template
|
||||
{{</* music auto="https://music.163.com/#/playlist?id=60198" */>}}
|
||||
Or
|
||||
{{</* music "https://music.163.com/#/playlist?id=60198" */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< music auto="https://music.163.com/#/playlist?id=60198" >}}
|
||||
|
||||
## 3 Custom Server, Type and ID {#custom-server}
|
||||
|
||||
The `music` shortcode has the following named parameters by custom music platform:
|
||||
|
||||
* **server** *[required]* (**first** positional parameter)
|
||||
|
||||
[`netease`, `tencent`, `kugou`, `xiami`, `baidu`]
|
||||
|
||||
Music platform.
|
||||
|
||||
* **type** *[required]* (**second** positional parameter)
|
||||
|
||||
[`song`, `playlist`, `album`, `search`, `artist`]
|
||||
|
||||
Type of the music.
|
||||
|
||||
* **id** *[required]* (**third** positional parameter)
|
||||
|
||||
Song ID, or playlist ID, or album ID, or search keyword, or artist ID.
|
||||
|
||||
Example `music` input by custom music platform:
|
||||
|
||||
```go-html-template
|
||||
{{</* music server="netease" type="song" id="1868553" */>}}
|
||||
Or
|
||||
{{</* music netease song 1868553 */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< music netease song 1868553 >}}
|
||||
|
||||
## 4 Other Parameters {#other-parameters}
|
||||
|
||||
The `music` shortcode has other named parameters applying to the above three ways:
|
||||
|
||||
* **theme** *[optional]*
|
||||
|
||||
{{< version 0.2.0 changed >}} Main color of the music player, default value is `#448aff`.
|
||||
|
||||
* **fixed** *[optional]*
|
||||
|
||||
Whether to enable fixed mode, default value is `false`.
|
||||
|
||||
* **mini** *[optional]*
|
||||
|
||||
Whether to enable mini mode, default value is `false`.
|
||||
|
||||
* **autoplay** *[optional]*
|
||||
|
||||
Whether to autoplay music, default value is `false`.
|
||||
|
||||
* **volume** *[optional]*
|
||||
|
||||
Default volume when the player is first opened, which will be remembered in the browser, default value is `0.7`.
|
||||
|
||||
* **mutex** *[optional]*
|
||||
|
||||
Whether to pause other players when this player starts playing, default value is `true`.
|
||||
|
||||
The `music` shortcode has the following named parameters only applying to the type of music list:
|
||||
|
||||
* **loop** *[optional]*
|
||||
|
||||
[`all`, `one`, `none`]
|
||||
|
||||
Loop mode of the music list, default value is `none`.
|
||||
|
||||
* **order** *[optional]*
|
||||
|
||||
[`list`, `random`]
|
||||
|
||||
Play order of the music list, default value is `list`.
|
||||
|
||||
* **list-folded** *[optional]*
|
||||
|
||||
Whether the music list should be folded at first, default value is `false`.
|
||||
|
||||
* **list-max-height** *[optional]*
|
||||
|
||||
Max height of the music list, default value is `340px`.
|
||||
@@ -1,155 +0,0 @@
|
||||
---
|
||||
title: "扩展 Shortcode - music"
|
||||
date: 2022-07-20T13:01:03+08:00
|
||||
author: "Lruihao"
|
||||
authorLink: "https://lruihao.cn"
|
||||
description: "music shortcode 基于 APlayer 和 MetingJS 库提供了一个内嵌的响应式音乐播放器。"
|
||||
resources:
|
||||
- name: "featured-image"
|
||||
src: "featured-image.jpg"
|
||||
|
||||
tags: ["shortcodes"]
|
||||
categories: ["documentation"]
|
||||
|
||||
hiddenFromHomePage: true
|
||||
---
|
||||
|
||||
`music` shortcode 基于 [APlayer](https://github.com/MoePlayer/APlayer) 和 [MetingJS](https://github.com/metowolf/MetingJS) 提供了一个内嵌的响应式音乐播放器。
|
||||
|
||||
<!--more-->
|
||||
|
||||
有三种方式使用 `music` shortcode。
|
||||
|
||||
## 1 自定义音乐 URL {#custom-music-url}
|
||||
|
||||
{{< version 0.2.10 >}} 支持 [本地资源引用](../theme-documentation-content#contents-organization) 的完整用法。
|
||||
|
||||
`music` shortcode 有以下命名参数来使用自定义音乐 URL:
|
||||
|
||||
* **server** *[必需]*
|
||||
|
||||
音乐的链接。
|
||||
|
||||
* **type** *[可选]*
|
||||
|
||||
音乐的名称。
|
||||
|
||||
* **artist** *[可选]*
|
||||
|
||||
音乐的创作者。
|
||||
|
||||
* **cover** *[可选]*
|
||||
|
||||
音乐的封面链接。
|
||||
|
||||
一个使用自定义音乐 URL 的 `music` 示例:
|
||||
|
||||
```go-html-template
|
||||
{{</* music url="/music/Wavelength.mp3" name=Wavelength artist=oldmanyoung cover="/images/Wavelength.jpg" */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< music url="/music/Wavelength.mp3" name=Wavelength artist=oldmanyoung cover="/images/Wavelength.jpg" >}}
|
||||
|
||||
## 2 音乐平台 URL 的自动识别 {#automatic-identification}
|
||||
|
||||
`music` shortcode 有一个命名参数来使用音乐平台 URL 的自动识别:
|
||||
|
||||
* **auto** *[必需]]*(**第一个**位置参数)
|
||||
|
||||
用来自动识别的音乐平台 URL, 支持 `netease`, `tencent` 和 `xiami` 平台。
|
||||
|
||||
一个使用音乐平台 URL 的自动识别的 `music` 示例:
|
||||
|
||||
```go-html-template
|
||||
{{</* music auto="https://music.163.com/#/playlist?id=60198" */>}}
|
||||
或者
|
||||
{{</* music "https://music.163.com/#/playlist?id=60198" */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< music auto="https://music.163.com/#/playlist?id=60198" >}}
|
||||
|
||||
## 3 自定义音乐平台,类型和 ID {#custom-server}
|
||||
|
||||
`music` shortcode 有以下命名参数来使用自定义音乐平台:
|
||||
|
||||
* **server** *[必需]*(**第一个**位置参数)
|
||||
|
||||
[`netease`, `tencent`, `kugou`, `xiami`, `baidu`]
|
||||
|
||||
音乐平台。
|
||||
|
||||
* **type** *[必需]*(**第二个**位置参数)
|
||||
|
||||
[`song`, `playlist`, `album`, `search`, `artist`]
|
||||
|
||||
音乐类型。
|
||||
|
||||
* **id** *[必需]*(**第三个**位置参数)
|
||||
|
||||
歌曲 ID, 或者播放列表 ID, 或者专辑 ID, 或者搜索关键词,或者创作者 ID.
|
||||
|
||||
一个使用自定义音乐平台的 `music` 示例:
|
||||
|
||||
```go-html-template
|
||||
{{</* music server="netease" type="song" id="1868553" */>}}
|
||||
或者
|
||||
{{</* music netease song 1868553 */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< music netease song 1868553 >}}
|
||||
|
||||
## 4 其它参数 {#other-parameters}
|
||||
|
||||
`music` shortcode 有一些可以应用于以上三种方式的其它命名参数:
|
||||
|
||||
* **theme** *[可选]*
|
||||
|
||||
{{< version 0.2.0 changed >}} 音乐播放器的主题色,默认值是 `#448aff`。
|
||||
|
||||
* **fixed** *[可选]*
|
||||
|
||||
是否开启固定模式,默认值是 `false`。
|
||||
|
||||
* **mini** *[可选]*
|
||||
|
||||
是否开启迷你模式,默认值是 `false`。
|
||||
|
||||
* **autoplay** *[可选]*
|
||||
|
||||
是否自动播放音乐,默认值是 `false`。
|
||||
|
||||
* **volume** *[可选]*
|
||||
|
||||
第一次打开播放器时的默认音量,会被保存在浏览器缓存中,默认值是 `0.7`。
|
||||
|
||||
* **mutex** *[可选]*
|
||||
|
||||
是否自动暂停其它播放器,默认值是 `true`。
|
||||
|
||||
`music` shortcode 还有一些只适用于音乐列表方式的其它命名参数:
|
||||
|
||||
* **loop** *[可选]*
|
||||
|
||||
[`all`, `one`, `none`]
|
||||
|
||||
音乐列表的循环模式,默认值是 `none`。
|
||||
|
||||
* **order** *[可选]*
|
||||
|
||||
[`list`, `random`]
|
||||
|
||||
音乐列表的播放顺序,默认值是 `list`。
|
||||
|
||||
* **list-folded** *[可选]*
|
||||
|
||||
初次打开的时候音乐列表是否折叠,默认值是 `false`。
|
||||
|
||||
* **list-max-height** *[可选]*
|
||||
|
||||
音乐列表的最大高度,默认值是 `340px`。
|
||||
|
Before Width: | Height: | Size: 80 KiB |
@@ -1,110 +0,0 @@
|
||||
---
|
||||
title: "Extended Shortcode - typeit"
|
||||
date: 2022-07-20T13:56:03+08:00
|
||||
author: "Lruihao"
|
||||
authorLink: "https://lruihao.cn"
|
||||
description: "The typeit shortcode provides typing animation based on TypeIt library."
|
||||
resources:
|
||||
- name: "featured-image"
|
||||
src: "featured-image.jpg"
|
||||
|
||||
tags: ["shortcodes"]
|
||||
categories: ["documentation"]
|
||||
|
||||
hiddenFromHomePage: true
|
||||
---
|
||||
|
||||
The `typeit` shortcode provides typing animation based on [TypeIt](https://typeitjs.com/) library.
|
||||
|
||||
<!--more-->
|
||||
|
||||
Just insert your content in the `typeit` shortcode and that’s it.
|
||||
|
||||
## 1 Simple Content {#simple-content}
|
||||
|
||||
Simple content is allowed in `Markdown` format and **without** rich block content such as images and more...
|
||||
|
||||
Example `typeit` input:
|
||||
|
||||
```go-html-template
|
||||
{{</* typeit */>}}
|
||||
This is a *paragraph* with **typing animation** based on [TypeIt](https://typeitjs.com/)...
|
||||
{{</* /typeit */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< typeit >}}
|
||||
This is a *paragraph* with **typing animation** based on [TypeIt](https://typeitjs.com/)...
|
||||
{{< /typeit >}}
|
||||
|
||||
Alternatively, you can use custom **HTML tags**.
|
||||
|
||||
Example `typeit` input with `h4` tag:
|
||||
|
||||
```go-html-template
|
||||
{{</* typeit tag=h4 */>}}
|
||||
This is a *paragraph* with **typing animation** based on [TypeIt](https://typeitjs.com/)...
|
||||
{{</* /typeit */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< typeit tag=h4 >}}
|
||||
This is a *paragraph* with **typing animation** based on [TypeIt](https://typeitjs.com/)...
|
||||
{{< /typeit >}}
|
||||
|
||||
## 2 Code Content {#code-content}
|
||||
|
||||
Code content is allowed and will be highlighted by named parameter `code` for the type of code language.
|
||||
|
||||
Example `typeit` input with `code`:
|
||||
|
||||
```go-html-template
|
||||
{{</* typeit code=java */>}}
|
||||
public class HelloWorld {
|
||||
public static void main(String []args) {
|
||||
System.out.println("Hello World");
|
||||
}
|
||||
}
|
||||
{{</* /typeit */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< typeit code=java >}}
|
||||
public class HelloWorld {
|
||||
public static void main(String []args) {
|
||||
System.out.println("Hello World");
|
||||
}
|
||||
}
|
||||
{{< /typeit >}}
|
||||
|
||||
## 3 Group Content {#group-content}
|
||||
|
||||
All typing animations start at the same time by default.
|
||||
But sometimes you may want to start a set of `typeit` contents in order.
|
||||
|
||||
A set of `typeit` contents with the same value of named parameter `group` will start typing animation in sequence.
|
||||
|
||||
Example `typeit` input with `group`:
|
||||
|
||||
```go-html-template
|
||||
{{</* typeit group=paragraph */>}}
|
||||
**First** this paragraph begins
|
||||
{{</* /typeit */>}}
|
||||
|
||||
{{</* typeit group=paragraph */>}}
|
||||
**Then** this paragraph begins
|
||||
{{</* /typeit */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< typeit group=paragraph >}}
|
||||
**First** this paragraph begins
|
||||
{{< /typeit >}}
|
||||
|
||||
{{< typeit group=paragraph >}}
|
||||
**Then** this paragraph begins
|
||||
{{< /typeit >}}
|
||||
@@ -1,110 +0,0 @@
|
||||
---
|
||||
title: "扩展 Shortcode - typeit"
|
||||
date: 2022-07-20T13:56:03+08:00
|
||||
author: "Lruihao"
|
||||
authorLink: "https://lruihao.cn"
|
||||
description: "typeit shortcode 基于 TypeIt 提供了打字动画。"
|
||||
resources:
|
||||
- name: "featured-image"
|
||||
src: "featured-image.jpg"
|
||||
|
||||
tags: ["shortcodes"]
|
||||
categories: ["documentation"]
|
||||
|
||||
hiddenFromHomePage: true
|
||||
---
|
||||
|
||||
`typeit` shortcode 基于 [TypeIt](https://typeitjs.com/) 提供了打字动画。
|
||||
|
||||
<!--more-->
|
||||
|
||||
只需将你需要打字动画的内容插入 `typeit` shortcode 中即可。
|
||||
|
||||
## 1 简单内容 {#simple-content}
|
||||
|
||||
允许使用 `Markdown` 格式的简单内容,并且 **不包含** 富文本的块内容,例如图像等等 ...
|
||||
|
||||
一个 `typeit` 示例:
|
||||
|
||||
```go-html-template
|
||||
{{</* typeit */>}}
|
||||
这一个带有基于 [TypeIt](https://typeitjs.com/) 的 **打字动画** 的 *段落* ...
|
||||
{{</* /typeit */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< typeit >}}
|
||||
这一个带有基于 [TypeIt](https://typeitjs.com/) 的 **打字动画** 的 *段落* ...
|
||||
{{< /typeit >}}
|
||||
|
||||
另外,你也可以自定义 **HTML 标签**.
|
||||
|
||||
一个带有 `h4` 标签的 `typeit` 示例:
|
||||
|
||||
```go-html-template
|
||||
{{</* typeit tag=h4 */>}}
|
||||
这一个带有基于 [TypeIt](https://typeitjs.com/) 的 **打字动画** 的 *段落* ...
|
||||
{{</* /typeit */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< typeit tag=h4 >}}
|
||||
这一个带有基于 [TypeIt](https://typeitjs.com/) 的 **打字动画** 的 *段落* ...
|
||||
{{< /typeit >}}
|
||||
|
||||
## 2 代码内容 {#code-content}
|
||||
|
||||
代码内容也是允许的,并且通过使用参数 `code` 指定语言类型可以实习语法高亮。
|
||||
|
||||
一个带有 `code` 参数的 `typeit` 示例:
|
||||
|
||||
```go-html-template
|
||||
{{</* typeit code=java */>}}
|
||||
public class HelloWorld {
|
||||
public static void main(String []args) {
|
||||
System.out.println("Hello World");
|
||||
}
|
||||
}
|
||||
{{</* /typeit */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< typeit code=java >}}
|
||||
public class HelloWorld {
|
||||
public static void main(String []args) {
|
||||
System.out.println("Hello World");
|
||||
}
|
||||
}
|
||||
{{< /typeit >}}
|
||||
|
||||
## 3 分组内容 {#code-content}
|
||||
|
||||
默认情况下,所有打字动画都是同时开始的。
|
||||
但是有时你可能需要按顺序开始一组 `typeit` 内容的打字动画。
|
||||
|
||||
一组具有相同 `group` 参数值的 `typeit` 内容将按顺序开始打字动画。
|
||||
|
||||
一个带有 `group` 参数的 `typeit` 示例:
|
||||
|
||||
```go-html-template
|
||||
{{</* typeit group=paragraph */>}}
|
||||
**首先**, 这个段落开始
|
||||
{{</* /typeit */>}}
|
||||
|
||||
{{</* typeit group=paragraph */>}}
|
||||
**然后**, 这个段落开始
|
||||
{{</* /typeit */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< typeit group=paragraph >}}
|
||||
**首先**, 这个段落开始
|
||||
{{< /typeit >}}
|
||||
|
||||
{{< typeit group=paragraph >}}
|
||||
**然后**, 这个段落开始
|
||||
{{< /typeit >}}
|
||||
|
Before Width: | Height: | Size: 22 KiB |
@@ -1,152 +0,0 @@
|
||||
---
|
||||
weight: 5
|
||||
title: "Theme Documentation - PWA Support"
|
||||
date: 2022-01-26T09:32:56+08:00
|
||||
draft: false
|
||||
description: "Guide to setup PWA in FixIt."
|
||||
|
||||
tags: ["PWA"]
|
||||
categories: ["Documentation"]
|
||||
|
||||
resources:
|
||||
- name: featured-image
|
||||
src: featured-image.png
|
||||
|
||||
toc:
|
||||
auto: false
|
||||
|
||||
menu:
|
||||
main:
|
||||
name: "PWA Support"
|
||||
title: "Guide to setup PWA in FixIt."
|
||||
parent: "documentation"
|
||||
pre: "<i class='fa-brands fa-readme fa-fw fa-sm'></i>"
|
||||
|
||||
repost:
|
||||
enable: true
|
||||
url: "https://hugodoit.com/pwa-support/"
|
||||
---
|
||||
|
||||
Find out how to turn your FixIt site into a Progressive Web App.
|
||||
|
||||
<!--more-->
|
||||
|
||||
## What are PWAs?
|
||||
|
||||
[**Progressive Web Apps** (PWAs) ](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps)are web apps that use [service workers](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API), [manifests](https://developer.mozilla.org/en-US/docs/Web/Manifest), and other web-platform features in combination with [progressive enhancement](https://developer.mozilla.org/en-US/docs/Glossary/Progressive_Enhancement) to give users an experience on par with native apps.
|
||||
|
||||
## Why bother?
|
||||
|
||||
Well, the straight answer to this questions is: "You don't need to turn your site into a PWA." A normal website is good enough for all the content you want to share. However, a PWA brings some extra benefits that might be useful.
|
||||
|
||||
1. Pages will be automatically cached by service workers when the app is installed, which enables a near-instantaneous loading from the second visit.
|
||||
2. Users can always visit cached pages when they are offline.
|
||||
|
||||
These features may be useful for some websites, such as this documentation site. But it does not make much sense to turn a personal blog into a PWA. In the end, it all depends on your choice, and the FixIt theme will provide this feature for you anyway.
|
||||
|
||||
## How to turn your FixIt site into a PWA? {#setup-in-fixit}
|
||||
|
||||
### Configure `site.webmanifest` {#site.webmanifest}
|
||||
|
||||
Under the `/static/` folder, you need to create a file named `site.webmanifest`. This file provides information about your app and it is required for your app to be installable.
|
||||
|
||||
Here are the key values required.
|
||||
|
||||
* **name** *[required]*
|
||||
|
||||
The name of your web app.
|
||||
|
||||
* **short_name** *[required]*
|
||||
|
||||
A shorter name for your web app.
|
||||
|
||||
* **start_url** *[required]*
|
||||
|
||||
The start URL of your web app. Please fill in `"/"` by default.
|
||||
|
||||
* **icons** *[required]*
|
||||
|
||||
An array of objects representing image files will be served as application icons. You can reuse the favicon of your site as the icons.
|
||||
|
||||
There are other optional values you can set in the manifest file, check out this [documentation](https://developer.mozilla.org/en-US/docs/Web/Manifest) for more information.
|
||||
|
||||
Here is a sample `site.webmanifest` file from this documentation site.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "FixIt Theme Documentation",
|
||||
"short_name": "FixIt Docs",
|
||||
"start_url": "/",
|
||||
"description": "A Clean, Elegant but Advanced Hugo Theme",
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff",
|
||||
"display": "standalone",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/apple-touch-icon.png",
|
||||
"sizes": "180x180",
|
||||
"type": "image/png",
|
||||
"purpose": "any maskable"
|
||||
},
|
||||
{
|
||||
"src": "/android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/android-chrome-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Configure the offline page {#offline-page}
|
||||
|
||||
The offline page will be served to your visitor when they are offline.
|
||||
|
||||
You just need to create an `offline.md` or `offline/index.md` in the `/content/` directory, and you can create them quickly with the following commands in your site directory:
|
||||
|
||||
```bash
|
||||
hugo new offline.md
|
||||
hugo new offline/index.md
|
||||
# [i18n] if you are running a multilingual website.
|
||||
hugo new offline/index.en.md
|
||||
hugo new offline/index.zh-cn.md
|
||||
hugo new offline/index.zh-tw.md
|
||||
```
|
||||
|
||||
{{< admonition type=tip title="Permalink" open=true >}}
|
||||
You need to make sure the [Permalink](https://gohugo.io/content-management/urls/#permalinks) to the offline page is `/offline/`, otherwise, you will need to modify the value of `OFFLINE_CACHE_FILES` and `OFFLINE_PAGE` in the service worker yourself.
|
||||
|
||||
Currently, i18n is supported for the offline page, but only for English and Chinese. Of course, you can [Contribute with a new language](https://github.com/Lruihao/FixIt/pulls) to the theme!
|
||||
{{< /admonition >}}
|
||||
|
||||
Here is a sample offline page.
|
||||
|
||||
```md
|
||||
---
|
||||
type: "offline"
|
||||
---
|
||||
```
|
||||
|
||||
### Enable the `enablePWA` option {#enable-pwa}
|
||||
|
||||
Go to `config.toml`, add or change the option `enablePWA = true` under `[params]`.
|
||||
|
||||
```toml
|
||||
[params]
|
||||
# ...
|
||||
enablePWA = true
|
||||
```
|
||||
|
||||
## Install your PWA
|
||||
|
||||
Now, an install button should show up when you visit your website and you will be able to install your site as an app. After clicking "Install", your website should be installed as a native app.
|
||||
|
||||

|
||||
|
||||
Congratulation! You have successfully turned your static site into a PWA 🎉
|
||||
|
||||
If you have any issues during the setup process, you can check the `Console` and `Application` panels in your browser's DevTools for debugging. Alternatively, you can check your site on [PWA Builder](https://www.pwabuilder.com/) for more information. You can also start a [discussion](https://github.com/Lruihao/FixIt/discussions) if you have any questions or propose an [issue](https://github.com/Lruihao/FixIt/issues) for any bugs you find.
|
||||
@@ -1,151 +0,0 @@
|
||||
---
|
||||
weight: 5
|
||||
title: "主题文档 - PWA 支持"
|
||||
date: 2022-01-26T11:10:56+08:00
|
||||
draft: false
|
||||
description: "在 FixIt 中设置 PWA 的指南。"
|
||||
|
||||
tags: ["PWA"]
|
||||
categories: ["Documentation"]
|
||||
|
||||
resources:
|
||||
- name: featured-image
|
||||
src: featured-image.png
|
||||
|
||||
toc:
|
||||
auto: false
|
||||
|
||||
menu:
|
||||
main:
|
||||
title: "在 FixIt 中设置 PWA 的指南。"
|
||||
parent: "documentation"
|
||||
pre: "<i class='fa-brands fa-readme fa-fw fa-sm'></i>"
|
||||
|
||||
repost:
|
||||
enable: true
|
||||
url: "https://hugodoit.com/zh-cn/pwa-support/"
|
||||
---
|
||||
|
||||
了解如何在 FixIt 主题中配置渐进式网络应用程序 (PWA)。
|
||||
|
||||
<!--more-->
|
||||
|
||||
## 什么是 PWA?
|
||||
|
||||
[**PWA**(Progressive Web Apps,渐进式 Web 应用)](https://developer.mozilla.org/zh-CN/docs/Web/Progressive_web_apps) 运用现代的 Web API 以及传统的渐进式增强策略来创建跨平台 Web 应用程序。这些应用无处不在、功能丰富,使其具有与原生应用相同的用户体验优势。
|
||||
|
||||
## 为什么要配置 PWA?
|
||||
|
||||
你并不需要将你的站点配置为一个 PWA. 传统的网站足以满足你想要分享的所有内容。但是,PWA 带来了一些可能有用的额外好处。
|
||||
|
||||
1. 在用户安装 PWA 后,页面将由 service worker 自动缓存,这使得从第二次访问开始页面将被快速加载。
|
||||
2. 用户始终可以在离线时访问缓存的页面。
|
||||
|
||||
这些功能可能对某些网站(例如此文档站点)很有用,但是将个人博客配置为 PWA 就没有多少意义。当然一切都取决于你的选择,无论如何 FixIt 主题都将为你提供开启此功能的选项。
|
||||
|
||||
## 如何将使用 FixIt 主题的静态网站配置为 PWA? {#setup-in-fixit}
|
||||
|
||||
### 配置 `site.webmanifest` {#site.webmanifest}
|
||||
|
||||
你需要在 `/static/` 文件夹下创建名为 `site.webmanifest` 的文件,并在此文件提供有关你的 PWA 的信息。
|
||||
|
||||
以下是必填参数。
|
||||
|
||||
* **name** *[必须]*
|
||||
|
||||
你的 PWA 的名称。
|
||||
|
||||
* **short_name** *[必须]*
|
||||
|
||||
你的 PWA 的简称。
|
||||
|
||||
* **start_url** *[必须]*
|
||||
|
||||
你的 PWA 的起始地址。请默认填写`"/"`.
|
||||
|
||||
* **icons** *[必须]*
|
||||
|
||||
你的 PWA 的图标。你可以将网站的 favicon 作为图标。
|
||||
|
||||
您还可以在 `site.webmanifest` 中设置其他可选值,查看这篇 [文档](https://developer.mozilla.org/zh-CN/docs/Web/Manifest) 来了解更多。
|
||||
|
||||
这是一份示例 `site.webmanifest` 文件:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "FixIt Theme Documentation",
|
||||
"short_name": "FixIt Docs",
|
||||
"start_url": "/",
|
||||
"description": "A Clean, Elegant but Advanced Hugo Theme",
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff",
|
||||
"display": "standalone",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/apple-touch-icon.png",
|
||||
"sizes": "180x180",
|
||||
"type": "image/png",
|
||||
"purpose": "any maskable"
|
||||
},
|
||||
{
|
||||
"src": "/android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/android-chrome-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### 配置离线页面 {#offline-page}
|
||||
|
||||
离线页面将在访客离线访问未缓存的页面时显示。
|
||||
|
||||
你只需要在 `/content/` 目录创建 `offline.md` 或者 `offline/index.md`, 你可以通过以下命令快速完成创建:
|
||||
|
||||
```bash
|
||||
hugo new offline.md
|
||||
hugo new offline/index.md
|
||||
# [i18n] if you are running a multilingual website.
|
||||
hugo new offline/index.en.md
|
||||
hugo new offline/index.zh-cn.md
|
||||
hugo new offline/index.zh-tw.md
|
||||
```
|
||||
|
||||
{{< admonition type=tip title="Permalink" open=true >}}
|
||||
你需要确保离线页面的 [Permalink](https://gohugo.io/content-management/urls/#permalinks) 是 `/offline/`, 否则你需要手动更改 service worker 中 `OFFLINE_CACHE_FILES` 和 `OFFLINE_PAGE` 的值。
|
||||
|
||||
目前,离线页面支持 i18n 多语言,但只支持英文和中文。当然,你可以给主题 [贡献一种新的语言](https://github.com/Lruihao/FixIt/pulls)!
|
||||
{{< /admonition >}}
|
||||
|
||||
这是一个示例离线页面:
|
||||
|
||||
```md
|
||||
---
|
||||
type: "offline"
|
||||
---
|
||||
```
|
||||
|
||||
### 开启 `enablePWA` 选项 {#enable-pwa}
|
||||
|
||||
前往 `config.toml`, 添加/修改 `[params]` 配置项下 `enablePWA` 选项的值为 `true`。
|
||||
|
||||
```toml
|
||||
[params]
|
||||
# ...
|
||||
enablePWA = true
|
||||
```
|
||||
|
||||
## 安装并使用你的 PWA
|
||||
|
||||
如果一切顺利,现在当你访问你的网站时,浏览器将显示一个安装按钮,单击“安装”后,你的网站将被安装为一个本地的原生应用程序。
|
||||
|
||||

|
||||
|
||||
大功告成!你已成功将你的静态网站配置为了一个 PWA 🎉
|
||||
|
||||
如果你在配置过程中有任何问题,你可以通过浏览器调试工具中的 `Console` 与 `Application` 面板来进行调试。你也可以用 [PWA Builder](https://www.pwabuilder.com/) 来检查你的网站以获得更多信息。你可以创建一个 [discussion](https://github.com/Lruihao/FixIt/discussions) 来获得社区帮助或者提交 [issue](https://github.com/Lruihao/FixIt/issues) 来报告你遇到的任何 bug。
|
||||
|
Before Width: | Height: | Size: 223 KiB |
|
Before Width: | Height: | Size: 94 KiB |
|
Before Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 114 KiB |
|
Before Width: | Height: | Size: 115 KiB |
|
Before Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 280 KiB |
|
Before Width: | Height: | Size: 6.4 KiB |
@@ -1,186 +0,0 @@
|
||||
---
|
||||
weight: 3
|
||||
title: "Theme Documentation - Built-in Shortcodes"
|
||||
date: 2021-12-19T16:15:22+08:00
|
||||
draft: false
|
||||
author: "Lruihao"
|
||||
authorLink: "https://lruihao.cn"
|
||||
description: "Hugo provides multiple built-in shortcodes for author convenience and to keep your markdown content clean."
|
||||
resources:
|
||||
- name: "featured-image"
|
||||
src: "featured-image.png"
|
||||
|
||||
tags: ["shortcodes"]
|
||||
categories: ["documentation"]
|
||||
|
||||
lightgallery: true
|
||||
|
||||
menu:
|
||||
main:
|
||||
name: "Built-in Shortcodes"
|
||||
title: "Hugo provides multiple built-in shortcodes for author convenience and to keep your markdown content clean."
|
||||
parent: "documentation"
|
||||
pre: "<i class='fa-brands fa-readme fa-fw fa-sm'></i>"
|
||||
---
|
||||
|
||||
**Hugo** provides multiple built-in shortcodes for author convenience and to keep your markdown content clean.
|
||||
|
||||
<!--more-->
|
||||
|
||||
Hugo uses Markdown for its simple content format. However, there are a lot of things that Markdown doesn’t support well. You could use pure HTML to expand possibilities.
|
||||
|
||||
But this happens to be a bad idea. Everyone uses Markdown because it’s pure and simple to read even non-rendered. You should avoid HTML to keep it as simple as possible.
|
||||
|
||||
To avoid this limitations, Hugo created [shortcodes](https://gohugo.io/extras/shortcodes/).
|
||||
A shortcode is a simple snippet that can generate reasonable HTML code and conforms to Markdown's design philosophy.
|
||||
|
||||
Hugo ships with a set of predefined shortcodes that represent very common usage. These shortcodes are provided for author convenience and to keep your markdown content clean.
|
||||
|
||||
|
||||
{{< admonition tip "Use Shortcodes" >}}
|
||||
|
||||
1. Shortcodes with raw string parameters \` \`
|
||||
2. Shortcodes with Markdown `% %`
|
||||
3. Shortcodes without Markdown `< >`
|
||||
|
||||
See detail [shortcodes/#use-shortcodes](https://gohugo.io/content-management/shortcodes/#use-shortcodes)
|
||||
|
||||
{{< /admonition >}}
|
||||
|
||||
|
||||
## 1 figure {#figure}
|
||||
|
||||
[Documentation of `figure`](https://gohugo.io/content-management/shortcodes#figure)
|
||||
|
||||
Example `figure` input:
|
||||
|
||||
```markdown
|
||||
{{</* figure src="/images/lighthouse.jpg" title="Lighthouse (figure)" */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< figure src="/images/lighthouse.jpg" title="Lighthouse (figure)" >}}
|
||||
|
||||
The HTML looks like this:
|
||||
|
||||
```html
|
||||
<figure>
|
||||
<img src="/images/lighthouse.jpg"/>
|
||||
<figcaption>
|
||||
<h4>Lighthouse (figure)</h4>
|
||||
</figcaption>
|
||||
</figure>
|
||||
```
|
||||
|
||||
## 2 gist
|
||||
|
||||
[Documentation of `gist`](https://gohugo.io/content-management/shortcodes#gist)
|
||||
|
||||
Example `gist` input:
|
||||
|
||||
```markdown
|
||||
{{</* gist spf13 7896402 */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< gist spf13 7896402 >}}
|
||||
|
||||
The HTML looks like this:
|
||||
|
||||
```html
|
||||
<script type="application/javascript" src="https://gist.github.com/spf13/7896402.js"></script>
|
||||
```
|
||||
|
||||
## 3 highlight
|
||||
|
||||
[Documentation of `highlight`](https://gohugo.io/content-management/shortcodes#highlight)
|
||||
|
||||
Example `highlight` input:
|
||||
|
||||
```markdown
|
||||
{{</* highlight html */>}}
|
||||
<section id="main">
|
||||
<div>
|
||||
<h1 id="title">{{ .Title }}</h1>
|
||||
{{ range .Pages }}
|
||||
{{ .Render "summary"}}
|
||||
{{ end }}
|
||||
</div>
|
||||
</section>
|
||||
{{</* /highlight */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< highlight html >}}
|
||||
<section id="main">
|
||||
<div>
|
||||
<h1 id="title">{{ .Title }}</h1>
|
||||
{{ range .Pages }}
|
||||
{{ .Render "summary"}}
|
||||
{{ end }}
|
||||
</div>
|
||||
</section>
|
||||
{{< /highlight >}}
|
||||
|
||||
## 4 param
|
||||
|
||||
[Documentation of `param`](https://gohugo.io/content-management/shortcodes#param)
|
||||
|
||||
Example `param` input:
|
||||
|
||||
```markdown
|
||||
{{</* param description */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< param description >}}
|
||||
|
||||
## 5 ref and relref {#ref-and-relref}
|
||||
|
||||
[Documentation of `ref` and `relref`](https://gohugo.io/content-management/shortcodes#ref-and-relref)
|
||||
|
||||
## 6 tweet
|
||||
|
||||
[Documentation of `tweet`](https://gohugo.io/content-management/shortcodes#tweet)
|
||||
|
||||
Example `tweet` input:
|
||||
|
||||
```markdown
|
||||
{{</* tweet user="SanDiegoZoo" id="1453110110599868418" */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< tweet user="SanDiegoZoo" id="1453110110599868418" >}}
|
||||
|
||||
## 7 vimeo
|
||||
|
||||
[Documentation of `vimeo`](https://gohugo.io/content-management/shortcodes#vimeo)
|
||||
|
||||
Example `vimeo` input:
|
||||
|
||||
```markdown
|
||||
{{</* vimeo 146022717 */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< vimeo 146022717 >}}
|
||||
|
||||
## 8 youtube
|
||||
|
||||
[Documentation of `youtube`](https://gohugo.io/content-management/shortcodes#youtube)
|
||||
|
||||
Example `youtube` input:
|
||||
|
||||
```markdown
|
||||
{{</* youtube w7Ft2ymGmfc */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< youtube w7Ft2ymGmfc >}}
|
||||
@@ -1,184 +0,0 @@
|
||||
---
|
||||
weight: 3
|
||||
title: "主题文档 - 内置 Shortcodes"
|
||||
date: 2021-12-19T16:15:22+08:00
|
||||
draft: false
|
||||
author: "Lruihao"
|
||||
authorLink: "https://lruihao.cn"
|
||||
description: "Hugo 提供了多个内置的 Shortcodes, 以方便作者保持 Markdown 内容的整洁。"
|
||||
resources:
|
||||
- name: "featured-image"
|
||||
src: "featured-image.png"
|
||||
|
||||
tags: ["shortcodes"]
|
||||
categories: ["documentation"]
|
||||
|
||||
lightgallery: true
|
||||
|
||||
menu:
|
||||
main:
|
||||
title: "Hugo 提供了多个内置的 Shortcodes, 以方便作者保持 Markdown 内容的整洁。"
|
||||
parent: "documentation"
|
||||
pre: "<i class='fa-brands fa-readme fa-fw fa-sm'></i>"
|
||||
---
|
||||
|
||||
**Hugo** 提供了多个内置的 Shortcodes, 以方便作者保持 Markdown 内容的整洁。
|
||||
|
||||
<!--more-->
|
||||
|
||||
Hugo 使用 Markdown 为其简单的内容格式。但是,Markdown 在很多方面都无法很好地支持。你可以使用纯 HTML 来扩展可能性。
|
||||
|
||||
但这恰好是一个坏主意。大家使用 Markdown, 正是因为它即使不经过渲染也可以轻松阅读。应该尽可能避免使用 HTML 以保持内容简洁。
|
||||
|
||||
为了避免这种限制,Hugo 创建了 [shortcodes](https://gohugo.io/extras/shortcodes/).
|
||||
shortcode 是一个简单代码段,可以生成合理的 HTML 代码,并且符合 Markdown 的设计哲学。
|
||||
|
||||
Hugo 附带了一组预定义的 shortcodes, 它们实现了一些非常常见的用法。
|
||||
提供这些 shortcodes 是为了方便保持你的 Markdown 内容简洁。
|
||||
|
||||
{{< admonition tip "使用 Shortcodes" >}}
|
||||
|
||||
1. 带有原始字体串格式的 Shortcodes \` \`
|
||||
2. 带有 Markdown 的 Shortcodes `% %`
|
||||
3. 不带有 Markdown 的 Shortcodes `< >`
|
||||
|
||||
详见 [shortcodes/#use-shortcodes](https://gohugo.io/content-management/shortcodes/#use-shortcodes)
|
||||
|
||||
{{< /admonition >}}
|
||||
|
||||
## 1 figure {#figure}
|
||||
|
||||
[`figure` 的文档](https://gohugo.io/content-management/shortcodes#figure)
|
||||
|
||||
一个 `figure` 示例:
|
||||
|
||||
```markdown
|
||||
{{</* figure src="/images/lighthouse.jpg" title="Lighthouse (figure)" */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< figure src="/images/lighthouse.jpg" title="Lighthouse (figure)" >}}
|
||||
|
||||
输出的 HTML 看起来像这样:
|
||||
|
||||
```html
|
||||
<figure>
|
||||
<img src="/images/lighthouse.jpg"/>
|
||||
<figcaption>
|
||||
<h4>Lighthouse (figure)</h4>
|
||||
</figcaption>
|
||||
</figure>
|
||||
```
|
||||
|
||||
## 2 gist
|
||||
|
||||
[`gist` 的文档](https://gohugo.io/content-management/shortcodes#gist)
|
||||
|
||||
一个 `gist` 示例:
|
||||
|
||||
```markdown
|
||||
{{</* gist spf13 7896402 */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< gist spf13 7896402 >}}
|
||||
|
||||
输出的 HTML 看起来像这样:
|
||||
|
||||
```html
|
||||
<script type="application/javascript" src="https://gist.github.com/spf13/7896402.js"></script>
|
||||
```
|
||||
|
||||
## 3 highlight
|
||||
|
||||
[`highlight` 的文档](https://gohugo.io/content-management/shortcodes#highlight)
|
||||
|
||||
一个 `highlight` 示例:
|
||||
|
||||
```markdown
|
||||
{{</* highlight html */>}}
|
||||
<section id="main">
|
||||
<div>
|
||||
<h1 id="title">{{ .Title }}</h1>
|
||||
{{ range .Pages }}
|
||||
{{ .Render "summary"}}
|
||||
{{ end }}
|
||||
</div>
|
||||
</section>
|
||||
{{</* /highlight */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< highlight html >}}
|
||||
<section id="main">
|
||||
<div>
|
||||
<h1 id="title">{{ .Title }}</h1>
|
||||
{{ range .Pages }}
|
||||
{{ .Render "summary"}}
|
||||
{{ end }}
|
||||
</div>
|
||||
</section>
|
||||
{{< /highlight >}}
|
||||
|
||||
## 4 param
|
||||
|
||||
[`param` 的文档](https://gohugo.io/content-management/shortcodes#param)
|
||||
|
||||
一个 `param` 示例:
|
||||
|
||||
```markdown
|
||||
{{</* param description */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< param description >}}
|
||||
|
||||
## 5 ref 和 relref {#ref-and-relref}
|
||||
|
||||
[`ref` 和 `relref` 的文档](https://gohugo.io/content-management/shortcodes#ref-and-relref)
|
||||
|
||||
## 6 tweet
|
||||
|
||||
[`tweet` 的文档](https://gohugo.io/content-management/shortcodes#tweet)
|
||||
|
||||
一个 `tweet` 示例:
|
||||
|
||||
```markdown
|
||||
{{</* tweet user="SanDiegoZoo" id="1453110110599868418" */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< tweet user="SanDiegoZoo" id="1453110110599868418" >}}
|
||||
|
||||
## 7 vimeo
|
||||
|
||||
[`vimeo` 的文档](https://gohugo.io/content-management/shortcodes#vimeo)
|
||||
|
||||
一个 `vimeo` 示例:
|
||||
|
||||
```markdown
|
||||
{{</* vimeo 146022717 */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< vimeo 146022717 >}}
|
||||
|
||||
## 8 youtube
|
||||
|
||||
[`youtube` 的文档](https://gohugo.io/content-management/shortcodes#youtube)
|
||||
|
||||
一个 `youtube` 示例:
|
||||
|
||||
```markdown
|
||||
{{</* youtube w7Ft2ymGmfc */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< youtube w7Ft2ymGmfc >}}
|
||||
|
Before Width: | Height: | Size: 21 KiB |
@@ -1,214 +0,0 @@
|
||||
---
|
||||
title: "Theme Documentation - Content Encryption"
|
||||
date: 2022-05-28T11:51:41+08:00
|
||||
author: "Lruihao"
|
||||
authorLink: "https://lruihao.cn"
|
||||
description: "Find out how to encrypt content in FixIt theme."
|
||||
password: 1212
|
||||
message: "Password is 1212"
|
||||
|
||||
resources:
|
||||
- name: "featured-image"
|
||||
src: "featured-image.png"
|
||||
|
||||
tags:
|
||||
- Encryption
|
||||
categories:
|
||||
- documentation
|
||||
|
||||
menu:
|
||||
main:
|
||||
name: "Content Encryption"
|
||||
title: "Find out how to encrypt content in FixIt theme."
|
||||
parent: "documentation"
|
||||
pre: "<i class='fa-solid fa-lock fa-fw fa-sm'></i>"
|
||||
---
|
||||
|
||||
Find out how to encrypt content in FixIt theme.
|
||||
|
||||
<!--more-->
|
||||
|
||||
## Page Encryption
|
||||
|
||||
### Frontmatter
|
||||
|
||||
The FixIt theme provides two frontmatters for page encryption.
|
||||
|
||||
* **password**: *[required]* password of encrypted page content
|
||||
* **message**: *[optional]* encryption prompt
|
||||
|
||||
For example, the frontmatters in this article are as follows:
|
||||
|
||||
```yaml
|
||||
---
|
||||
title: "Theme Documentation - Content Encryption"
|
||||
date: 2022-05-28T11:51:41+08:00
|
||||
author: "Lruihao"
|
||||
authorLink: "https://lruihao.cn"
|
||||
description: "Find out how to encrypt content in FixIt theme."
|
||||
password: 1212
|
||||
message: "Password is 1212"
|
||||
|
||||
resources:
|
||||
- name: "featured-image"
|
||||
src: "featured-image.png"
|
||||
|
||||
tags:
|
||||
- Encryption
|
||||
categories:
|
||||
- documentation
|
||||
---
|
||||
```
|
||||
|
||||
|
||||
{{< admonition info >}}
|
||||
|
||||
1. After entering the correct password each time, the password hash value will be cached locally by the user, and the pages will be unlocked automatically when accessed again within one day
|
||||
2. A "Encrypt again" button is provided at the end of the article. Click it to immediately forget the password and re encrypt the content
|
||||
3. Encrypted pages have been hidden from search
|
||||
4. The markdown output of encrypted pages has been disabled. To prevent password disclosure, **do not make encrypted pages public in any form**
|
||||
|
||||
{{< /admonition >}}
|
||||
|
||||
### Advanced use
|
||||
|
||||
FixIt Dcryptor has two lifecycle hooks, see [Class FixItDecryptor API](#fixit-decryptor-api)
|
||||
|
||||
For example, after unlocking the article, output the text:
|
||||
|
||||
```go-html-template
|
||||
{{</* script */>}}
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
fixit.theme.decryptor.addEventListener('decrypted', function() {
|
||||
console.log('after password decryption')
|
||||
})
|
||||
if (window.localStorage.getItem(`fixit-decryptor/#${location.pathname}`)) {
|
||||
console.log('after automatic decryption')
|
||||
}
|
||||
});
|
||||
{{</* /script */>}}
|
||||
```
|
||||
|
||||
You can see the output in the console of the developer tool.
|
||||
|
||||
{{< script >}}
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
fixit.decryptor.addEventListener('decrypted', function() {
|
||||
console.log('after password decryption')
|
||||
})
|
||||
if (window.localStorage.getItem(`fixit-decryptor/#${location.pathname}`)) {
|
||||
console.log('after automatic decryption')
|
||||
}
|
||||
});
|
||||
{{< /script >}}
|
||||
|
||||
## Partial Encryption {#partial-encryption}
|
||||
|
||||
{{< version 0.2.15 >}}
|
||||
|
||||
You can use `fixit-encryptor` shortcode to encrypt partial content.
|
||||
|
||||
The `fixit-encryptor` shortcode has the following named parameters:
|
||||
|
||||
* **password** *[required]* (**first** positional parameter)
|
||||
|
||||
Password of the partial encrypted content.
|
||||
|
||||
* **message** *[optional]* (**second** positional parameter)
|
||||
|
||||
Placeholder of the decryptor input.
|
||||
|
||||
Example `fixit-encryptor` input:
|
||||
|
||||
```go-html-template
|
||||
{{%/* fixit-encryptor "1212" "Password is 1212" */%}}
|
||||
The `fixit-encryptor` shortcode was supported in version {{</* version 0.2.15 */>}}.
|
||||
{{%/* /fixit-encryptor */%}}
|
||||
Or
|
||||
{{%/* fixit-encryptor password="1212" message="Password is 1212" */%}}
|
||||
The `fixit-encryptor` shortcode was supported in version {{</* version 0.2.15 */>}}.
|
||||
{{%/* /fixit-encryptor */%}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{% fixit-encryptor "1212" "Password is 1212" %}}
|
||||
The `fixit-encryptor` shortcode was supported in version {{< version 0.2.15 >}}.
|
||||
{{% /fixit-encryptor %}}
|
||||
|
||||
## Summary
|
||||
|
||||
Compared with encrypting content through script batch processing such as golang/python/javascript, FixIt theme built-in encryption has the following advantages and disadvantages:
|
||||
|
||||
* **Advantages**: High usability, out of the box, without further batch processing
|
||||
* **Disadvantages**: Low security, the encryption algorithm is limited by the `go-html-template` syntax
|
||||
|
||||
> "The simplest password is enough to prevent 90% of people!"
|
||||
>
|
||||
> There is no trivial matter about privacy. Please do not upload important and private contents, and keep them properly!
|
||||
|
||||
## Class FixItDecryptor API {#fixit-decryptor-api}
|
||||
|
||||
FixIt decryptor for encrypted pages
|
||||
|
||||
### new FixItDecryptor(options)
|
||||
|
||||
#### Parameters:
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------- | ------ | ------------------------------------------------------------ |
|
||||
| options | Object | The options of FixItDecryptor([Properties](#properties)) |
|
||||
|
||||
##### Properties:
|
||||
|
||||
| Name | Type | Attributes | Default | Description |
|
||||
| --------- | -------- | ---------- | ------- | --------------------------------------------------------- |
|
||||
| decrypted | Function | \<optional\> | | [Lifecycle Hooks] handler after decrypting |
|
||||
| reset | Function | \<optional\> | | [Lifecycle Hooks] handler after encrypting again |
|
||||
| duration | Number | \<optional\> | 86400 | number of seconds to cache decryption statistics. unit: s |
|
||||
|
||||
### Methods
|
||||
|
||||
#### init()
|
||||
|
||||
initialize FixIt decryptor
|
||||
|
||||
#### initShortcodes()
|
||||
|
||||
initialize fixit-encryptor shortcodes
|
||||
|
||||
#### validateCache()
|
||||
|
||||
validate the cached decryption statistics in localStorage
|
||||
|
||||
#### addEventListener(event, listener)
|
||||
|
||||
add event listener for FixIt Decryptor
|
||||
|
||||
##### Parameters:
|
||||
|
||||
| Name | Type | Description |
|
||||
| -------- | -------- | ------------- |
|
||||
| event | String | event name |
|
||||
| listener | Function | event handler |
|
||||
|
||||
#### removeEventListener(event, listener)
|
||||
|
||||
remove event listener for FixIt Decryptor
|
||||
|
||||
##### Parameters:
|
||||
|
||||
| Name | Type | Description |
|
||||
| -------- | -------- | ------------- |
|
||||
| event | String | event name |
|
||||
| listener | Function | event handler |
|
||||
|
||||
### Events
|
||||
|
||||
#### decrypted
|
||||
|
||||
after decrypting
|
||||
|
||||
#### reset
|
||||
|
||||
after encrypting again
|
||||
@@ -1,145 +0,0 @@
|
||||
---
|
||||
title: "主题文档 - 内容加密"
|
||||
date: 2022-05-28T11:51:41+08:00
|
||||
author: "Lruihao"
|
||||
authorLink: "https://lruihao.cn"
|
||||
description: "了解如何在 FixIt 主题中加密内容。"
|
||||
password: 1212
|
||||
message: "密码是 1212"
|
||||
|
||||
resources:
|
||||
- name: "featured-image"
|
||||
src: "featured-image.png"
|
||||
|
||||
tags:
|
||||
- Encryption
|
||||
categories:
|
||||
- documentation
|
||||
|
||||
menu:
|
||||
main:
|
||||
name: "主题文档 - 内容加密"
|
||||
title: "了解如何在 FixIt 主题中加密内容。"
|
||||
parent: "documentation"
|
||||
pre: "<i class='fa-solid fa-lock fa-fw fa-sm'></i>"
|
||||
---
|
||||
|
||||
了解如何在 FixIt 主题中加密内容。
|
||||
|
||||
<!--more-->
|
||||
|
||||
## 全文加密
|
||||
|
||||
### 前置参数
|
||||
|
||||
FixIt 主题提供了两个前置参数用于全文加密。
|
||||
|
||||
* **password**: *[必需]* 加密页面内容的密码
|
||||
* **message**: *[可选]* 加密提示信息
|
||||
|
||||
例如,本文的前置参数如下:
|
||||
|
||||
```yaml
|
||||
title: "主题文档 - 内容加密"
|
||||
date: 2022-05-28T11:51:41+08:00
|
||||
author: "Lruihao"
|
||||
authorLink: "https://lruihao.cn"
|
||||
description: "了解如何在 FixIt 主题中加密内容。"
|
||||
password: 1212
|
||||
message: "密码是 1212"
|
||||
|
||||
resources:
|
||||
- name: "featured-image"
|
||||
src: "featured-image.png"
|
||||
|
||||
tags:
|
||||
- Encryption
|
||||
categories:
|
||||
- documentation
|
||||
```
|
||||
|
||||
{{< admonition info >}}
|
||||
|
||||
1. 每次输入正确密码后,会在用户本地缓存密码 hash 值,一天之内再次访问时,将自动解锁文章
|
||||
2. 文章最后提供有一个 “重新加密” 的按钮,点击即可立即忘记密码,并重新加密内容
|
||||
3. 加密文章已从搜索中隐藏
|
||||
4. 加密文章的 Markdown 输出已禁用,为了防止密码泄漏,**请勿将加密文章以任何形式公开**
|
||||
|
||||
{{< /admonition >}}
|
||||
|
||||
### 进阶使用
|
||||
|
||||
FixIt Dcryptor 有两个生命周期钩子函数,详见 [Class FixItDecryptor API](/theme-documentation-content-encryption/#fixit-decryptor-api)
|
||||
|
||||
例如在解锁文章后,输出文本:
|
||||
|
||||
```go-html-template
|
||||
{{</* script */>}}
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
fixit.theme.decryptor.addEventListener('decrypted', function() {
|
||||
console.log('after password decryption')
|
||||
})
|
||||
if (window.localStorage.getItem(`fixit-decryptor/#${location.pathname}`)) {
|
||||
console.log('after automatic decryption')
|
||||
}
|
||||
});
|
||||
{{</* /script */>}}
|
||||
```
|
||||
|
||||
您可以在开发人员工具的控制台中看到输出。
|
||||
|
||||
{{< script >}}
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
fixit.decryptor.addEventListener('decrypted', function() {
|
||||
console.log('after password decryption')
|
||||
})
|
||||
if (window.localStorage.getItem(`fixit-decryptor/#${location.pathname}`)) {
|
||||
console.log('after automatic decryption')
|
||||
}
|
||||
});
|
||||
{{< /script >}}
|
||||
|
||||
## 部分加密 {#partial-encryption}
|
||||
|
||||
{{< version 0.2.15 >}}
|
||||
|
||||
您可以使用 `fixit-encryptor` shortcode 来加密部分内容。
|
||||
|
||||
`fixit-encryptor` shortcode 具有以下命名参数:
|
||||
|
||||
* **password** *[必选]*(**第一个**位置参数)
|
||||
|
||||
部分加密内容的密码。
|
||||
|
||||
* **message** *[可选]*(**第二个**位置参数)
|
||||
|
||||
解密输入框的提示信息。
|
||||
|
||||
一个 `fixit-encryptor` 示例:
|
||||
|
||||
```go-html-template
|
||||
{{%/* fixit-encryptor "1212" "密码是 1212" */%}}
|
||||
`fixit-encryptor` shortcode 在版本 {{</* version 0.2.15 */>}} 得到支持。
|
||||
{{%/* /fixit-encryptor */%}}
|
||||
Or
|
||||
{{%/* fixit-encryptor password="1212" message="密码是 1212" */%}}
|
||||
`fixit-encryptor` shortcode 在版本 {{</* version 0.2.15 */>}} 得到支持。
|
||||
{{%/* /fixit-encryptor */%}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{% fixit-encryptor "1212" "密码是 1212" %}}
|
||||
`fixit-encryptor` shortcode 在版本 {{< version 0.2.15 >}} 得到支持。
|
||||
{{% /fixit-encryptor %}}
|
||||
|
||||
## 结语
|
||||
|
||||
相比于通过 Golang/Python/JavaScript 等以脚本批处理的方式加密内容,FixIt 主题内置加密具有以下优缺点:
|
||||
|
||||
* **优点**:易用性高,开箱即用,无需进一步批处理
|
||||
* **缺点**:安全性低,加密算法受限于 `go-html-template` 语法
|
||||
|
||||
> “最简单的密码,就足以防住 90% 的人!”
|
||||
>
|
||||
> 隐私无小事,重要私密的内容请勿上传,各自妥善保管!
|
||||
|
Before Width: | Height: | Size: 109 KiB |
@@ -1,491 +0,0 @@
|
||||
---
|
||||
weight: 2
|
||||
title: "Theme Documentation - Content"
|
||||
date: 2021-12-19T16:15:22+08:00
|
||||
draft: false
|
||||
author: "Lruihao"
|
||||
authorLink: "https://lruihao.cn"
|
||||
description: "Find out how to create and organize your content quickly and intuitively in FixIt theme."
|
||||
resources:
|
||||
- name: "featured-image"
|
||||
src: "featured-image.jpg"
|
||||
|
||||
tags: ["content", "Markdown"]
|
||||
categories: ["documentation"]
|
||||
|
||||
lightgallery: true
|
||||
|
||||
toc:
|
||||
auto: false
|
||||
math:
|
||||
enable: true
|
||||
|
||||
menu:
|
||||
main:
|
||||
name: "Content"
|
||||
title: "Find out how to create and organize your content quickly and intuitively in FixIt theme."
|
||||
parent: "documentation"
|
||||
pre: "<i class='fa-brands fa-readme fa-fw fa-sm'></i>"
|
||||
---
|
||||
|
||||
Find out how to create and organize your content quickly and intuitively in **FixIt** theme.
|
||||
|
||||
<!--more-->
|
||||
|
||||
## 1 Contents Organization {#contents-organization}
|
||||
|
||||
A few suggestions to help you get a good looking site quickly:
|
||||
|
||||
* Keep post pages in the `content/posts` directory, for example: `content/posts/my-first-post.md`
|
||||
* Keep other pages in the `content` directory, for example: `content/about.md`
|
||||
* Local resources organization
|
||||
|
||||
{{< admonition note "Local Resource Reference" >}}
|
||||
{{< version 0.2.10 >}}
|
||||
|
||||
There are three ways to reference local resources such as **images** and **music**:
|
||||
|
||||
1. Using [page resources](https://gohugo.io/content-management/page-resources/) in [page bundles](https://gohugo.io/content-management/page-bundles/).
|
||||
You can reference page resources by the value for `Resources.GetMatch` or the filepath of the resource relative to the page directory directly.
|
||||
2. Store resources in the **assets** directory, which is `/assets` by default.
|
||||
The filepath of the resource to reference in the post is relative to the assets directory.
|
||||
3. Store resources in the **static** directory, which is `/static` by default.
|
||||
The filepath of the resource to reference in the post is relative to the static directory.
|
||||
|
||||
The **priority** of references is also in the above order.
|
||||
|
||||
There are many places in the theme where the above local resource references can be used,
|
||||
such as **links**, **images**, `image` shortcode, `music` shortcode and some params in the **front matter**.
|
||||
|
||||
Images in page resources or assets directory [processing](https://gohugo.io/content-management/image-processing/)
|
||||
will be supported in the future.
|
||||
It's really cool! :(fa-regular fa-grin-squint fa-fw):
|
||||
{{< /admonition >}}
|
||||
|
||||
## 2 Front Matter {#front-matter}
|
||||
|
||||
**Hugo** allows you to add front matter in `yaml`, `toml` or `json` to your content files.
|
||||
|
||||
{{< admonition >}}
|
||||
**Not all** of the below front matters need to be set in each of your posts.
|
||||
It is necessary only if the front matters and the `page` part in your [site configuration](../theme-documentation-basics#site-configuration) are inconsistent.
|
||||
{{< /admonition >}}
|
||||
|
||||
* **title**: the title for the content.
|
||||
* **subtitle**: {{< version 0.2.0 >}} the subtitle for the content.
|
||||
* **date**: the datetime assigned to this page, which is usually fetched from the `date` field in front matter, but this behaviour is configurabl in the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
* **lastmod**: the datetime at which the content was last modified.
|
||||
* **draft**: if `true`, the content will not be rendered unless the `--buildDrafts`/`-D` flag is passed to the `hugo` command.
|
||||
* **author**: the author for the content.
|
||||
* **authorLink**: the link of the author.
|
||||
* **authorEmail**: {{< version 0.2.14 >}} the of the author.
|
||||
* **description**: the description for the content.
|
||||
* **keywords**: the keywords for the content.
|
||||
* **license**: the special lisence for this content.
|
||||
* **images**: page images for Open Graph and Twitter Cards.
|
||||
|
||||
* **tags**: the tags for the content.
|
||||
* **categories**: the categories for the content.
|
||||
* **featuredImage**: the featured image for the content.
|
||||
* **featuredImagePreview**: the featured image for the content preview in the home page.
|
||||
|
||||
* **hiddenFromHomePage**: if `true`, the content will not be shown in the home page.
|
||||
* **hiddenFromSearch**: {{< version 0.2.0 >}} if `true`, the content will not be shown in the search results.
|
||||
* **twemoji**: {{< version 0.2.0 >}} if `true`, the content will enable the twemoji.
|
||||
* **lightgallery**: if `true`, images in the content will be shown as the gallery.
|
||||
* **ruby**: {{< version 0.2.0 >}} if `true`, the content will enable the [ruby extended syntax](#ruby).
|
||||
* **fraction**: {{< version 0.2.0 >}} if `true`, the content will enable the [fraction extended syntax](#fraction).
|
||||
* **fontawesome**: {{< version 0.2.0 >}} if `true`, the content will enable the [Font Awesome extended syntax](#fontawesome).
|
||||
* **linkToMarkdown**: if `true`, the footer of the content will be shown the link to the orignal Markdown file.
|
||||
* **rssFullText**: {{< version 0.2.4 >}} if `true`, the full text content will be shown in RSS.
|
||||
* **pageStyle**: {{< version 0.2.13 >}} Detail see [Page Style](../theme-documentation-basics#page-style)
|
||||
* **gravatarForce**: {{< version 0.2.14 >}} Gravatar is force-used as the author's avatar.
|
||||
|
||||
* **toc**: {{< version 0.2.9 changed >}} the same as the `params.page.toc` part in the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
* **expirationReminder**: {{< version 0.2.13 >}} the same as the `params.page.expirationReminder` part in the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
* **code**: {{< version 0.2.0 >}} the same as the `params.page.code` part in the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
* **edit**: {{< version 0.2.14 >}} the same as the `params.page.edit` part in the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
* **math**: {{< version 0.2.0 changed >}} the same as the `params.page.math` part in the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
* **mapbox**: {{< version 0.2.0 >}} the same as the `params.page.mapbox` part in the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
* **share**: the same as the `params.page.share` part in the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
* **comment**: {{< version 0.2.0 changed >}} the same as the `params.page.comment` part in the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
* **library**: {{< version 0.2.7 >}} the same as the `params.page.library` part in the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
* **seo**: {{< version 0.2.10 >}} the same as the `params.page.seo` part in the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
* **type**: the rendering template of page, see [templates](#tamplates) for details.
|
||||
* **menu**: see [Add content to Menu](../theme-documentation-basics#content-to-menu)
|
||||
|
||||
* **password**: {{< version 0.2.15 >}} password of encrypted page content, see [Theme Documentation - Content Encryption](../theme-documentation-content-encryption/)
|
||||
* **message**: {{< version 0.2.15 >}} encryption prompt, see [Theme Documentation - Content Encryption](../theme-documentation-content-encryption/)
|
||||
|
||||
* **repost**: {{< version 0.2.15 >}} the same as the `params.page.repost` part in the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
|
||||
{{< admonition tip >}}
|
||||
{{< version 0.2.10 >}}
|
||||
|
||||
**featuredImage** and **featuredImagePreview** support the complete usage of [local resource references](#contents-organization).
|
||||
|
||||
If the page resource with `name: featured-image` or `name: featured-image-preview` is set in the front matter,
|
||||
it is not necessary to set the parameter `featuredImage` or `featuredImagePreview`:
|
||||
|
||||
```yaml
|
||||
resources:
|
||||
- name: featured-image
|
||||
src: featured-image.jpg
|
||||
- name: featured-image-preview
|
||||
src: featured-image-preview.jpg
|
||||
```
|
||||
|
||||
{{< version 0.2.12 >}}
|
||||
|
||||
Some [archetypes](https://gohugo.io/content-management/archetypes/) are embedded in the **FixIt** theme, which will take effect when creating new content with the following commands, and the front matter will be automatically brought in.
|
||||
|
||||
```bash
|
||||
hugo new posts/foo.md
|
||||
hugo new --kind post-bundle posts/bar/
|
||||
```
|
||||
{{< /admonition >}}
|
||||
|
||||
Here is a front matter example:
|
||||
|
||||
```yaml
|
||||
---
|
||||
title: "My First Post"
|
||||
subtitle: ""
|
||||
date: 2020-03-04T15:58:26+08:00
|
||||
lastmod: 2020-03-04T15:58:26+08:00
|
||||
draft: true
|
||||
author: ""
|
||||
authorLink: ""
|
||||
authorEmail: ""
|
||||
description: ""
|
||||
keywords: ""
|
||||
license: ""
|
||||
images: []
|
||||
|
||||
tags: []
|
||||
categories: []
|
||||
featuredImage: ""
|
||||
featuredImagePreview: ""
|
||||
|
||||
hiddenFromHomePage: false
|
||||
hiddenFromSearch: false
|
||||
twemoji: false
|
||||
lightgallery: true
|
||||
ruby: true
|
||||
fraction: true
|
||||
fontawesome: true
|
||||
linkToMarkdown: true
|
||||
rssFullText: false
|
||||
pageStyle: "normal"
|
||||
gravatarForce: false
|
||||
|
||||
toc:
|
||||
enable: true
|
||||
auto: true
|
||||
expirationReminder:
|
||||
enable: false
|
||||
# ...
|
||||
code:
|
||||
copy: true
|
||||
# ...
|
||||
edit:
|
||||
enable: false
|
||||
# ...
|
||||
math:
|
||||
enable: true
|
||||
# ...
|
||||
mapbox:
|
||||
accessToken: ""
|
||||
# ...
|
||||
share:
|
||||
enable: true
|
||||
# ...
|
||||
comment:
|
||||
enable: true
|
||||
# ...
|
||||
library:
|
||||
css:
|
||||
# someCSS = "some.css"
|
||||
# located in "assets/"
|
||||
# Or
|
||||
# someCSS = "https://cdn.example.com/some.css"
|
||||
js:
|
||||
# someJS = "some.js"
|
||||
# located in "assets/"
|
||||
# Or
|
||||
# someJS = "https://cdn.example.com/some.js"
|
||||
seo:
|
||||
images: []
|
||||
# ...
|
||||
---
|
||||
```
|
||||
|
||||
## 3 Tamplates {#tamplates}
|
||||
|
||||
Generally, you don't need to set the **type** parameter, because Hugo and fixit will help you choose. However, the **FixIt** theme provides some special templates for users to use.
|
||||
|
||||
### Friends
|
||||
|
||||
{{< version 0.2.12 >}}
|
||||
|
||||
Set `type: "friends"` in the front matter and create data file named `friends.yml` in the `yourSite/data/` directory, whose content format is as follows:
|
||||
|
||||
```yml
|
||||
# Friend/Site info of one
|
||||
- nickname: friend's name
|
||||
avatar: friend's avatar
|
||||
url: site link
|
||||
description: description of friend/site
|
||||
```
|
||||
|
||||
{{< admonition tip >}}
|
||||
|
||||
You can use the following command to quickly create a friends page:
|
||||
|
||||
```bash
|
||||
hugo new friends/index.md
|
||||
```
|
||||
|
||||
{{< /admonition >}}
|
||||
|
||||
### Offline
|
||||
|
||||
{{< version 0.2.12 >}} See [PWA Support](/pwa-support/) for details.
|
||||
|
||||
Set `type: "offline"` in the front matter and set `enablePWA` in `config.toml`:
|
||||
```toml
|
||||
[params]
|
||||
# enable PWA
|
||||
enablePWA = true
|
||||
```
|
||||
{{< admonition tip >}}
|
||||
|
||||
You can use the following command to quickly create a offline page:
|
||||
|
||||
```bash
|
||||
hugo new offline/index.md
|
||||
```
|
||||
|
||||
{{< /admonition >}}
|
||||
|
||||
## 4 Content Summaries
|
||||
|
||||
**FixIt** theme uses the summary of the content to display abstract information in the home page. Hugo can generate summaries of your content.
|
||||
|
||||

|
||||
|
||||
### Automatic Summary Splitting
|
||||
|
||||
By default, Hugo automatically takes the first 70 words of your content as its summary.
|
||||
|
||||
You may customize the summary length by setting `summaryLength` in the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
|
||||
If you are creating content in a [CJK]^(Chinese/Japanese/Korean) language and want to use Hugo’s automatic summary splitting, set `hasCJKLanguage` to `true` in your [site configuration](../theme-documentation-basics#site-configuration).
|
||||
|
||||
### Manual Summary Splitting
|
||||
|
||||
Alternatively, you may add the `<!--more-->` summary divider where you want to split the article.
|
||||
|
||||
Content that comes before the summary divider will be used as that content’s summary.
|
||||
|
||||
{{< admonition >}}
|
||||
Be careful to enter `<!--more-->` exactly; i.e., all lowercase and with no whitespace.
|
||||
{{< /admonition >}}
|
||||
|
||||
### Front Matter Summary
|
||||
|
||||
You might want your summary to be something other than the text that starts the article. In this case you can provide a separate summary in the `summary` variable of the article front matter.
|
||||
|
||||
### Use Description as Summary
|
||||
|
||||
You might want your description in the `description` variable of the article front matter as the summary.
|
||||
|
||||
You may add the `<!--more-->` summary divider at the start of the article. Keep content that comes before the summary divider empty. Then **FixIt** theme will use your description as the summary.
|
||||
|
||||
### Priority Order of Summary Selection
|
||||
|
||||
Because there are multiple ways in which a summary can be specified it is useful to understand the order. It is as follows:
|
||||
|
||||
1. If there is a `<!--more-->` summary divider present in the article but no content is before the divider, the description will be used as the summary.
|
||||
2. If there is a `<!--more-->` summary divider present in the article the text up to the divider will be provided as per the manual summary split method.
|
||||
3. If there is a summary variable in the article front matter the value of the variable will be provided as per the front matter summary method.
|
||||
4. The text at the start of the article will be provided as per the automatic summary split method.
|
||||
|
||||
{{< admonition >}}
|
||||
It is not recommended to include rich text block elements in the summary, which will cause typographic errors. Such as code blocks, pictures, tables, etc.
|
||||
{{< /admonition >}}
|
||||
|
||||
## 5 Basic Markdown Syntax
|
||||
|
||||
This part is shown in the [basic markdown syntax page](../basic-markdown-syntax/).
|
||||
|
||||
## 6 Extended Markdown Syntax {#extended-markdown-syntax}
|
||||
|
||||
**FixIt** theme has some extended syntax elements for you to write articles.
|
||||
|
||||
### Emoji Support
|
||||
|
||||
This part is shown in the [emoji support page](../emoji-support/).
|
||||
|
||||
### Mathematical Formula
|
||||
|
||||
**FixIt** theme supports mathematical formulas based on [$ \KaTeX $](https://katex.org/).
|
||||
|
||||
Set the property `enable = true` under `[params.math]` in your [site configuration](../theme-documentation-basics#site-configuration)
|
||||
and the property `math: true` of the article front matter to enable the automatic rendering of mathematical formulas.
|
||||
|
||||
{{< admonition tip >}}
|
||||
Here is a list of [$ \TeX $ functions supported by $ \KaTeX $](https://katex.org/docs/supported.html).
|
||||
{{< /admonition >}}
|
||||
|
||||
#### Block Formula
|
||||
|
||||
The default block delimiters are `$$`/`$$` and `\\[`/`\\]`:
|
||||
|
||||
```markdown
|
||||
$$ c = \pm\sqrt{a^2 + b^2} $$
|
||||
|
||||
\\[ f(x)=\int_{-\infty}^{\infty} \hat{f}(\xi) e^{2 \pi i \xi x} d \xi \\]
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
$$ c = \pm\sqrt{a^2 + b^2} $$
|
||||
|
||||
\\[ f(x)=\int_{-\infty}^{\infty} \hat{f}(\xi) e^{2 \pi i \xi x} d \xi \\]
|
||||
|
||||
#### Inline Formula
|
||||
|
||||
The default inline delimiters are `$`/`$` and `\\(`/`\\)`:
|
||||
|
||||
```markdown
|
||||
$ c = \pm\sqrt{a^2 + b^2} $ and \\( f(x)=\int_{-\infty}^{\infty} \hat{f}(\xi) e^{2 \pi i \xi x} d \xi \\)
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
$ c = \pm\sqrt{a^2 + b^2} $ and \\( f(x)=\int_{-\infty}^{\infty} \hat{f}(\xi) e^{2 \pi i \xi x} d \xi \\)
|
||||
|
||||
{{< admonition tip >}}
|
||||
You can add more block and inline delimiters in your [site configuration](../theme-documentation-basics#site-configuration).
|
||||
{{< /admonition >}}
|
||||
|
||||
#### Copy-tex
|
||||
|
||||
**[Copy-tex](https://github.com/Khan/KaTeX/tree/master/contrib/copy-tex)** is an extension for **$ \KaTeX $**.
|
||||
|
||||
By the extension, when selecting and copying $ \KaTeX $ rendered elements, copies their $ \LaTeX $ source to the clipboard.
|
||||
|
||||
Set the property `copyTex = true` under `[params.math]` in your [site configuration](../theme-documentation-basics#site-configuration) to enable Copy-tex.
|
||||
|
||||
Select and copy the formula rendered in the previous section, and you can find that the copied content is the LaTeX source code.
|
||||
|
||||
#### mhchem
|
||||
|
||||
**[mhchem](https://github.com/Khan/KaTeX/tree/master/contrib/mhchem)** is an extension for **$ \KaTeX $**.
|
||||
|
||||
By the extension, you can write beautiful chemical equations easily in the article.
|
||||
|
||||
Set the property `mhchem = true` under `[params.math]` in your [site configuration](../theme-documentation-basics#site-configuration) to enable mhchem.
|
||||
|
||||
```markdown
|
||||
$$ \ce{CO2 + C -> 2 CO} $$
|
||||
|
||||
$$ \ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-} $$
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
$$ \ce{CO2 + C -> 2 CO} $$
|
||||
|
||||
$$ \ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-} $$
|
||||
|
||||
### Ruby Annotation {#ruby}
|
||||
|
||||
An extended Markdown syntax for **ruby annotation** is supported in **FixIt** theme:
|
||||
|
||||
```markdown
|
||||
[Hugo]{?^}(An open-source static site generator)
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
[Hugo]^(An open-source static site generator)
|
||||
|
||||
### Fraction {#fraction}
|
||||
|
||||
{{< version 0.2.0 >}}
|
||||
|
||||
An extended Markdown syntax for **fraction** is supported in **FixIt** theme:
|
||||
|
||||
```markdown
|
||||
[Light]{?/}[Dark]
|
||||
|
||||
[99]{?/}[100]
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
[Light]/[Dark]
|
||||
|
||||
[90]/[100]
|
||||
|
||||
### Font Awesome {#fontawesome}
|
||||
|
||||
**FixIt** theme uses [Font Awesome](https://fontawesome.com/) as the icon library.
|
||||
You can easily use these icons in your articles.
|
||||
|
||||
Get the `class` of icons you wanted from the [Font Awesome website](https://fontawesome.com/icons?d=gallery).
|
||||
|
||||
```markdown
|
||||
Gone camping! {?:}(fa-solid fa-campground fa-fw): Be back soon.
|
||||
|
||||
That is so funny! {?:}(fa-regular fa-grin-tears):
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
Gone camping! :(fa-solid fa-campground fa-fw): Be back soon.
|
||||
|
||||
That is so funny! :(fa-regular fa-grin-tears):
|
||||
|
||||
### Escape character {#escape-character}
|
||||
|
||||
In some special cases (when writing this theme documentation :(fa-regular fa-grin-squint-tears):),
|
||||
your content will conflict with basic or extended Markdown syntax, and it is inevitable.
|
||||
|
||||
The escape character syntax can help you build the content you wanted:
|
||||
|
||||
```markdown
|
||||
{{??}X} -> X
|
||||
```
|
||||
|
||||
For example, two `:` will enable emoji syntax, which is not the behavior you want. The escape character syntax is like this:
|
||||
|
||||
```markdown
|
||||
{{??}:}joy:
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
**{?:}joy{?:}** instead of **:joy:**
|
||||
|
||||
{{< admonition tip >}}
|
||||
This is related to **[an issue for Hugo](https://github.com/gohugoio/hugo/issues/4978)**, which has not been resolved.
|
||||
{{< /admonition >}}
|
||||
|
||||
Another example is:
|
||||
|
||||
```markdown
|
||||
[link{{??}]}(#escape-character)
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
**[link{?]}(#escape-character)** instead of **[link](#escape-character)**.
|
||||
|
||||
---
|
||||
|
||||
{{< admonition quote "Thanks" >}}
|
||||
_Thanks to the original author [Dillon](https://dillonzq.com) for preparing and revising the content before version `v0.2.10` in this documentation._
|
||||
{{< /admonition >}}
|
||||
@@ -1,490 +0,0 @@
|
||||
---
|
||||
weight: 2
|
||||
title: "主题文档 - 内容"
|
||||
date: 2021-12-19T16:15:22+08:00
|
||||
draft: false
|
||||
author: "Lruihao"
|
||||
authorLink: "https://lruihao.cn"
|
||||
description: "了解如何在 FixIt 主题中快速,直观地创建和组织内容。"
|
||||
resources:
|
||||
- name: "featured-image"
|
||||
src: "featured-image.jpg"
|
||||
|
||||
tags: ["content", "Markdown"]
|
||||
categories: ["documentation"]
|
||||
|
||||
lightgallery: true
|
||||
|
||||
toc:
|
||||
auto: false
|
||||
math:
|
||||
enable: true
|
||||
|
||||
menu:
|
||||
main:
|
||||
title: "了解如何在 FixIt 主题中快速,直观地创建和组织内容。"
|
||||
parent: "documentation"
|
||||
pre: "<i class='fa-brands fa-readme fa-fw fa-sm'></i>"
|
||||
---
|
||||
|
||||
了解如何在 **FixIt** 主题中快速,直观地创建和组织内容。
|
||||
|
||||
<!--more-->
|
||||
|
||||
## 1 内容组织 {#contents-organization}
|
||||
|
||||
以下是一些方便你清晰管理和生成文章的目录结构建议:
|
||||
|
||||
* 保持博客文章存放在 `content/posts` 目录,例如:`content/posts/我的第一篇文章。md`
|
||||
* 保持简单的静态页面存放在 `content` 目录,例如:`content/about.md`
|
||||
* 本地资源组织
|
||||
|
||||
{{< admonition note "本地资源引用" >}}
|
||||
{{< version 0.2.10 >}}
|
||||
|
||||
有三种方法来引用**图片**和**音乐**等本地资源:
|
||||
|
||||
1. 使用 [页面包](https://gohugo.io/content-management/page-bundles/) 中的 [页面资源](https://gohugo.io/content-management/page-resources/).
|
||||
你可以使用适用于 `Resources.GetMatch` 的值或者直接使用相对于当前页面目录的文件路径来引用页面资源。
|
||||
2. 将本地资源放在 **assets** 目录中,默认路径是 `/assets`.
|
||||
引用资源的文件路径是相对于 assets 目录的。
|
||||
3. 将本地资源放在 **static** 目录中,默认路径是 `/static`.
|
||||
引用资源的文件路径是相对于 static 目录的。
|
||||
|
||||
引用的**优先级**符合以上的顺序。
|
||||
|
||||
在这个主题中的很多地方可以使用上面的本地资源引用,
|
||||
例如 **链接**, **图片**, `image` shortcode, `music` shortcode 和**前置参数**中的部分参数。
|
||||
|
||||
页面资源或者 **assets** 目录中的 [图片处理](https://gohugo.io/content-management/image-processing/) 会在未来的版本中得到支持。
|
||||
非常酷的功能!:(fa-regular fa-grin-squint fa-fw):
|
||||
{{< /admonition >}}
|
||||
|
||||
## 2 前置参数 {#front-matter}
|
||||
|
||||
**Hugo** 允许你在文章内容前面添加 `yaml`, `toml` 或者 `json` 格式的前置参数。
|
||||
|
||||
{{< admonition >}}
|
||||
**不是所有**的以下前置参数都必须在你的每篇文章中设置。
|
||||
只有在文章的参数和你的 [网站设置](../theme-documentation-basics#site-configuration) 中的 `page` 部分不一致时才有必要这么做。
|
||||
{{< /admonition >}}
|
||||
|
||||
* **title**: 文章标题
|
||||
* **subtitle**: {{< version 0.2.0 >}} 文章副标题
|
||||
* **date**: 这篇文章创建的日期时间它通常是从文章的前置参数中的 `date` 字段获取的,但是也可以在 [网站配置](../theme-documentation-basics#site-configuration) 中设置
|
||||
* **lastmod**: 上次修改内容的日期时间
|
||||
* **draft**: 如果设为 `true`, 除非 `hugo` 命令使用了 `--buildDrafts`/`-D` 参数,这篇文章不会被渲染
|
||||
* **author**: 文章作者
|
||||
* **authorLink**: 文章作者的链接
|
||||
* **authorEmail**: {{< version 0.2.14 >}} 文章作者的邮箱
|
||||
* **description**: 文章内容的描述
|
||||
* **keywords**: 文章内容的关键词
|
||||
* **license**: 这篇文章特殊的许可
|
||||
* **images**: 页面图片,用于 Open Graph 和 Twitter Cards.
|
||||
|
||||
* **tags**: 文章的标签
|
||||
* **categories**: 文章所属的类别
|
||||
* **featuredImage**: 文章的特色图片
|
||||
* **featuredImagePreview**: 用在主页预览的文章特色图片
|
||||
|
||||
* **hiddenFromHomePage**: 如果设为 `true`, 这篇文章将不会显示在主页上
|
||||
* **hiddenFromSearch**: {{< version 0.2.0 >}} 如果设为 `true`, 这篇文章将不会显示在搜索结果中
|
||||
* **twemoji**: {{< version 0.2.0 >}} 如果设为 `true`, 这篇文章会使用 twemoji
|
||||
* **lightgallery**: 如果设为 `true`, 文章中的图片将可以按照画廊形式呈现
|
||||
* **ruby**: {{< version 0.2.0 >}} 如果设为 `true`, 这篇文章会使用 [上标注释扩展语法](#ruby)
|
||||
* **fraction**: {{< version 0.2.0 >}} 如果设为 `true`, 这篇文章会使用 [分数扩展语法](#fraction)
|
||||
* **fontawesome**: {{< version 0.2.0 >}} 如果设为 `true`, 这篇文章会使用 [Font Awesome 扩展语法](#fontawesome)
|
||||
* **linkToMarkdown**: 如果设为 `true`, 内容的页脚将显示指向原始 Markdown 文件的链接
|
||||
* **rssFullText**: {{< version 0.2.4 >}} 如果设为 `true`, 在 RSS 中将会显示全文内容
|
||||
* **pageStyle**: {{< version 0.2.13 >}} 页面样式,详见 [页面宽度](../theme-documentation-basics#page-style)
|
||||
* **gravatarForce**: {{< version 0.2.14 >}} 强制使用 Gravatar 作为作者头像
|
||||
|
||||
* **toc**: {{< version 0.2.9 changed >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.toc` 部分相同
|
||||
* **expirationReminder**: {{< version 0.2.13 >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.expirationReminder` 部分相同
|
||||
* **code**: {{< version 0.2.0 >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.code` 部分相同
|
||||
* **edit**: {{< version 0.2.14 >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.edit` 部分相同
|
||||
* **math**: {{< version 0.2.0 changed >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.math` 部分相同
|
||||
* **mapbox**: {{< version 0.2.0 >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.mapbox` 部分相同
|
||||
* **share**: 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.share` 部分相同
|
||||
* **comment**: {{< version 0.2.0 changed >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.comment` 部分相同
|
||||
* **library**: {{< version 0.2.7 >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.library` 部分相同
|
||||
* **seo**: {{< version 0.2.10 >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.seo` 部分相同
|
||||
* **type**: 页面渲染模板,详见 [页面模板](#tamplates)
|
||||
* **menu**: 详见 [添加内容到菜单](../theme-documentation-basics#content-to-menu)
|
||||
|
||||
* **password**: {{< version 0.2.15 >}} 加密页面内容的密码,详见 [主题文档 - 内容加密](../theme-documentation-content-encryption/)
|
||||
* **message**: {{< version 0.2.15 >}} 加密提示信息,详见 [主题文档 - 内容加密](../theme-documentation-content-encryption/)
|
||||
|
||||
* **repost**: {{< version 0.2.15 >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.repost` 部分相同
|
||||
|
||||
{{< admonition tip >}}
|
||||
{{< version 0.2.10 >}}
|
||||
|
||||
**featuredImage** 和 **featuredImagePreview** 支持 [本地资源引用](#contents-organization) 的完整用法。
|
||||
|
||||
如果带有在前置参数中设置了 `name: featured-image` 或 `name: featured-image-preview` 属性的页面资源,
|
||||
没有必要在设置 `featuredImage` 或 `featuredImagePreview`:
|
||||
|
||||
```yaml
|
||||
resources:
|
||||
- name: featured-image
|
||||
src: featured-image.jpg
|
||||
- name: featured-image-preview
|
||||
src: featured-image-preview.jpg
|
||||
```
|
||||
|
||||
{{< version 0.2.12 >}}
|
||||
|
||||
**FixIt** 主题内嵌了一些 [原型](https://gohugo.io/content-management/archetypes/),在使用以下命令创建新内容时生效,会自动带入常用的前置参数:
|
||||
|
||||
```bash
|
||||
hugo new posts/foo.md
|
||||
hugo new --kind post-bundle posts/bar/
|
||||
```
|
||||
{{< /admonition >}}
|
||||
|
||||
这是一个前置参数例子:
|
||||
|
||||
```yaml
|
||||
---
|
||||
title: "我的第一篇文章"
|
||||
subtitle: ""
|
||||
date: 2020-03-04T15:58:26+08:00
|
||||
lastmod: 2020-03-04T15:58:26+08:00
|
||||
draft: true
|
||||
author: ""
|
||||
authorLink: ""
|
||||
authorEmail: ""
|
||||
description: ""
|
||||
keywords: ""
|
||||
license: ""
|
||||
images: []
|
||||
|
||||
tags: []
|
||||
categories: []
|
||||
featuredImage: ""
|
||||
featuredImagePreview: ""
|
||||
|
||||
hiddenFromHomePage: false
|
||||
hiddenFromSearch: false
|
||||
twemoji: false
|
||||
lightgallery: true
|
||||
ruby: true
|
||||
fraction: true
|
||||
fontawesome: true
|
||||
linkToMarkdown: true
|
||||
rssFullText: false
|
||||
pageStyle: "normal"
|
||||
gravatarForce: false
|
||||
|
||||
toc:
|
||||
enable: true
|
||||
auto: true
|
||||
expirationReminder:
|
||||
enable: false
|
||||
# ...
|
||||
code:
|
||||
copy: true
|
||||
# ...
|
||||
edit:
|
||||
enable: false
|
||||
# ...
|
||||
math:
|
||||
enable: true
|
||||
# ...
|
||||
mapbox:
|
||||
accessToken: ""
|
||||
# ...
|
||||
share:
|
||||
enable: true
|
||||
# ...
|
||||
comment:
|
||||
enable: true
|
||||
# ...
|
||||
library:
|
||||
css:
|
||||
# someCSS = "some.css"
|
||||
# 位于 "assets/"
|
||||
# 或者
|
||||
# someCSS = "https://cdn.example.com/some.css"
|
||||
js:
|
||||
# someJS = "some.js"
|
||||
# 位于 "assets/"
|
||||
# 或者
|
||||
# someJS = "https://cdn.example.com/some.js"
|
||||
seo:
|
||||
images: []
|
||||
# ...
|
||||
---
|
||||
```
|
||||
|
||||
## 3 页面模板 {#tamplates}
|
||||
|
||||
一般情况,你不需要设置 **type** 参数,因为 **Hugo** 和 **FixIt** 会帮你选择。但是 **FixIt** 主题提供了一些特殊的模板给用户使用。
|
||||
|
||||
### 友情链接
|
||||
|
||||
{{< version 0.2.12 >}}
|
||||
|
||||
在前置参数中设置 `type: "friends"`,并在 `yourSite/data/` 目录下创建 `friends.yml`,其内容格式如下:
|
||||
|
||||
```yml
|
||||
# 朋友/站点信息例子
|
||||
- nickname: 朋友名字
|
||||
avatar: 朋友头像
|
||||
url: 站点链接
|
||||
description: 对朋友或其站点的说明
|
||||
```
|
||||
|
||||
{{< admonition tip >}}
|
||||
|
||||
你可以使用以下命令快速创建友情链接页面:
|
||||
|
||||
```bash
|
||||
hugo new friends/index.md
|
||||
```
|
||||
|
||||
{{< /admonition >}}
|
||||
|
||||
### 离线页面
|
||||
|
||||
{{< version 0.2.12 >}} 详见 [PWA 支持](/zh-cn/pwa-support/)
|
||||
|
||||
在前置参数中设置 `type: "offline"`,并在 `config.toml` 中开启 `enablePWA`:
|
||||
```toml
|
||||
[params]
|
||||
# enable PWA
|
||||
# 开启 PWA 支持
|
||||
enablePWA = true
|
||||
```
|
||||
{{< admonition tip >}}
|
||||
|
||||
你可以使用以下命令快速创建离线页面:
|
||||
|
||||
```bash
|
||||
hugo new offline/index.md
|
||||
```
|
||||
|
||||
{{< /admonition >}}
|
||||
|
||||
## 4 内容摘要
|
||||
|
||||
**FixIt** 主题使用内容摘要在主页中显示大致文章信息。Hugo 支持生成文章的摘要。
|
||||
|
||||

|
||||
|
||||
### 自动摘要拆分
|
||||
|
||||
默认情况下,Hugo 自动将内容的前 70 个单词作为摘要。
|
||||
|
||||
你可以通过在 [网站配置](../theme-documentation-basics#site-configuration) 中设置 `summaryLength` 来自定义摘要长度。
|
||||
|
||||
如果您要使用 [CJK]^(中文/日语/韩语) 语言创建内容,并且想使用 Hugo 的自动摘要拆分功能,请在 [网站配置](../theme-documentation-basics#site-configuration) 中将 `hasCJKLanguage` 设置为 `true`.
|
||||
|
||||
### 手动摘要拆分
|
||||
|
||||
另外,你也可以添加 `<!--more-->` 摘要分割符来拆分文章生成摘要。
|
||||
|
||||
摘要分隔符之前的内容将用作该文章的摘要。
|
||||
|
||||
{{< admonition >}}
|
||||
请小心输入`<!--more-->` ; 即全部为小写且没有空格。
|
||||
{{< /admonition >}}
|
||||
|
||||
### 前置参数摘要
|
||||
|
||||
你可能希望摘要不是文章开头的文字。在这种情况下,你可以在文章前置参数的 `summary` 变量中设置单独的摘要。
|
||||
|
||||
### 使用文章描述作为摘要
|
||||
|
||||
你可能希望将文章前置参数中的 `description` 变量的内容作为摘要。
|
||||
|
||||
你仍然需要在文章开头添加 `<!--more-->` 摘要分割符。将摘要分隔符之前的内容保留为空。然后 **FixIt** 主题会将你的文章描述作为摘要。
|
||||
|
||||
### 摘要选择的优先级顺序
|
||||
|
||||
由于可以通过多种方式指定摘要,因此了解顺序很有用。如下:
|
||||
|
||||
1. 如果文章中有 `<!--more-->` 摘要分隔符,但分隔符之前没有内容,则使用描述作为摘要。
|
||||
2. 如果文章中有 `<!--more-->` 摘要分隔符,则将按照手动摘要拆分的方法获得摘要。
|
||||
3. 如果文章前置参数中有摘要变量,那么将以该值作为摘要。
|
||||
4. 按照自动摘要拆分方法。
|
||||
|
||||
{{< admonition >}}
|
||||
不建议在摘要内容中包含富文本块元素,这会导致渲染错误。例如代码块,图片,表格等。
|
||||
{{< /admonition >}}
|
||||
|
||||
## 5 Markdown 基本语法
|
||||
|
||||
这部分内容在 [Markdown 基本语法页面](../basic-markdown-syntax/) 中介绍。
|
||||
|
||||
## 6 Markdown 扩展语法 {#extended-markdown-syntax}
|
||||
|
||||
**FixIt** 主题提供了一些扩展的语法便于你撰写文章。
|
||||
|
||||
### Emoji 支持
|
||||
|
||||
这部分内容在 [Emoji 支持页面](../emoji-support/) 中介绍。
|
||||
|
||||
### 数学公式
|
||||
|
||||
**FixIt** 基于 [$ \KaTeX $](https://katex.org/) 提供数学公式的支持。
|
||||
|
||||
在你的 [网站配置](../theme-documentation-basics#site-configuration) 中的 `[params.math]` 下面设置属性 `enable = true`,
|
||||
并在文章的前置参数中设置属性 `math: true`来启用数学公式的自动渲染。
|
||||
|
||||
{{< admonition tip >}}
|
||||
有一份 [$ \KaTeX $ 中支持的 $ \TeX $ 函数](https://katex.org/docs/supported.html) 清单。
|
||||
{{< /admonition >}}
|
||||
|
||||
#### 公式块
|
||||
|
||||
默认的公式块分割符是 `$$`/`$$` 和 `\\[`/`\\]`:
|
||||
|
||||
```markdown
|
||||
$$ c = \pm\sqrt{a^2 + b^2} $$
|
||||
|
||||
\\[ f(x)=\int_{-\infty}^{\infty} \hat{f}(\xi) e^{2 \pi i \xi x} d \xi \\]
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
$$ c = \pm\sqrt{a^2 + b^2} $$
|
||||
|
||||
\\[ f(x)=\int_{-\infty}^{\infty} \hat{f}(\xi) e^{2 \pi i \xi x} d \xi \\]
|
||||
|
||||
#### 行内公式
|
||||
|
||||
默认的行内公式分割符是 `$`/`$` 和 `\\(`/`\\)`:
|
||||
|
||||
```markdown
|
||||
$ c = \pm\sqrt{a^2 + b^2} $ 和 \\( f(x)=\int_{-\infty}^{\infty} \hat{f}(\xi) e^{2 \pi i \xi x} d \xi \\)
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
$ c = \pm\sqrt{a^2 + b^2} $ 和 \\( f(x)=\int_{-\infty}^{\infty} \hat{f}(\xi) e^{2 \pi i \xi x} d \xi \\)
|
||||
|
||||
{{< admonition tip >}}
|
||||
你可以在 [网站配置](../theme-documentation-basics#site-configuration) 中自定义公式块和行内公式的分割符。
|
||||
{{< /admonition >}}
|
||||
|
||||
#### Copy-tex
|
||||
|
||||
**[Copy-tex](https://github.com/Khan/KaTeX/tree/master/contrib/copy-tex)** 是一个 **$ \KaTeX $** 的插件。
|
||||
|
||||
通过这个扩展,在选择并复制 $ \KaTeX $ 渲染的公式时,会将其 $ \LaTeX $ 源代码复制到剪贴板。
|
||||
|
||||
在你的 [网站配置](../theme-documentation-basics#site-configuration) 中的 `[params.math]` 下面设置属性 `copyTex = true` 来启用 Copy-tex.
|
||||
|
||||
选择并复制上一节中渲染的公式,可以发现复制的内容为 LaTeX 源代码。
|
||||
|
||||
#### mhchem
|
||||
|
||||
**[mhchem](https://github.com/Khan/KaTeX/tree/master/contrib/mhchem)** 是一个 **$ \KaTeX $** 的插件。
|
||||
|
||||
通过这个扩展,你可以在文章中轻松编写漂亮的化学方程式。
|
||||
|
||||
在你的 [网站配置](../theme-documentation-basics#site-configuration) 中的 `[params.math]` 下面设置属性 `mhchem = true` 来启用 mhchem.
|
||||
|
||||
```markdown
|
||||
$$ \ce{CO2 + C -> 2 CO} $$
|
||||
|
||||
$$ \ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-} $$
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
$$ \ce{CO2 + C -> 2 CO} $$
|
||||
|
||||
$$ \ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-} $$
|
||||
|
||||
### 字符注音或者注释 {#ruby}
|
||||
|
||||
**FixIt** 主题支持一种 **字符注音或者注释** Markdown 扩展语法:
|
||||
|
||||
```markdown
|
||||
[Hugo]{?^}(一个开源的静态网站生成工具)
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
[Hugo]^(一个开源的静态网站生成工具)
|
||||
|
||||
### 分数 {#fraction}
|
||||
|
||||
{{< version 0.2.0 >}}
|
||||
|
||||
**FixIt** 主题支持一种 **分数** Markdown 扩展语法:
|
||||
|
||||
```markdown
|
||||
[浅色]{?/}[深色]
|
||||
|
||||
[99]{?/}[100]
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
[浅色]/[深色]
|
||||
|
||||
[90]/[100]
|
||||
|
||||
### Font Awesome {#fontawesome}
|
||||
|
||||
**FixIt** 主题使用 [Font Awesome](https://fontawesome.com/) 作为图标库。
|
||||
你同样可以在文章中轻松使用这些图标。
|
||||
|
||||
从 [Font Awesome 网站](https://fontawesome.com/icons?d=gallery) 上获取所需的图标 `class`.
|
||||
|
||||
```markdown
|
||||
去露营啦!{?:}(fa-solid fa-campground fa-fw): 很快就回来。
|
||||
|
||||
真开心!{?:}(fa-regular fa-grin-tears):
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
去露营啦!:(fa-solid fa-campground fa-fw): 很快就回来。
|
||||
|
||||
真开心!:(fa-regular fa-grin-tears):
|
||||
|
||||
### 转义字符 {#escape-character}
|
||||
|
||||
在某些特殊情况下 (编写这个主题文档时 :(fa-regular fa-grin-squint-tears):),
|
||||
你的文章内容会与 Markdown 的基本或者扩展语法冲突,并且无法避免。
|
||||
|
||||
转义字符语法可以帮助你渲染出想要的内容:
|
||||
|
||||
```markdown
|
||||
{{??}X} -> X
|
||||
```
|
||||
|
||||
例如,两个 `:` 会启用 emoji 语法。但有时候这不是你想要的结果。可以像这样使用转义字符语法:
|
||||
|
||||
```markdown
|
||||
{{??}:}joy:
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
**{?:}joy{?:}** 而不是 **:joy:**
|
||||
|
||||
{{< admonition tip >}}
|
||||
这个方法可以间接解决一个还未解决的 **[Hugo 的 issue](https://github.com/gohugoio/hugo/issues/4978)**.
|
||||
{{< /admonition >}}
|
||||
|
||||
另一个例子是:
|
||||
|
||||
```markdown
|
||||
[link{{??}]}(#escape-character)
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
**[link{?]}(#escape-character)** 而不是 **[link](#escape-character)**.
|
||||
|
||||
---
|
||||
|
||||
{{< admonition quote "感谢" >}}
|
||||
_本文档中 `v0.2.10` 版本之前的内容,感谢原作者 [Dillon](https://dillonzq.com) 编写修订。_
|
||||
{{< /admonition >}}
|
||||
|
Before Width: | Height: | Size: 235 KiB |
|
Before Width: | Height: | Size: 236 KiB |
|
Before Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 41 KiB |
@@ -1,447 +0,0 @@
|
||||
---
|
||||
weight: 4
|
||||
title: "Theme Documentation - Extended Shortcodes"
|
||||
date: 2021-12-19T16:15:22+08:00
|
||||
draft: false
|
||||
author: "Lruihao"
|
||||
authorLink: "https://lruihao.cn"
|
||||
description: "FixIt theme provides multiple shortcodes on top of built-in ones in Hugo."
|
||||
resources:
|
||||
- name: "featured-image"
|
||||
src: "featured-image.jpg"
|
||||
- name: "featured-image-preview"
|
||||
src: "featured-image-preview.jpg"
|
||||
|
||||
tags: ["shortcodes"]
|
||||
categories: ["documentation"]
|
||||
|
||||
lightgallery: true
|
||||
|
||||
menu:
|
||||
main:
|
||||
name: "Extended Shortcodes"
|
||||
title: "FixIt theme provides multiple shortcodes on top of built-in ones in Hugo."
|
||||
parent: "documentation"
|
||||
pre: "<i class='fa-brands fa-readme fa-fw fa-sm'></i>"
|
||||
---
|
||||
|
||||
**FixIt** theme provides multiple shortcodes on top of built-in ones in Hugo.
|
||||
|
||||
<!--more-->
|
||||
|
||||
## 1 style
|
||||
|
||||
{{< version 0.2.0 changed >}}
|
||||
|
||||
{{< admonition >}}
|
||||
Hugo **extended** version is necessary for `style` shortcode.
|
||||
{{< /admonition >}}
|
||||
|
||||
`style` is a shortcode to insert custom style in your post.
|
||||
|
||||
The `style` shortcode has two positional parameters.
|
||||
|
||||
The **first** one is the custom style content,
|
||||
which supports nesting syntax in [:(fa-brands fa-sass fa-fw): SASS](https://sass-lang.com/documentation/style-rules/declarations#nesting)
|
||||
and `&` referring to this parent HTML element.
|
||||
|
||||
And the **second** one is the tag name of the HTML element wrapping the content you want to change style, and whose default value is `div`.
|
||||
|
||||
Example `style` input:
|
||||
|
||||
```go-html-template
|
||||
{{</* style "text-align:right; strong{color:#00b1ff;}" */>}}
|
||||
This is a **right-aligned** paragraph.
|
||||
{{</* /style */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< style "text-align:right; strong{color:#00b1ff;}" >}}
|
||||
This is a **right-aligned** paragraph.
|
||||
{{< /style >}}
|
||||
|
||||
## 2 link
|
||||
|
||||
{{< version 0.2.0 >}}
|
||||
|
||||
`link` shortcode is an alternative to [Markdown link syntax](../basic-markdown-syntax#links). `link` shortcode can provide some other features and can be used in code blocks.
|
||||
|
||||
{{< version 0.2.10 >}} The complete usage of [local resource references](../theme-documentation-content#contents-organization) is supported.
|
||||
|
||||
The `link` shortcode has the following named parameters:
|
||||
|
||||
* **href** *[required]* (**first** positional parameter)
|
||||
|
||||
Destination of the link.
|
||||
|
||||
* **content** *[optional]* (**second** positional parameter)
|
||||
|
||||
Content of the link, default value is the value of **href** parameter.
|
||||
|
||||
*Markdown or HTML format is supported.*
|
||||
|
||||
* **title** *[optional]* (**third** positional parameter)
|
||||
|
||||
`title` attribute of the HTML `a` tag, which will be shown when hovering on the link.
|
||||
|
||||
* **card** *[optional]* (**fourth** positional parameter) {{< version 0.2.12 >}}
|
||||
|
||||
是否显示为卡片式链接,默认值 `false`。
|
||||
|
||||
* **download** *[optional]* {{< version 0.2.12 >}}
|
||||
|
||||
`optional` attribute of the HTML `a` tag.
|
||||
|
||||
* **class** *[optional]*
|
||||
|
||||
`class` attribute of the HTML `a` tag.
|
||||
|
||||
* **rel** *[optional]*
|
||||
|
||||
Additional `rel` attributes of the HTML `a` tag.
|
||||
|
||||
* **external-icon** *[optional]* {{< version 0.2.14 >}}
|
||||
|
||||
whether to add external Icon for external links automatically
|
||||
|
||||
Example `link` input:
|
||||
|
||||
```go-html-template
|
||||
{{</* link "https://assemble.io" */>}}
|
||||
Or
|
||||
{{</* link href="https://assemble.io" */>}}
|
||||
|
||||
{{</* link "mailto:contact@revolunet.com" */>}}
|
||||
Or
|
||||
{{</* link href="mailto:contact@revolunet.com" */>}}
|
||||
|
||||
{{</* link "https://assemble.io" Assemble */>}}
|
||||
Or
|
||||
{{</* link href="https://assemble.io" content=Assemble */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
* {{< link "https://assemble.io" >}}
|
||||
* {{< link "mailto:contact@revolunet.com" >}}
|
||||
* {{< link "https://assemble.io" Assemble >}}
|
||||
|
||||
Example `link` input with a title:
|
||||
|
||||
```go-html-template
|
||||
{{</* link "https://github.com/upstage/" Upstage "Visit Upstage!" */>}}
|
||||
Or
|
||||
{{</* link href="https://github.com/upstage/" content=Upstage title="Visit Upstage!" */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this (hover over the link, there should be a tooltip):
|
||||
|
||||
{{< link "https://github.com/upstage/" Upstage "Visit Upstage!" >}}
|
||||
|
||||
Example `link` input for card type:
|
||||
|
||||
```go-html-template
|
||||
{{</* link "https://github.com/Lruihao/FixIt" "FixIt Theme" "source of FixIt Theme" true */>}}
|
||||
Or
|
||||
{{</* link href="https://github.com/Lruihao/FixIt" content="FixIt Theme" title="source of FixIt Theme" card=true */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< link "https://github.com/Lruihao/FixIt" "FixIt Theme" "source of FixIt Theme" true >}}
|
||||
|
||||
Example `link` input with download attribute:
|
||||
|
||||
```go-html-template
|
||||
{{</* link href="/music/Wavelength.mp3" content="Wavelength.mp3" title="Download Wavelength.mp3" download="Wavelength.mp3" */>}}
|
||||
|
||||
{{</* link href="/music/Wavelength.mp3" content="Wavelength.mp3" title="Download Wavelength.mp3" download="Wavelength.mp3" card=true */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< link href="/music/Wavelength.mp3" content="Wavelength.mp3" title="Download Wavelength.mp3" download="Wavelength.mp3" >}}
|
||||
|
||||
{{< link href="/music/Wavelength.mp3" content="Wavelength.mp3" title="Download Wavelength.mp3" download="Wavelength.mp3" card=true >}}
|
||||
|
||||
## 3 image {#image}
|
||||
|
||||
{{< version 0.2.0 changed >}}
|
||||
|
||||
`image` shortcode is an alternative to [`figure` shortcode](../theme-documentation-built-in-shortcodes#figure). `image` shortcode can take full advantage of the dependent libraries of [lazysizes](https://github.com/aFarkas/lazysizes) and [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js).
|
||||
|
||||
{{< version 0.2.10 >}} The complete usage of [local resource references](../theme-documentation-content#contents-organization) is supported.
|
||||
|
||||
The `image` shortcode has the following named parameters:
|
||||
|
||||
* **src** *[required]* (**first** positional parameter)
|
||||
|
||||
URL of the image to be displayed.
|
||||
|
||||
* **alt** *[optional]* (**second** positional parameter)
|
||||
|
||||
Alternate text for the image if the image cannot be displayed, default value is the value of **src** parameter.
|
||||
|
||||
*Markdown or HTML format is supported.*
|
||||
|
||||
* **caption** *[optional]* (**third** positional parameter)
|
||||
|
||||
Image caption.
|
||||
|
||||
*Markdown or HTML format is supported.*
|
||||
|
||||
* **title** *[optional]*
|
||||
|
||||
Image title that will be shown when hovering on the image.
|
||||
|
||||
* **class** *[optional]*
|
||||
|
||||
`class` attribute of the HTML `figure` tag.
|
||||
|
||||
* **src_s** *[optional]*
|
||||
|
||||
URL of the image thumbnail, used for lightgallery, default value is the value of **src** parameter.
|
||||
|
||||
* **src_l** *[optional]*
|
||||
|
||||
URL of the HD image, used for lightgallery, default value is the value of **src** parameter.
|
||||
|
||||
* **height** *[optional]*
|
||||
|
||||
`height` attribute of the image.
|
||||
|
||||
* **width** *[optional]*
|
||||
|
||||
`width` attribute of the image.
|
||||
|
||||
* **linked** *[optional]*
|
||||
|
||||
Whether the image needs to be hyperlinked, default value is `true`.
|
||||
|
||||
* **rel** *[optional]*
|
||||
|
||||
Additional `rel` attributes of the HTML `a` tag, if **linked** parameter is set to `true`.
|
||||
|
||||
Example `image` input:
|
||||
|
||||
```go-html-template
|
||||
{{</* image src="/images/lighthouse.jpg" caption="Lighthouse (`image`)" src_s="/images/lighthouse-small.jpg" src_l="/images/lighthouse-large.jpg" */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< image src="/images/lighthouse.jpg" caption="Lighthouse (`image`)" src_s="/images/lighthouse-small.jpg" src_l="/images/lighthouse-large.jpg" >}}
|
||||
|
||||
## 4 admonition
|
||||
|
||||
The `admonition` shortcode supports **12** types of banners to help you put notice in your page.
|
||||
|
||||
*Markdown or HTML format in the content is supported.*
|
||||
|
||||
{{< admonition >}}
|
||||
A **note** banner
|
||||
{{< /admonition >}}
|
||||
|
||||
{{< admonition abstract >}}
|
||||
An **abstract** banner
|
||||
{{< /admonition >}}
|
||||
|
||||
{{< admonition info >}}
|
||||
A **info** banner
|
||||
{{< /admonition >}}
|
||||
|
||||
{{< admonition tip >}}
|
||||
A **tip** banner
|
||||
{{< /admonition >}}
|
||||
|
||||
{{< admonition success >}}
|
||||
A **success** banner
|
||||
{{< /admonition >}}
|
||||
|
||||
{{< admonition question >}}
|
||||
A **question** banner
|
||||
{{< /admonition >}}
|
||||
|
||||
{{< admonition warning >}}
|
||||
A **warning** banner
|
||||
{{< /admonition >}}
|
||||
|
||||
{{< admonition failure >}}
|
||||
A **failure** banner
|
||||
{{< /admonition >}}
|
||||
|
||||
{{< admonition danger >}}
|
||||
A **danger** banner
|
||||
{{< /admonition >}}
|
||||
|
||||
{{< admonition bug >}}
|
||||
A **bug** banner
|
||||
{{< /admonition >}}
|
||||
|
||||
{{< admonition example >}}
|
||||
An **example** banner
|
||||
{{< /admonition >}}
|
||||
|
||||
{{< admonition quote >}}
|
||||
A **quote** banner
|
||||
{{< /admonition >}}
|
||||
|
||||
The `admonition` shortcode has the following named parameters:
|
||||
|
||||
* **type** *[optional]* (**first** positional parameter)
|
||||
|
||||
Type of the `admonition` banner, default value is `note`.
|
||||
|
||||
* **title** *[optional]* (**second** positional parameter)
|
||||
|
||||
Title of the `admonition` banner, default value is the value of **type** parameter. (markdown support) {{< version 0.2.14 changed >}}
|
||||
|
||||
* **open** *[optional]* (**third** positional parameter) {{< version 0.2.0 changed >}}
|
||||
|
||||
Whether the content will be expandable by default, default value is `true`.
|
||||
|
||||
Example `admonition` input:
|
||||
|
||||
```go-html-template
|
||||
{{</* admonition type=tip title="This is a tip" open=false */>}}
|
||||
A **tip** banner
|
||||
{{</* /admonition */>}}
|
||||
Or
|
||||
{{</* admonition tip "This is a tip" false */>}}
|
||||
A **tip** banner
|
||||
{{</* /admonition */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< admonition tip "This is a tip" false >}}
|
||||
A **tip** banner
|
||||
{{< /admonition >}}
|
||||
|
||||
## 5 mermaid
|
||||
|
||||
The `mermaid` shortcode supports diagrams in Hugo with [Mermaid](https://mermaidjs.github.io/) library.
|
||||
|
||||
The full documentation is provided in [Extended Shortcode - mermaid](../extended-shortcode-mermaid/).
|
||||
|
||||
## 6 echarts
|
||||
|
||||
The `echarts` shortcode supports data visualization in Hugo with [ECharts](https://echarts.apache.org/) library.
|
||||
|
||||
The full documentation is provided in [Extended Shortcode - echarts](../extended-shortcode-echarts/).
|
||||
|
||||
## 7 mapbox
|
||||
|
||||
The `mapbox` shortcode supports interactive maps in Hugo with [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js) library.
|
||||
|
||||
The full documentation is provided in [Extended Shortcode - mapbox](../extended-shortcode-mapbox/).
|
||||
|
||||
## 8 music
|
||||
|
||||
The `music` shortcode embeds a responsive music player based on [APlayer](https://github.com/MoePlayer/APlayer) and [MetingJS](https://github.com/metowolf/MetingJS) library.
|
||||
|
||||
The full documentation is provided in [Extended Shortcode - music](../extended-shortcode-music/).
|
||||
|
||||
## 9 bilibili
|
||||
|
||||
The `bilibili` shortcode embeds a responsive video player for bilibili videos.
|
||||
|
||||
The full documentation is provided in [Extended Shortcode - bilibili](../extended-shortcode-bilibili/).
|
||||
|
||||
## 10 typeit
|
||||
|
||||
The `typeit` shortcode provides typing animation based on [TypeIt](https://typeitjs.com/).
|
||||
|
||||
The full documentation is provided in [Extended Shortcode - typeit](../extended-shortcode-typeit/).
|
||||
|
||||
## 11 script
|
||||
|
||||
{{< version 0.2.8 >}}
|
||||
|
||||
`script` is a shortcode to insert custom **:(fa-brands fa-js fa-fw): Javascript** in your post.
|
||||
|
||||
{{< admonition >}}
|
||||
The script content can be guaranteed to be executed in order after all third-party libraries are loaded. So you are free to use third-party libraries.
|
||||
{{< /admonition >}}
|
||||
|
||||
Example `script` input:
|
||||
|
||||
```go-html-template
|
||||
{{</* script */>}}
|
||||
console.log('Hello FixIt!');
|
||||
{{</* /script */>}}
|
||||
```
|
||||
|
||||
You can see the output in the console of the developer tool.
|
||||
|
||||
{{< script >}}
|
||||
console.log('Hello FixIt!');
|
||||
{{< /script >}}
|
||||
|
||||
## 12 details
|
||||
|
||||
{{< version 0.2.13 >}} {{< version 0.2.14 changed >}}
|
||||
|
||||
`details` is a shortcode to insert **:(fa-brands fa-html5 fa-fw): HTML5 tag** details and summary in your post.
|
||||
|
||||
The `details` shortcode has only one parameter:
|
||||
|
||||
- **summary** *[optional]* (**first** positional parameter)
|
||||
|
||||
summary of details. (markdown support)
|
||||
|
||||
Example `details` input:
|
||||
|
||||
```go-html-template
|
||||
{{</* details "**Copyright** 2022." */>}}
|
||||
*All pages and graphics on this web site are the property of FixIt.*
|
||||
{{</* /details */>}}
|
||||
Or
|
||||
{{</* details summary="**Copyright** 2022." */>}}
|
||||
*All pages and graphics on this web site are the property of FixIt.*
|
||||
{{</* /details */>}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{< details "**Copyright** 2022." >}}
|
||||
*All pages and graphics on this web site are the property of FixIt.*
|
||||
{{< /details >}}
|
||||
|
||||
## 13 center-quote
|
||||
|
||||
{{< version 0.2.13 >}} {{< version 0.2.14 changed >}}
|
||||
|
||||
`center-quote` is a shortcode to insert centered text blockquote tag in your post.
|
||||
|
||||
Example `center-quote` input:
|
||||
|
||||
```go-html-template
|
||||
{{%/* center-quote */%}}
|
||||
**hello** *world*
|
||||
this is a center-quote shortcode example.
|
||||
{{%/* /center-quote */%}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{% center-quote %}}
|
||||
**hello** *world*
|
||||
this is a center-quote shortcode example.
|
||||
{{% /center-quote %}}
|
||||
|
||||
|
||||
## 14 fixit-encryptor
|
||||
|
||||
{{< version 0.2.15 >}}
|
||||
|
||||
You can use `fixit-encryptor` shortcode to encrypt partial content.
|
||||
|
||||
The full documentation is provided in [Theme Documentation - Content Encryption](../theme-documentation-content-encryption/#partial-encryption).
|
||||
|
||||
---
|
||||
|
||||
{{< admonition quote "Thanks" >}}
|
||||
_Thanks to the original author [Dillon](https://dillonzq.com) for preparing and revising the content before version `v0.2.10` in this documentation._
|
||||
{{< /admonition >}}
|
||||
@@ -1,445 +0,0 @@
|
||||
---
|
||||
weight: 4
|
||||
title: "主题文档 - 扩展 Shortcodes"
|
||||
date: 2021-12-19T16:15:22+08:00
|
||||
draft: false
|
||||
author: "Lruihao"
|
||||
authorLink: "https://lruihao.cn"
|
||||
description: "FixIt 主题在 Hugo 内置的 shortcode 的基础上提供多个扩展的 shortcode"
|
||||
resources:
|
||||
- name: "featured-image"
|
||||
src: "featured-image.jpg"
|
||||
- name: "featured-image-preview"
|
||||
src: "featured-image-preview.jpg"
|
||||
|
||||
tags: ["shortcodes"]
|
||||
categories: ["documentation"]
|
||||
|
||||
lightgallery: true
|
||||
|
||||
menu:
|
||||
main:
|
||||
title: "FixIt 主题在 Hugo 内置的 shortcode 的基础上提供多个扩展的 shortcode"
|
||||
parent: "documentation"
|
||||
pre: "<i class='fa-brands fa-readme fa-fw fa-sm'></i>"
|
||||
---
|
||||
|
||||
**FixIt** 主题在 Hugo 内置的 shortcode 的基础上提供多个扩展的 shortcode.
|
||||
|
||||
<!--more-->
|
||||
|
||||
## 1 style
|
||||
|
||||
{{< version 0.2.0 changed >}}
|
||||
|
||||
{{< admonition >}}
|
||||
Hugo **extended** 版本对于 `style` shortcode 是必需的。
|
||||
{{< /admonition >}}
|
||||
|
||||
`style` shortcode 用来在你的文章中插入自定义样式。
|
||||
|
||||
`style` shortcode 有两个位置参数。
|
||||
|
||||
第一个参数是自定义样式的内容。它支持 [:(fa-brands fa-sass fa-fw): SASS](https://sass-lang.com/documentation/style-rules/declarations#nesting) 中的嵌套语法,
|
||||
并且 `&` 指代这个父元素。
|
||||
|
||||
第二个参数是包裹你要更改样式的内容的 HTML 标签,默认值是 `div`。
|
||||
|
||||
一个 `style` 示例:
|
||||
|
||||
```go-html-template
|
||||
{{</* style "text-align:right; strong{color:#00b1ff;}" */>}}
|
||||
This is a **right-aligned** paragraph.
|
||||
{{</* /style */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< style "text-align:right; strong{color:#00b1ff;}" >}}
|
||||
This is a **right-aligned** paragraph.
|
||||
{{< /style >}}
|
||||
|
||||
## 2 link
|
||||
|
||||
{{< version 0.2.0 >}}
|
||||
|
||||
`link` shortcode 是 [Markdown 链接语法](../basic-markdown-syntax#links) 的替代。
|
||||
`link` shortcode 可以提供一些其它的功能并且可以在代码块中使用。
|
||||
|
||||
{{< version 0.2.10 >}} 支持 [本地资源引用](../theme-documentation-content#contents-organization) 的完整用法。
|
||||
|
||||
`link` shortcode 有以下命名参数:
|
||||
|
||||
* **href** *[必需]*(**第一个**位置参数)
|
||||
|
||||
链接的目标。
|
||||
|
||||
* **content** *[可选]*(**第二个**位置参数)
|
||||
|
||||
链接的内容,默认值是 **href** 参数的值。
|
||||
|
||||
*支持 Markdown 或者 HTML 格式。*
|
||||
|
||||
* **title** *[可选]*(**第三个**位置参数)
|
||||
|
||||
HTML `a` 标签 的 `title` 属性,当悬停在链接上会显示的提示。
|
||||
|
||||
* **card** *[可选]*(**第四个**位置参数){{< version 0.2.12 >}}
|
||||
|
||||
是否显示为卡片式链接,默认值 `false`。
|
||||
|
||||
* **download** *[可选]* {{< version 0.2.12 >}}
|
||||
|
||||
HTML `a` 标签 的 `download` 属性。
|
||||
|
||||
* **class** *[可选]*
|
||||
|
||||
HTML `a` 标签 的 `class` 属性。
|
||||
|
||||
* **rel** *[可选]*
|
||||
|
||||
HTML `a` 标签 的 `rel` 补充属性。
|
||||
|
||||
* **external-icon** *[可选]* {{< version 0.2.14 >}}
|
||||
|
||||
是否自动显示外链图标
|
||||
|
||||
一个 `link` 示例:
|
||||
|
||||
```go-html-template
|
||||
{{</* link "https://assemble.io" */>}}
|
||||
或者
|
||||
{{</* link href="https://assemble.io" */>}}
|
||||
|
||||
{{</* link "mailto:contact@revolunet.com" */>}}
|
||||
或者
|
||||
{{</* link href="mailto:contact@revolunet.com" */>}}
|
||||
|
||||
{{</* link "https://assemble.io" Assemble */>}}
|
||||
或者
|
||||
{{</* link href="https://assemble.io" content=Assemble */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
* {{< link "https://assemble.io" >}}
|
||||
* {{< link "mailto:contact@revolunet.com" >}}
|
||||
* {{< link "https://assemble.io" Assemble >}}
|
||||
|
||||
一个带有标题的 `link` 示例:
|
||||
|
||||
```go-html-template
|
||||
{{</* link "https://github.com/upstage/" Upstage "Visit Upstage!" */>}}
|
||||
或者
|
||||
{{</* link href="https://github.com/upstage/" content=Upstage title="Visit Upstage!" */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下 (将鼠标悬停在链接上,会有一行提示):
|
||||
|
||||
{{< link "https://github.com/upstage/" Upstage "Visit Upstage!" >}}
|
||||
|
||||
一个卡片式 `link` 示例:
|
||||
|
||||
```go-html-template
|
||||
{{</* link "https://github.com/Lruihao/FixIt" "FixIt Theme" "source of FixIt Theme" true */>}}
|
||||
或者
|
||||
{{</* link href="https://github.com/Lruihao/FixIt" content="FixIt Theme" title="source of FixIt Theme" card=true */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< link "https://github.com/Lruihao/FixIt" "FixIt Theme" "source of FixIt Theme" true >}}
|
||||
|
||||
一个可下载的 `link` 示例:
|
||||
|
||||
```go-html-template
|
||||
{{</* link href="/music/Wavelength.mp3" content="Wavelength" title="Download Wavelength.mp3" download="Wavelength.mp3" */>}}
|
||||
|
||||
{{</* link href="/music/Wavelength.mp3" content="Wavelength.mp3" title="Download Wavelength.mp3" download="Wavelength.mp3" card=true */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< link href="/music/Wavelength.mp3" content="Wavelength.mp3" title="Download Wavelength.mp3" download="Wavelength.mp3" >}}
|
||||
|
||||
{{< link href="/music/Wavelength.mp3" content="Wavelength.mp3" title="Download Wavelength.mp3" download="Wavelength.mp3" card=true >}}
|
||||
|
||||
## 3 image {#image}
|
||||
|
||||
{{< version 0.2.0 changed >}}
|
||||
|
||||
`image` shortcode 是 [`figure` shortcode](../theme-documentation-built-in-shortcodes#figure) 的替代。`image` shortcode 可以充分利用 [lazysizes](https://github.com/aFarkas/lazysizes) 和 [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js) 两个依赖库。
|
||||
|
||||
{{< version 0.2.10 >}} 支持 [本地资源引用](../theme-documentation-content#contents-organization) 的完整用法。
|
||||
|
||||
`image` shortcode 有以下命名参数:
|
||||
|
||||
* **src** *[必需]*(**第一个**位置参数)
|
||||
|
||||
图片的 URL.
|
||||
|
||||
* **alt** *[可选]*(**第二个**位置参数)
|
||||
|
||||
图片无法显示时的替代文本,默认值是 **src** 参数的值。
|
||||
|
||||
*支持 Markdown 或者 HTML 格式。*
|
||||
|
||||
* **caption** *[可选]*(**第三个**位置参数)
|
||||
|
||||
图片标题。
|
||||
|
||||
*支持 Markdown 或者 HTML 格式。*
|
||||
|
||||
* **title** *[可选]*
|
||||
|
||||
当悬停在图片上会显示的提示。
|
||||
|
||||
* **class** *[可选]*
|
||||
|
||||
HTML `figure` 标签的 `class` 属性。
|
||||
|
||||
* **src_s** *[可选]*
|
||||
|
||||
图片缩略图的 URL, 用在画廊模式中,默认值是 **src** 参数的值。
|
||||
|
||||
* **src_l** *[可选]*
|
||||
|
||||
高清图片的 URL, 用在画廊模式中,默认值是 **src** 参数的值。
|
||||
|
||||
* **height** *[可选]*
|
||||
|
||||
图片的 `height` 属性。
|
||||
|
||||
* **width** *[可选]*
|
||||
|
||||
图片的 `width` 属性。
|
||||
|
||||
* **linked** *[可选]*
|
||||
|
||||
图片是否需要被链接,默认值是 `true`。
|
||||
|
||||
* **rel** *[可选]*
|
||||
|
||||
HTML `a` 标签 的 `rel` 补充属性,仅在 **linked** 属性设置成 `true` 时有效。
|
||||
|
||||
一个 `image` 示例:
|
||||
|
||||
```go-html-template
|
||||
{{</* image src="/images/lighthouse.jpg" caption="Lighthouse (`image`)" src_s="/images/lighthouse-small.jpg" src_l="/images/lighthouse-large.jpg" */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< image src="/images/lighthouse.jpg" caption="Lighthouse (`image`)" src_s="/images/lighthouse-small.jpg" src_l="/images/lighthouse-large.jpg" >}}
|
||||
|
||||
## 4 admonition
|
||||
|
||||
`admonition` shortcode 支持 **12** 种 帮助你在页面中插入提示的横幅。
|
||||
|
||||
*支持 Markdown 或者 HTML 格式。*
|
||||
|
||||
{{< admonition >}}
|
||||
一个 **注意** 横幅
|
||||
{{< /admonition >}}
|
||||
|
||||
{{< admonition abstract >}}
|
||||
一个 **摘要** 横幅
|
||||
{{< /admonition >}}
|
||||
|
||||
{{< admonition info >}}
|
||||
一个 **信息** 横幅
|
||||
{{< /admonition >}}
|
||||
|
||||
{{< admonition tip >}}
|
||||
一个 **技巧** 横幅
|
||||
{{< /admonition >}}
|
||||
|
||||
{{< admonition success >}}
|
||||
一个 **成功** 横幅
|
||||
{{< /admonition >}}
|
||||
|
||||
{{< admonition question >}}
|
||||
一个 **问题** 横幅
|
||||
{{< /admonition >}}
|
||||
|
||||
{{< admonition warning >}}
|
||||
一个 **警告** 横幅
|
||||
{{< /admonition >}}
|
||||
|
||||
{{< admonition failure >}}
|
||||
一个 **失败** 横幅
|
||||
{{< /admonition >}}
|
||||
|
||||
{{< admonition danger >}}
|
||||
一个 **危险** 横幅
|
||||
{{< /admonition >}}
|
||||
|
||||
{{< admonition bug >}}
|
||||
一个 **Bug** 横幅
|
||||
{{< /admonition >}}
|
||||
|
||||
{{< admonition example >}}
|
||||
一个 **示例** 横幅
|
||||
{{< /admonition >}}
|
||||
|
||||
{{< admonition quote >}}
|
||||
一个 **引用** 横幅
|
||||
{{< /admonition >}}
|
||||
|
||||
`admonition` shortcode 有以下命名参数:
|
||||
|
||||
* **type** *[必需]*(**第一个**位置参数)
|
||||
|
||||
`admonition` 横幅的类型,默认值是 `note`。
|
||||
|
||||
* **title** *[可选]*(**第二个**位置参数)
|
||||
|
||||
`admonition` 横幅的标题,默认值是 **type** 参数的值。(支持 markdown){{< version 0.2.14 changed >}}
|
||||
|
||||
* **open** *[可选]*(**第三个**位置参数) {{< version 0.2.0 changed >}}
|
||||
|
||||
横幅内容是否默认展开,默认值是 `true`。
|
||||
|
||||
一个 `admonition` 示例:
|
||||
|
||||
```go-html-template
|
||||
{{</* admonition type=tip title="This is a tip" open=false */>}}
|
||||
一个 **技巧** 横幅
|
||||
{{</* /admonition */>}}
|
||||
或者
|
||||
{{</* admonition tip "This is a tip" false */>}}
|
||||
一个 **技巧** 横幅
|
||||
{{</* /admonition */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< admonition tip "This is a tip" false >}}
|
||||
一个 **技巧** 横幅
|
||||
{{< /admonition >}}
|
||||
|
||||
## 5 mermaid
|
||||
|
||||
`mermaid` shortcode 使用 [Mermaid](https://mermaidjs.github.io/) 库提供绘制图表和流程图的功能。
|
||||
|
||||
完整文档请查看页面 [扩展 Shortcode - mermaid](../extended-shortcode-mermaid/)。
|
||||
|
||||
## 6 echarts
|
||||
|
||||
`echarts` shortcode 使用 [ECharts](https://echarts.apache.org/) 库提供数据可视化的功能。
|
||||
|
||||
完整文档请查看页面 [扩展 Shortcode - echarts](../extended-shortcode-echarts/)。
|
||||
|
||||
## 7 mapbox
|
||||
|
||||
`mapbox` shortcode 使用 [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js) 库提供互动式地图的功能。
|
||||
|
||||
完整文档请查看页面 [扩展 Shortcode - mapbox](../extended-shortcode-mapbox/)。
|
||||
|
||||
## 8 music
|
||||
|
||||
`music` shortcode 基于 [APlayer](https://github.com/MoePlayer/APlayer) 和 [MetingJS](https://github.com/metowolf/MetingJS) 库提供了一个内嵌的响应式音乐播放器。
|
||||
|
||||
完整文档请查看页面 [扩展 Shortcode - music](../extended-shortcode-music/)。
|
||||
|
||||
## 9 bilibili
|
||||
|
||||
`bilibili` shortcode 提供了一个内嵌的用来播放 bilibili 视频的响应式播放器。
|
||||
|
||||
完整文档请查看页面 [扩展 Shortcode - bilibili](../extended-shortcode-bilibili/)。
|
||||
|
||||
## 10 typeit
|
||||
|
||||
`typeit` shortcode 基于 [TypeIt](https://typeitjs.com/) 提供了打字动画。
|
||||
|
||||
完整文档请查看页面 [扩展 Shortcode - typeit](../extended-shortcode-typeit/)。
|
||||
|
||||
## 11 script
|
||||
|
||||
{{< version 0.2.8 >}}
|
||||
|
||||
`script` shortcode 用来在你的文章中插入 **:(fa-brands fa-js fa-fw): Javascript** 脚本。
|
||||
|
||||
{{< admonition >}}
|
||||
脚本内容可以保证在所有的第三方库加载之后按顺序执行。
|
||||
所以你可以自由地使用第三方库。
|
||||
{{< /admonition >}}
|
||||
|
||||
一个 `script` 示例:
|
||||
|
||||
```go-html-template
|
||||
{{</* script */>}}
|
||||
console.log('Hello FixIt!');
|
||||
{{</* /script */>}}
|
||||
```
|
||||
|
||||
你可以在开发者工具的控制台中看到输出。
|
||||
|
||||
{{< script >}}
|
||||
console.log('Hello FixIt!');
|
||||
{{< /script >}}
|
||||
|
||||
## 12 details
|
||||
|
||||
{{< version 0.2.13 >}} {{< version 0.2.14 changed >}}
|
||||
|
||||
`details` shortcode 用来在你的文章中插入 **:(fa-brands fa-html5 fa-fw): HTML5 标签** details 和 summary。
|
||||
|
||||
`details` shortcode 只有一个参数:
|
||||
- **summary** *[可选]* (**第一个**位置参数)
|
||||
|
||||
summary 标签的内容(支持 markdown)
|
||||
|
||||
一个 `details` 示例:
|
||||
|
||||
```go-html-template
|
||||
{{</* details "**Copyright** 2022." */>}}
|
||||
*All pages and graphics on this web site are the property of FixIt.*
|
||||
{{</* /details */>}}
|
||||
或者
|
||||
{{</* details summary="**Copyright** 2022." */>}}
|
||||
*All pages and graphics on this web site are the property of FixIt.*
|
||||
{{</* /details */>}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{< details "**Copyright** 2022." >}}
|
||||
*All pages and graphics on this web site are the property of FixIt.*
|
||||
{{< /details >}}
|
||||
|
||||
## 13 center-quote
|
||||
|
||||
{{< version 0.2.13 >}} {{< version 0.2.14 changed >}}
|
||||
|
||||
`center-quote` shortcode 用来在你的文章中插入文本居中的 blockquote 标签。
|
||||
|
||||
一个 `center-quote` 示例:
|
||||
|
||||
```go-html-template
|
||||
{{%/* center-quote */%}}
|
||||
**hello** *world*
|
||||
this is a center-quote shortcode example.
|
||||
{{%/* /center-quote */%}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{% center-quote %}}
|
||||
**hello** *world*
|
||||
this is a center-quote shortcode example.
|
||||
{{% /center-quote %}}
|
||||
|
||||
## 14 fixit-encryptor
|
||||
|
||||
{{< version 0.2.15 >}}
|
||||
|
||||
您可以使用 `fixit-encryptor` shortcode 来加密部分内容。
|
||||
|
||||
完整文档请查看页面 [主题文档 - 内容加密](../theme-documentation-content-encryption/#partial-encryption)。
|
||||
|
||||
---
|
||||
|
||||
{{< admonition quote "感谢" >}}
|
||||
_本文档中 `v0.2.10` 版本之前的内容,感谢原作者 [Dillon](https://dillonzq.com) 编写修订。_
|
||||
{{< /admonition >}}
|
||||
@@ -1,3 +0,0 @@
|
||||
---
|
||||
title: "配置"
|
||||
---
|
||||
@@ -1,3 +0,0 @@
|
||||
---
|
||||
title: "内容"
|
||||
---
|
||||
@@ -1,3 +0,0 @@
|
||||
---
|
||||
title: "加密"
|
||||
---
|
||||
@@ -1,3 +0,0 @@
|
||||
---
|
||||
title: "安装"
|
||||
---
|
||||
@@ -1,3 +0,0 @@
|
||||
---
|
||||
title: "打印"
|
||||
---
|
||||
@@ -1,3 +0,0 @@
|
||||
---
|
||||
title: "测试"
|
||||
---
|
||||
@@ -1,3 +0,0 @@
|
||||
---
|
||||
title: Tests
|
||||
---
|
||||
@@ -1,3 +0,0 @@
|
||||
---
|
||||
title: 测试
|
||||
---
|
||||
@@ -1,275 +0,0 @@
|
||||
---
|
||||
title: "Encrypt Test"
|
||||
date: 2022-05-21T22:31:22+08:00
|
||||
description: "Test for encrypting content"
|
||||
type: 'posts'
|
||||
draft: true
|
||||
password: 1212
|
||||
message: Password is 1212
|
||||
|
||||
lightgallery: true
|
||||
|
||||
math:
|
||||
enable: true
|
||||
|
||||
twemoji: true
|
||||
|
||||
tags:
|
||||
- Test
|
||||
- Encryption
|
||||
categories:
|
||||
- Test
|
||||
|
||||
hiddenFromHomePage: true
|
||||
|
||||
menu:
|
||||
main:
|
||||
title: "Test for encrypting content"
|
||||
parent: "tests"
|
||||
pre: "<i class='fa-solid fa-vial fa-fw fa-sm'></i>"
|
||||
---
|
||||
|
||||
I was shy, so I hid.
|
||||
|
||||
<!--more-->
|
||||
|
||||

|
||||
|
||||
## Encrypted Content
|
||||
|
||||
### twemoji
|
||||
|
||||
Coffee ☕
|
||||
|
||||
Gone camping! :tent: Be back soon.
|
||||
|
||||
That is so funny! :joy:
|
||||
|
||||
### ruby
|
||||
[Hugo]^(An open-source static site generator)
|
||||
|
||||
### math
|
||||
$$ \ce{CO2 + C -> 2 CO} $$
|
||||
|
||||
$$ \ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-} $$
|
||||
|
||||
## Shortcodes in Encrypted Content
|
||||
|
||||
### 1 style
|
||||
|
||||
{{< style "text-align:right; strong{color:#00b1ff;}" >}}
|
||||
This is a **right-aligned** paragraph.
|
||||
{{< /style >}}
|
||||
|
||||
### 2 link
|
||||
|
||||
{{< link "https://github.com/upstage/" Upstage "Visit Upstage!" >}}
|
||||
|
||||
{{< link "https://github.com/Lruihao/FixIt" "FixIt Theme" "source of FixIt Theme" true >}}
|
||||
|
||||
{{< link href="/music/Wavelength.mp3" content="Wavelength.mp3" title="Download Wavelength.mp3" download="Wavelength.mp3" >}}
|
||||
|
||||
{{< link href="/music/Wavelength.mp3" content="Wavelength.mp3" title="Download Wavelength.mp3" download="Wavelength.mp3" card=true >}}
|
||||
|
||||
### 3 image
|
||||
|
||||
{{< image src="/images/lighthouse.jpg" caption="Lighthouse (`image`)" src_s="/images/lighthouse-small.jpg" src_l="/images/lighthouse-large.jpg" >}}
|
||||
|
||||
### 4 admonition
|
||||
|
||||
{{< admonition tip "This is a tip" false >}}
|
||||
A **tip** banner
|
||||
{{< /admonition >}}
|
||||
|
||||
### 5 mermaid
|
||||
|
||||
{{< mermaid >}}
|
||||
graph LR;
|
||||
A[Hard edge] -->|Link text| B(Round edge)
|
||||
B --> C{Decision}
|
||||
C -->|One| D[Result one]
|
||||
C -->|Two| E[Result two]
|
||||
{{< /mermaid >}}
|
||||
|
||||
### 6 echarts
|
||||
|
||||
{{< echarts >}}
|
||||
title:
|
||||
text: Summary Line Chart
|
||||
top: 2%
|
||||
left: center
|
||||
tooltip:
|
||||
trigger: axis
|
||||
legend:
|
||||
data:
|
||||
- Email Marketing
|
||||
- Affiliate Advertising
|
||||
- Video Advertising
|
||||
- Direct View
|
||||
- Search Engine
|
||||
top: 10%
|
||||
grid:
|
||||
left: 5%
|
||||
right: 5%
|
||||
bottom: 5%
|
||||
top: 20%
|
||||
containLabel: true
|
||||
toolbox:
|
||||
feature:
|
||||
saveAsImage:
|
||||
title: Save as Image
|
||||
xAxis:
|
||||
type: category
|
||||
boundaryGap: false
|
||||
data:
|
||||
- Monday
|
||||
- Tuesday
|
||||
- Wednesday
|
||||
- Thursday
|
||||
- Friday
|
||||
- Saturday
|
||||
- Sunday
|
||||
yAxis:
|
||||
type: value
|
||||
series:
|
||||
- name: Email Marketing
|
||||
type: line
|
||||
stack: Total
|
||||
data:
|
||||
- 120
|
||||
- 132
|
||||
- 101
|
||||
- 134
|
||||
- 90
|
||||
- 230
|
||||
- 210
|
||||
- name: Affiliate Advertising
|
||||
type: line
|
||||
stack: Total
|
||||
data:
|
||||
- 220
|
||||
- 182
|
||||
- 191
|
||||
- 234
|
||||
- 290
|
||||
- 330
|
||||
- 310
|
||||
- name: Video Advertising
|
||||
type: line
|
||||
stack: Total
|
||||
data:
|
||||
- 150
|
||||
- 232
|
||||
- 201
|
||||
- 154
|
||||
- 190
|
||||
- 330
|
||||
- 410
|
||||
- name: Direct View
|
||||
type: line
|
||||
stack: Total
|
||||
data:
|
||||
- 320
|
||||
- 332
|
||||
- 301
|
||||
- 334
|
||||
- 390
|
||||
- 330
|
||||
- 320
|
||||
- name: Search Engine
|
||||
type: line
|
||||
stack: Total
|
||||
data:
|
||||
- 820
|
||||
- 932
|
||||
- 901
|
||||
- 934
|
||||
- 1290
|
||||
- 1330
|
||||
- 1320
|
||||
{{< /echarts >}}
|
||||
|
||||
### 7 mapbox
|
||||
|
||||
{{< mapbox 113.953277 22.559102 11 >}}
|
||||
|
||||
### 8 music
|
||||
|
||||
{{< music url="/music/Wavelength.mp3" name=Wavelength artist=oldmanyoung cover="/images/Wavelength.jpg" >}}
|
||||
|
||||
### 9 bilibili
|
||||
|
||||
{{< bilibili BV1Sx411T7QQ >}}
|
||||
|
||||
### 10 typeit
|
||||
|
||||
{{< typeit code=javascript >}}
|
||||
console.log('before decrypting');
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
fixit.decryptor.addEventListener('decrypted', function() {
|
||||
console.log('after decrypting')
|
||||
})
|
||||
});
|
||||
{{< /typeit >}}
|
||||
|
||||
### 11 script
|
||||
|
||||
```go-html-template
|
||||
{{</* script */>}}
|
||||
console.log('before decrypting');
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
fixit.theme.decryptor.addEventListener('decrypted', function() {
|
||||
console.log('after decrypting')
|
||||
})
|
||||
});
|
||||
{{</* /script */>}}
|
||||
```
|
||||
|
||||
You can see the output in the console of the developer tool.
|
||||
|
||||
{{< script >}}
|
||||
console.log('before decrypting');
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
fixit.decryptor.addEventListener('decrypted', function() {
|
||||
console.log('after decrypting')
|
||||
})
|
||||
});
|
||||
{{< /script >}}
|
||||
|
||||
### 12 details
|
||||
|
||||
{{< details "**Copyright** 2022." >}}
|
||||
*All pages and graphics on this web site are the property of FixIt.*
|
||||
{{< /details >}}
|
||||
|
||||
### 13 center-quote
|
||||
|
||||
{{% center-quote %}}
|
||||
**hello** *world*
|
||||
this is a center-quote shortcode example.
|
||||
{{% /center-quote %}}
|
||||
|
||||
|
||||
### fixit-encryptor
|
||||
|
||||
All the following shortcodes passwords are `1212`.
|
||||
|
||||
{{% fixit-encryptor "1212" %}}
|
||||
This is a `fixit-encryptor` shortcode example.
|
||||
{{% /fixit-encryptor %}}
|
||||
|
||||
{{% fixit-encryptor "1212" %}}
|
||||
|
||||
**hello**
|
||||
{{% fixit-encryptor "1212" %}}
|
||||
*world*
|
||||
|
||||
{{< admonition >}}
|
||||
The `fixit-encryptor` shortcode was supported in version {{</* version 0.2.15 */>}}.
|
||||
{{< /admonition >}}
|
||||
{{% /fixit-encryptor %}}
|
||||
|
||||
{{% /fixit-encryptor %}}
|
||||
@@ -1,54 +0,0 @@
|
||||
---
|
||||
title: "文章加密测试"
|
||||
date: 2022-05-28T00:24:22+08:00
|
||||
description: "文章加密测试"
|
||||
type: 'posts'
|
||||
draft: true
|
||||
password: 1212
|
||||
message: 密码是 1212
|
||||
|
||||
lightgallery: true
|
||||
|
||||
math:
|
||||
enable: true
|
||||
|
||||
tags:
|
||||
- Test
|
||||
- Encryption
|
||||
categories:
|
||||
- Test
|
||||
|
||||
hiddenFromHomePage: true
|
||||
|
||||
menu:
|
||||
main:
|
||||
title: "文章加密测试"
|
||||
parent: "tests"
|
||||
pre: "<i class='fa-solid fa-vial fa-fw fa-sm'></i>"
|
||||
---
|
||||
|
||||
我很害羞,所以我藏起来了哈哈。
|
||||
|
||||
<!--more-->
|
||||
|
||||
## 内容加密解密测试
|
||||
|
||||
### emoji
|
||||
|
||||
咖啡 ☕
|
||||
|
||||
去露营啦!:tent: 很快就回来。
|
||||
|
||||
真开心!:joy:
|
||||
|
||||
### 盘古之白(中文排版)
|
||||
|
||||
```
|
||||
當你凝視著bug,bug也凝視著你
|
||||
|
||||
不能信任那些Terminal或Editor用白底的人
|
||||
```
|
||||
|
||||
當你凝視著bug,bug也凝視著你
|
||||
|
||||
不能信任那些Terminal或Editor用白底的人
|
||||
@@ -1,87 +0,0 @@
|
||||
---
|
||||
title: "Font Awesome Test"
|
||||
date: 2022-04-19T10:15:22+08:00
|
||||
description: "Test for rendering Font Awesome icons"
|
||||
type: 'posts'
|
||||
draft: true
|
||||
|
||||
tags:
|
||||
- Test
|
||||
- content
|
||||
- Font Awesome
|
||||
categories:
|
||||
- Test
|
||||
|
||||
hiddenFromHomePage: true
|
||||
|
||||
menu:
|
||||
main:
|
||||
title: "Test for rendering Font Awesome icons"
|
||||
parent: "tests"
|
||||
pre: "<i class='fa-solid fa-vial fa-fw fa-sm'></i>"
|
||||
---
|
||||
|
||||
## Size
|
||||
|
||||
:(fa-solid fa-camera fa-xs):
|
||||
:(fa-solid fa-camera fa-sm):
|
||||
:(fa-solid fa-camera fa-lg):
|
||||
:(fa-solid fa-camera fa-2x):
|
||||
:(fa-solid fa-camera fa-3x):
|
||||
:(fa-solid fa-camera fa-5x):
|
||||
:(fa-solid fa-camera fa-7x):
|
||||
:(fa-solid fa-camera fa-10x):
|
||||
|
||||
## Fixed width
|
||||
|
||||
:(fa-solid fa-skating fa-fw fa-2x): Skating
|
||||
:(fa-solid fa-skiing fa-fw fa-2x): Skiing
|
||||
:(fa-solid fa-skiing-nordic fa-fw fa-2x): Nordic Skiing
|
||||
|
||||
## List icon
|
||||
|
||||
:(fa-regular fa-check-square): Eat a hamburger
|
||||
:(fa-regular fa-square): Get a girlfriend
|
||||
|
||||
:(fa-regular fa-check-circle): Go to beach
|
||||
:(fa-regular fa-circle): Go to Tibet
|
||||
|
||||
## Rotate
|
||||
|
||||
:(fa-solid fa-snowboarding):
|
||||
:(fa-solid fa-snowboarding fa-rotate-90):
|
||||
:(fa-solid fa-snowboarding fa-rotate-180):
|
||||
:(fa-solid fa-snowboarding fa-rotate-270):
|
||||
|
||||
## Flip
|
||||
|
||||
:(fa-solid fa-snowboarding):
|
||||
:(fa-solid fa-snowboarding fa-flip-horizontal):
|
||||
:(fa-solid fa-snowboarding fa-flip-vertical):
|
||||
:(fa-solid fa-snowboarding fa-flip-both):
|
||||
|
||||
|
||||
## Animation
|
||||
|
||||
:(fa-solid fa-spinner):
|
||||
:(fa-solid fa-spinner fa-spin):
|
||||
:(fa-solid fa-spinner fa-pulse):
|
||||
:(fa-solid fa-circle-notch fa-spin):
|
||||
:(fa-solid fa-circle-notch fa-pulse):
|
||||
:(fa-solid fa-sync fa-spin):
|
||||
:(fa-solid fa-sync fa-pulse):
|
||||
:(fa-solid fa-cog fa-spin):
|
||||
:(fa-solid fa-cog fa-pulse):
|
||||
|
||||
|
||||
## Float
|
||||
|
||||
:(fa-solid fa-quote-left fa-pull-left):
|
||||
|
||||
<div class="text-center">hey guys!</div>
|
||||
|
||||
:(fa-solid fa-quote-right fa-pull-right):
|
||||
|
||||
## Border
|
||||
|
||||
:(fa-brands fa-apple fa-border fa-fw fa-10x):
|
||||
@@ -1,179 +0,0 @@
|
||||
---
|
||||
title: "Highlight Test"
|
||||
date: 2022-02-27T18:45:22+08:00
|
||||
description: "Test for code highlight feature"
|
||||
type: 'posts'
|
||||
draft: true
|
||||
|
||||
tags:
|
||||
- Test
|
||||
- content
|
||||
- highlight
|
||||
categories:
|
||||
- Test
|
||||
|
||||
hiddenFromHomePage: true
|
||||
|
||||
menu:
|
||||
main:
|
||||
title: "Test for code highlight feature"
|
||||
parent: "tests"
|
||||
pre: "<i class='fa-solid fa-vial fa-fw fa-sm'></i>"
|
||||
---
|
||||
|
||||
`inline code`
|
||||
```markdown
|
||||
1. first
|
||||
2. second
|
||||
|
||||
> bq
|
||||
|
||||
**blod** *italic*
|
||||
|
||||
---
|
||||
+++
|
||||
***
|
||||
```
|
||||
|
||||
```java
|
||||
/**
|
||||
* @author John Smith <john.smith@example.com>
|
||||
*/
|
||||
package l2f.gameserver.model;
|
||||
|
||||
public abstract strictfp class L2Char extends L2Object {
|
||||
public static final Short ERROR = 0x0001;
|
||||
|
||||
public void moveTo(int x, int y, int z) {
|
||||
_ai = null;
|
||||
log("Should not be called");
|
||||
if (1 > 5) { // wtf!?
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
ch := make(chan float64)
|
||||
ch <- 1.0e10 // magic number
|
||||
x, ok := <- ch
|
||||
defer fmt.Println(`exitting now\`)
|
||||
go println(len("hello world!"))
|
||||
return
|
||||
}
|
||||
```
|
||||
|
||||
```scss
|
||||
pre {
|
||||
margin: 0;
|
||||
padding: .25rem 0 .25rem .5rem;
|
||||
overflow: auto;
|
||||
@include tab-size(4);
|
||||
|
||||
background: $code-background-color;
|
||||
|
||||
[theme=dark] & {
|
||||
background: $code-background-color-dark;
|
||||
}
|
||||
|
||||
code {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
img {
|
||||
min-height: 1em;
|
||||
max-height: 1.2em;
|
||||
vertical-align: text-bottom;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```diff
|
||||
- theme = "LoveIt"
|
||||
+ theme = "FixIt"
|
||||
! enhancements and fixes
|
||||
```
|
||||
|
||||
```javascript
|
||||
function $initHighlight(block, cls) {
|
||||
try {
|
||||
if (cls.search(/\bno\-highlight\b/) != -1)
|
||||
return process(block, true, 0x0F) +
|
||||
` class="${cls}"`;
|
||||
} catch (e) {
|
||||
/* handle exception */
|
||||
}
|
||||
for (var i = 0 / 2; i < classes.length; i++) {
|
||||
if (checkCondition(classes[i]) === undefined)
|
||||
console.log('undefined');
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<web-component>{block}</web-component>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export $initHighlight;
|
||||
```
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<title>Title</title>
|
||||
|
||||
<style>body {width: 500px;}</style>
|
||||
|
||||
<script type="application/javascript">
|
||||
function $init() {return true;}
|
||||
</script>
|
||||
|
||||
<body>
|
||||
<p checked class="title" id='title'>Title</p>
|
||||
<!-- here goes the rest of the page -->
|
||||
</body>
|
||||
```
|
||||
|
||||
```yaml
|
||||
# - nickname: 标题
|
||||
# avatar: 头像
|
||||
# url: 站点
|
||||
# description: 描述
|
||||
- nickname: Lruihao
|
||||
avatar: https://gravatar.loli.net/avatar/3f985efb5907ca52944a3cd7edd51606?d=wavatar&v=1.3.10
|
||||
url: https://lruihao.cn
|
||||
description: 不怕萬人阻擋,只怕自己投降
|
||||
```
|
||||
|
||||
```html
|
||||
<p>Lorem ipsum dolor sit amet, graecis denique ei vel, at duo primis mandamus. Et legere ocurreret pri, animal tacimates complectitur ad cum. Cu eum inermis inimicus efficiendi. Labore officiis his ex, soluta officiis concludaturque ei qui, vide sensibus vim ad.</p>
|
||||
```
|
||||
|
||||
<p>Lorem ipsum dolor sit amet, graecis denique ei vel, at duo primis mandamus. Et legere ocurreret pri, animal tacimates complectitur ad cum. Cu eum inermis inimicus efficiendi. Labore officiis his ex, soluta officiis concludaturque ei qui, vide sensibus vim ad.</p>
|
||||
|
||||
{{< highlight javascript "linenos=table,hl_lines=6-9,linenostart=287" >}}
|
||||
/**
|
||||
* 把字符串的文件後綴轉成數組
|
||||
* @param {String} str 待轉化字符串
|
||||
* @returns {Array|null} 轉化后的數組
|
||||
*/
|
||||
var _str2Array = (str) => {
|
||||
if (typeof (str) !== String && !Array.isArray(str)) {
|
||||
return null;
|
||||
}
|
||||
if (!Array.isArray(str)) {
|
||||
return str.split(',');
|
||||
}
|
||||
};
|
||||
{{< /highlight >}}
|
||||
|
||||
---
|
||||
|
||||
{{< gist spf13 7896402 >}}
|
||||
@@ -1,51 +0,0 @@
|
||||
---
|
||||
title: "Markdown 测试"
|
||||
date: 2022-04-20T17:50:22+08:00
|
||||
description: "Test for Markdown rendering"
|
||||
type: 'posts'
|
||||
draft: true
|
||||
|
||||
tags:
|
||||
- Test
|
||||
- content
|
||||
- Markdown
|
||||
categories:
|
||||
- Test
|
||||
|
||||
hiddenFromHomePage: true
|
||||
|
||||
menu:
|
||||
main:
|
||||
title: "Test for Markdown rendering"
|
||||
parent: "tests"
|
||||
pre: "<i class='fa-solid fa-vial fa-fw fa-sm'></i>"
|
||||
---
|
||||
|
||||
## line break
|
||||
`FixIt is a clean, elegant but advanced blog theme for Hugo developed by Lruihao. It is based on the original LoveIt Theme, LeaveIt Theme and KeepIt Theme.`
|
||||
|
||||
`FixIt 是一个由 Lruihao 开发的简洁、优雅且高效的 Hugo 博客主题。它的原型基于 LoveIt 主题,LeaveIt 主题 和 KeepIt 主题。`
|
||||
|
||||
## table
|
||||
|
||||
| 表达式 | 说明 |
|
||||
| :----------------------- | :------------------------------------------------------------ |
|
||||
| `0 0/5 * * * ?` | 每隔 5 分钟执行一次 |
|
||||
| `10 0/5 * * * ?` | 每隔 5 分钟执行一次,每次执行都在分钟开始的 10 秒,例如 10:00:10、10:05:10 等等。 |
|
||||
| `0 30 10-13 ? * WED,FRI` | 每周三和每周五的 10:30、11:30、12:30、13:30 执行。 |
|
||||
| `0 0/30 8-9 5,20 * ?` | 每个月的 5 号和 20 号的 8 点和 10 点之间每隔 30 分钟执行一次,也就是 8:00、8:30、9:00 和 9:30。 |
|
||||
| `0 15 10 ? * *` | 每天上午 10:15 执行任务 |
|
||||
| `0 15 10 * * ?` | 每天上午 10:15 执行任务 |
|
||||
| `0 0 12 * * ?` | 每天中午 12:00 执行任务 |
|
||||
| `0 0 10,14,16 * * ?` | 每天上午 10:00 点、下午 14:00 以及下午 16:00 执行任务 |
|
||||
| `0 0/30 9-17 * * ?` | 每天上午 09:00 到下午 17:00 时间段内每隔半小时执行任务 |
|
||||
| `0 * 14 * * ?` | 每天下午 14:00 到下午 14:59 时间段内每隔 1 分钟执行任务 |
|
||||
| `0 0-5 14 * * ?` | 每天下午 14:00 到下午 14:05 时间段内每隔 1 分钟执行任务 |
|
||||
| `0 0/5 14 * * ?` | 每天下午 14:00 到下午 14:55 时间段内每隔 5 分钟执行任务 |
|
||||
| `0 0/5 14,18 * * ?` | 每天下午 14:00 到下午 14:55、下午 18:00 到下午 18:55 时间段内每隔 5 分钟执行任务 |
|
||||
| `0 0 12 ? * WED` | 每个星期三中午 12:00 执行任务 |
|
||||
| `0 15 10 15 * ?` | 每月 15 日上午 10:15 执行任务 |
|
||||
| `0 15 10 L * ?` | 每月最后一日上午 10:15 执行任务 |
|
||||
| `0 15 10 ? * 6L` | 每月最后一个星期六上午 10:15 执行任务 |
|
||||
| `0 15 10 ? * 6#3` | 每月第三个星期六上午 10:15 执行任务 |
|
||||
| `0 10,44 14 ? 3 WED` | 每年 3 月的每个星期三下午 14:10 和 14:44 执行任务 |
|
||||
@@ -1,430 +0,0 @@
|
||||
---
|
||||
title: "重新认识 JavaScript"
|
||||
subtitle: "学习 JavaScript 新特性"
|
||||
date: 2022-05-01T10:59:36+08:00
|
||||
description: "这是一篇测试 FixIt 主题在打印视图表现的测试文章"
|
||||
type: 'posts'
|
||||
draft: true
|
||||
|
||||
tags:
|
||||
- Test
|
||||
- print
|
||||
- JavaScript
|
||||
- ES6
|
||||
categories:
|
||||
- Test
|
||||
|
||||
hiddenFromHomePage: true
|
||||
|
||||
code:
|
||||
maxShownLines: 30
|
||||
|
||||
menu:
|
||||
main:
|
||||
name: "打印测试"
|
||||
title: "这是一篇测试 FixIt 主题在打印视图表现的测试文章"
|
||||
parent: "tests"
|
||||
pre: "<i class='fa-solid fa-vial fa-fw fa-sm'></i>"
|
||||
---
|
||||
|
||||
<div class="print-d-none">
|
||||
|
||||
> **这是一篇测试 FixIt 主题在打印视图表现的测试文章。所有居中的说明文字将不会出现在打印视图。**
|
||||
>
|
||||
> 按 <kbd>ctrl</kbd> + <kbd>P</kbd> 或者 <kbd>⌘</kbd> + <kbd>P</kbd> 可以打印此页面。
|
||||
>
|
||||
> FR: <https://lruihao.cn/posts/js-rediscover/>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
{{< admonition tip "前言" >}}
|
||||
|
||||
前端框架轮替变化越来越快,JavaScript 也在不断地升级迭代,越来越多的新特性让我们的代码写起来变得简洁有趣。
|
||||
|
||||
每隔一段时间就该重新认识一下 JS,这篇文章会介绍 6 种新特性,一起研究一下吧。
|
||||
|
||||
{{< /admonition >}}
|
||||
|
||||
<!--more-->
|
||||
|
||||
## 数组方法 some, every, find, filter
|
||||
|
||||
> 共同点:这几个方法都不会改变原始数组。
|
||||
|
||||
**[some](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/some)**
|
||||
|
||||
`some()` 方法测试数组中是不是至少有 1 个元素通过了被提供的函数测试,它返回一个布尔值。
|
||||
|
||||
数组中有至少一个元素通过回调函数的测试就会返回 `true`,所有元素都没有通过回调函数的测试返回值才会为 `false`。
|
||||
|
||||
```
|
||||
arr.some(callback(element[, index[, array]])[, thisArg])
|
||||
```
|
||||
|
||||
```js
|
||||
[2, 5, 8, 1, 4].some(x => x > 10); // false
|
||||
[12, 5, 8, 1, 4].some(x => x > 10); // true
|
||||
```
|
||||
|
||||
{{< admonition tip >}}
|
||||
|
||||
`some()` 不会对空数组进行检测,空数组返回 `false`
|
||||
|
||||
{{< /admonition >}}
|
||||
|
||||
**[every](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/every)**
|
||||
|
||||
> 助记:`every()` 和 `some()` 功能相反
|
||||
|
||||
`every()` 方法测试一个数组内的所有元素是否都能通过某个指定函数的测试,它返回一个布尔值。
|
||||
|
||||
<small class="text-center print-d-none">
|
||||
|
||||
*在这个位置使用 `page-break-before` 进行了强制分页*
|
||||
|
||||
</small>
|
||||
<div class="page-break-before"></div>
|
||||
|
||||
如果回调函数的每一次返回都为 [truthy](https://developer.mozilla.org/zh-CN/docs/Glossary/Truthy) 值,返回 `true` ,否则返回 `false`。
|
||||
|
||||
```
|
||||
arr.every(callback(element[, index[, array]])[, thisArg])
|
||||
```
|
||||
|
||||
```js
|
||||
[12, 5, 8, 130, 44].every(x => x >= 10); // false
|
||||
[12, 54, 18, 130, 44].every(x => x >= 10); // true
|
||||
```
|
||||
|
||||
{{< admonition tip >}}
|
||||
|
||||
`every()` 不会对空数组进行检测,空数组返回 `true`
|
||||
|
||||
{{< /admonition >}}
|
||||
|
||||
**[Find](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/find)**
|
||||
|
||||
> 助记:功能和 `some()` 类似,`some()` 返回布尔值,`find()` 返回**找到**的元素
|
||||
|
||||
`find()` 方法返回数组中满足提供的测试函数的第一个元素的值,否则返回 [`undefined`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/undefined)。
|
||||
|
||||
```
|
||||
arr.find(callback[, thisArg])
|
||||
```
|
||||
|
||||
```js
|
||||
const array1 = [5, 12, 8, 130, 44];
|
||||
|
||||
const found = array1.find(element => element > 10);
|
||||
|
||||
console.log(found);
|
||||
// expected output: 12
|
||||
```
|
||||
|
||||
{{< admonition quote >}}
|
||||
|
||||
另请参见 [`findIndex()`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex) 方法,它返回数组中找到的元素的索引,而不是其值。
|
||||
|
||||
如果你需要找到一个元素的位置或者一个元素是否存在于数组中,使用 [`Array.prototype.indexOf()`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf) 或 [`Array.prototype.includes()`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/includes)。
|
||||
|
||||
{{< /admonition >}}
|
||||
|
||||
**[filter](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)**
|
||||
|
||||
> 助记:如字面意思,它是一个筛子,会筛选出满足条件的元素
|
||||
|
||||
`filter()` 方法创建一个新数组,其包含通过所提供函数实现的测试的所有元素。
|
||||
|
||||
<small class="text-center print-d-none">
|
||||
|
||||
*在这个位置使用 `page-break-after` 进行了强制分页*
|
||||
|
||||
</small>
|
||||
<div class="page-break-after"></div>
|
||||
|
||||
返回值是一个新的、由通过测试的元素组成的数组,如果没有任何数组元素通过测试,则返回空数组。
|
||||
|
||||
```
|
||||
var newArray = arr.filter(callback(element[, index[, array]])[, thisArg])
|
||||
```
|
||||
|
||||
```js
|
||||
const words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];
|
||||
|
||||
const result = words.filter(word => word.length > 6);
|
||||
|
||||
console.log(result);
|
||||
// expected output: Array ["exuberant", "destruction", "present"]
|
||||
```
|
||||
|
||||
## 使用 `Object.hasOwn` 替代 `in` 操作符
|
||||
|
||||
有时,我们想知道对象上是否存在某个属性,一般会使用 `in` 操作符或 `obj.hasOwnProperty`,但它们都有各自的缺陷。
|
||||
|
||||
**in**
|
||||
|
||||
如果指定的属性位于对象或其原型链中,`in` 运算符将返回 `true`。
|
||||
|
||||
```javascript
|
||||
const Person = function (age) {
|
||||
this.age = age
|
||||
}
|
||||
Person.prototype.name = 'fatfish'
|
||||
|
||||
const p1 = new Person(24)
|
||||
console.log('age' in p1) // true
|
||||
console.log('name' in p1) // true 注意这里
|
||||
```
|
||||
|
||||
**obj.hasOwnProperty**
|
||||
|
||||
`hasOwnProperty` 方法会返回一个布尔值,表示对象**自身属性**中是否具有对应的值(原型链上的属性不会读取)。
|
||||
|
||||
```javascript
|
||||
const Person = function (age) {
|
||||
this.age = age
|
||||
}
|
||||
Person.prototype.name = 'fatfish'
|
||||
|
||||
const p1 = new Person(24)
|
||||
console.log(p1.hasOwnProperty('age')) // true
|
||||
console.log(p1.hasOwnProperty('name')) // fasle 注意这里
|
||||
```
|
||||
|
||||
<small class="text-center print-d-none">
|
||||
|
||||
*在这个位置使用 `page-break-after` 进行了强制分页*
|
||||
|
||||
</small>
|
||||
<div class="page-break-after"></div>
|
||||
|
||||
`obj.hasOwnProperty` 已经可以过滤掉原型链上的属性,但在某些情况下,它还是不安全。
|
||||
|
||||
```javascript
|
||||
Object.create(null).hasOwnProperty('name')
|
||||
// Uncaught TypeError: Object.create(...).hasOwnProperty is not a function
|
||||
```
|
||||
|
||||
**Object.hasOwn**
|
||||
|
||||
别急,我们可以使用 `Object.hasOwn` 来避免这两个问题,这比 `obj.hasOwnProperty` 方法更加方便、安全。
|
||||
|
||||
```javascript
|
||||
let object = { age: 24 }
|
||||
Object.hasOwn(object, 'age') // true
|
||||
|
||||
let object3 = Object.create(null)
|
||||
Object.hasOwn(object3, 'age') // false
|
||||
```
|
||||
|
||||
## 使用 "#" 声明私有属性
|
||||
|
||||
以前,我们一般用 `_` 表示私有属性,但它并不靠谱,还是会被外部修改。
|
||||
|
||||
```javascript
|
||||
class Person {
|
||||
constructor (name) {
|
||||
this._money = 1
|
||||
this.name = name
|
||||
}
|
||||
get money () {
|
||||
return this._money
|
||||
}
|
||||
set money (money) {
|
||||
this._money = money
|
||||
}
|
||||
showMoney () {
|
||||
console.log(this._money)
|
||||
}
|
||||
}
|
||||
const p1 = new Person('fatfish')
|
||||
console.log(p1.money) // 1
|
||||
console.log(p1._money) // 1
|
||||
p1._money = 2 // 依旧可以从外部修改_money 属性,所以这种做法并不安全
|
||||
console.log(p1.money) // 2
|
||||
console.log(p1._money) // 2
|
||||
```
|
||||
|
||||
<small class="text-center print-d-none">
|
||||
|
||||
*在这个位置使用 `page-break-after` 进行了强制分页*
|
||||
|
||||
</small>
|
||||
<div class="page-break-after"></div>
|
||||
|
||||
**使用 `#` 实现真正私有属性**
|
||||
|
||||
```javascript
|
||||
class Person {
|
||||
#money=1
|
||||
constructor (name) {
|
||||
this.name = name
|
||||
}
|
||||
get money () {
|
||||
return this.#money
|
||||
}
|
||||
set money (money) {
|
||||
this.#money = money
|
||||
}
|
||||
showMoney () {
|
||||
console.log(this.#money)
|
||||
}
|
||||
}
|
||||
const p1 = new Person('fatfish')
|
||||
console.log(p1.money) // 1
|
||||
// p1.#money = 2 // 没法从外部直接修改
|
||||
p1.money = 2
|
||||
console.log(p1.money) // 2
|
||||
console.log(p1.#money) // Uncaught SyntaxError: Private field '#money' must be declared in an enclosing class
|
||||
```
|
||||
|
||||
## 有用的数字分隔符
|
||||
|
||||
可以使用 `_` 分隔数字,当然也可以用于计算
|
||||
|
||||
```javascript
|
||||
// ✅ 更加易于阅读
|
||||
const newSixBillion = 6000_000_000
|
||||
// ❌ 难以阅读
|
||||
const originSixBillion = 6000000000
|
||||
|
||||
console.log(newSixBillion === originSixBillion)
|
||||
// expected output: true
|
||||
```
|
||||
|
||||
```javascript
|
||||
const sum = 1000 + 6000_000_000
|
||||
// expected output: 6000001000
|
||||
```
|
||||
|
||||
{{< admonition tip >}}
|
||||
|
||||
另外,我们写时间时,`24*60*60*1000` 的可读性也是远大于 `86400000` 的。
|
||||
|
||||
{{< /admonition >}}
|
||||
|
||||
<small class="text-center print-d-none">
|
||||
|
||||
*在这个位置使用 `page-break-after` 进行了强制分页*
|
||||
|
||||
</small>
|
||||
<div class="page-break-after"></div>
|
||||
|
||||
## "?.", "??", "??=" 的使用
|
||||
|
||||
**可选链 ?.**
|
||||
|
||||
以前我们为了简化 `if else`,通常会写出这样的代码
|
||||
|
||||
```js
|
||||
const obj = null
|
||||
console.log(obj && obj.name)
|
||||
|
||||
const $title = document.querySelector('.title')
|
||||
const title = $title ? title.innerText : undefined
|
||||
```
|
||||
|
||||
使用 `?.` 简化 `&&` 和三元运算符
|
||||
|
||||
```js
|
||||
const obj = null
|
||||
console.log(obj?.name)
|
||||
|
||||
const $title = document.querySelector('.title')
|
||||
const title = $title?.innerText
|
||||
```
|
||||
|
||||
**空值合并运算符 ??**
|
||||
|
||||
之前给变量赋默认值时,我们一般会用 `||` 来写,比如
|
||||
|
||||
```js
|
||||
let foo = 1
|
||||
let bar = foo || 2
|
||||
console.log(bar) // 1
|
||||
|
||||
let foo = 0
|
||||
let bar = foo || 2
|
||||
console.log(bar) // 2 注意这里
|
||||
```
|
||||
|
||||
所以,`||` 有时候并不是很安全,所以我们不得不加判断
|
||||
|
||||
```js
|
||||
let foo = 0
|
||||
let bar = foo !== undefined ? foo : 2
|
||||
console.log(bar) // 0
|
||||
```
|
||||
|
||||
<small class="text-center print-d-none">
|
||||
|
||||
*在这个位置使用 `page-break-after` 进行了强制分页*
|
||||
|
||||
</small>
|
||||
<div class="page-break-after"></div>
|
||||
|
||||
现在使用 `??` 可以使代码更加优雅
|
||||
|
||||
```js
|
||||
let foo = 1
|
||||
let bar = foo ?? 2
|
||||
console.log(bar) // 1
|
||||
|
||||
let foo = 0
|
||||
let bar = foo ?? 2
|
||||
console.log(bar) // 0
|
||||
```
|
||||
|
||||
**空值赋值运算符 ??=**
|
||||
|
||||
```js
|
||||
let foo = 0
|
||||
foo ??= 2
|
||||
console.log(foo) // 0
|
||||
|
||||
let foo = 1
|
||||
foo ??= 2
|
||||
console.log(foo) // 1
|
||||
```
|
||||
|
||||
很好理解,这里的 `foo ??= 2` 等价于 `foo = foo ?? 2`
|
||||
|
||||
<small class="text-center print-d-none">
|
||||
|
||||
*在这个位置使用 `page-break-after` 进行了强制分页*
|
||||
|
||||
</small>
|
||||
<div class="page-break-after"></div>
|
||||
|
||||
## 使用 BigInt 支持大数计算
|
||||
|
||||
JS 中超过 `Number.MAX_SAFE_INTEGER` 的数字计算将是不安全的。
|
||||
|
||||
**Example:**
|
||||
|
||||
```javascript
|
||||
Math.pow(2, 53) === Math.pow(2, 53) + 1 // true
|
||||
// Math.pow(2, 53) => 9007199254740992
|
||||
// Math.pow(2, 53) + 1 => 9007199254740992
|
||||
```
|
||||
|
||||
使用 `BigInt` 完全可以避免这个问题
|
||||
|
||||
```javascript
|
||||
BigInt(Math.pow(2, 53)) === BigInt(Math.pow(2, 53)) + BigInt(1) // false
|
||||
// BigInt(Math.pow(2, 53)) => 9007199254740992n
|
||||
// BigInt(Math.pow(2, 53)) + BigInt(1) => 9007199254740993n
|
||||
```
|
||||
|
||||
要创建一个 BigInt,可以在一个整数的末尾添加字符`n`,或者调用函数 `BigInt()`。
|
||||
|
||||
```js
|
||||
let foo = BigInt(1) // 1n
|
||||
let bar = BigInt(2) // 2n
|
||||
console.log(foo > bar) // false
|
||||
|
||||
console.log(1n > 2n) // false
|
||||
```
|
||||
|
||||
*学无止境,与未来的自己共勉*
|
||||
@@ -1,61 +0,0 @@
|
||||
---
|
||||
title: "Shortcodes Test"
|
||||
date: 2022-03-07T22:31:22+08:00
|
||||
description: "Test for shortcodes usages"
|
||||
type: 'posts'
|
||||
draft: true
|
||||
|
||||
tags:
|
||||
- Test
|
||||
- shortcodes
|
||||
categories:
|
||||
- Test
|
||||
|
||||
hiddenFromHomePage: true
|
||||
|
||||
menu:
|
||||
main:
|
||||
title: "Test for shortcodes usages"
|
||||
parent: "tests"
|
||||
pre: "<i class='fa-solid fa-vial fa-fw fa-sm'></i>"
|
||||
---
|
||||
|
||||
normal content
|
||||
|
||||
> normal blockquote content
|
||||
|
||||
## Shortcodes without Markdown
|
||||
|
||||
{{< center-quote >}}
|
||||
**hello** *world*
|
||||
this is a center-quote shortcode example.
|
||||
{{< /center-quote >}}
|
||||
|
||||
## Shortcodes with Markdown
|
||||
|
||||
{{% center-quote %}}
|
||||
**hello** *world*
|
||||
this is a center-quote shortcode example.
|
||||
{{% /center-quote %}}
|
||||
|
||||
{{< details "**Copyright** 2022. [Lruihao](https://lruihao.cn/)" >}}
|
||||
*All pages and graphics on this web site are the property of [FixIt](/).*
|
||||
{{< /details >}}
|
||||
|
||||
{{< admonition type=tip title="*This is a tip*" open=false >}}
|
||||
A **tip** banner
|
||||
{{< /admonition >}}
|
||||
|
||||
## Shortcodes with raw string parameters
|
||||
|
||||
{{< details `<b>Copyright</b> 2022. <em>Lruihao</em>` >}}
|
||||
*All pages and graphics on this web site are the property of [FixIt](/).*
|
||||
{{< /details >}}
|
||||
|
||||
## Nested Shortcodes
|
||||
|
||||
{{< version 0.2.0 changed >}} {{< link "https://katex.org/" KaTeX >}} mathematical formulas (https://katex.org)
|
||||
|
||||
```
|
||||
{{< version 0.2.0 changed >}} {{< link "https://katex.org/" KaTeX >}} mathematical formulas (https://katex.org)
|
||||
```
|
||||
@@ -1,20 +0,0 @@
|
||||
# Friend/Site info of one 朋友/站点信息例子
|
||||
# - nickname: friend's name 朋友名字
|
||||
# avatar: friend's avatar 朋友头像
|
||||
# url: site link 站点链接
|
||||
# description: description of friend/site 对朋友或其站点的说明
|
||||
|
||||
- nickname: Lruihao
|
||||
avatar: https://lruihao.cn/images/avatar.jpg
|
||||
url: https://lruihao.cn
|
||||
description: Share programming experience and learning experience.
|
||||
|
||||
- nickname: hiifong
|
||||
avatar: https://52at.ml/images/avatar.jpg
|
||||
url: https://52at.ml
|
||||
description: hiifong's blog,share anything!!!
|
||||
|
||||
- nickname: new site
|
||||
avatar:
|
||||
url: https://github.com/Lruihao/FixIt/pulls
|
||||
description: Create a pull request to add a new site.
|
||||
@@ -1 +0,0 @@
|
||||
/zh-cn/* /zh-cn/404.html 404
|
||||
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 10 KiB |
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<browserconfig>
|
||||
<msapplication>
|
||||
<tile>
|
||||
<square150x150logo src="/mstile-150x150.png"/>
|
||||
<TileColor>#2d89ef</TileColor>
|
||||
</tile>
|
||||
</msapplication>
|
||||
</browserconfig>
|
||||