Gamer's Show

你知道人生最要紧的事是快乐不停

0%

Hexo-Next的写文小技巧

有一些tag插件在8以下版本是不能用的,还有一些用markdown完全可以轻松代替,这里不作过多赘述,只是列出来一些笨人觉得有用并且很方便的~
以及,本文中的[]只是分割名字,实际用的时候不需要敲出来。

Note

Next配置

1
2
3
4
5
6
7
8
9
10
11
note:
# Note tag style values:
# - simple bs-callout old alert style. Default.
# - modern bs-callout new (v2-v3) alert style.
# - flat flat callout style with background, like on Mozilla or StackOverflow.
# - disabled disable all CSS styles import of note tag.
style: simple
icons: false
# Offset lighter of background in % for modern and flat styles (modern: -12 | 12; flat: -18 | 6).
# Offset also applied to label tag variables. This option can work with disabled note tag.
light_bg_offset: 0

用法

1
2
3
{% note [class] [no-icon] [summary] %}
Any content (support inline tags too).
{% endnote %}

所有的参数都是自选的

  • class:Supported values:default(灰色向右箭头) | primary(紫色加号) | success(绿色对号) | info(蓝色i) | warning(黄色感叹号) | danger(红色减号).
  • [no-icon] : Disable icon in note.
  • [summary] : Optional summary of the note.前边会自带一个小三角
    1
    2
    3
    4
    {% note primary %}
    #### Primary Header
    **Welcome** to [Hexo!](https://hexo.io)
    {% endnote %}

Tabs

Next配置

1
2
3
4
5
6
tabs:
# Make the nav bar of tabs with long content stick to the top.
sticky: false
transition:
tabs: false
labels: true

用法

1
2
3
4
5
{% tabs Unique name, [index] %}
<!-- tab [Tab caption] [@icon] -->
Any content (support inline tags too).
<!-- endtab -->
{% endtabs %}
  • Unique name : Unique name of tabs block tag without comma.
    Will be used in #id’s as prefix for each tab with their index numbers.
    If there are whitespaces in name, for generate #id all whitespaces will replaced by dashes.
    Only for current url of post/page must be unique!
    就是说这个参数是给你的表设一个名字,在本篇文章中仅此一个。如果要单独给某个表格设置名字在Tab caption处设置就可以。
  • [index] : Index number of active tab.
    If not specified, first tab (1) will be selected.
    If index is -1, no tab will be selected. It’s will be something like spoiler.
    选择初始时显示的表,默认是1,-1是全收缩
    Optional parameter.
  • [Tab caption] : Caption of current tab.
    If not caption specified, unique name with tab index suffix will be used as caption of tab.
    If not caption specified, but specified icon, caption will empty.
    给表头单独添加索引,默认是从1编号;-1是不制表;如果是空的,就是name+id
    Optional parameter.
  • [@icon] : Font Awesome icon name.
    Can be specified with or without space; e.g. ‘Tab caption @icon’ is the same as ‘Tab caption@icon’.
    @+font的名字,和name之间有没有空格都可以
    Optional parameter

Mermaid

设置

hexo设置

1
2
3
highlight:
exclude_languages:
- mermaid

Next设置

1
2
3
4
5
6
7
# Mermaid tag
mermaid:
enable: true
# Available themes: default | dark | forest | neutral
theme:
light: default
dark: dark

Examples

graph TD
A[Hard] -->|Text| B(Round)
B --> C{Decision}
C -->|One| D[Result 1]
C -->|Two| E[Result 2]

让你的Hexo-Next支持数学公式

注意在把next.config文件中的mathjax改为true之后还要在文章标题添加mathjax: true,这样仅在需要的界面渲染公式,可以提高加载速度