hexo 插件
npm install hexo-lazyload-image --save
First add configuration in _config.yml
from your hexo project.
lazyload:
enable: true
onlypost: false
loadingImg: # eg ./images/loading.gif
不支持
ruby
新标签的浏览器将显示rp
中的内容。
<ruby>博採眾長<rp>(</rp> <rt>lruihao.cn</rt><rp>)</rp></ruby>
博採眾長( lruihao.cn)
插件使用
npm i hexo-ruby-marks
{% ruby _**base**_|_**top text**_ %}
npm install --save hexo-pwa
You can configure this plugin in
_config.yml
.(配置完即可使用不许单独设置manifest.json
文件及配置,插件生成)
pwa:
manifest:
path: /manifest.json
body:
name: hexo
short_name: hexo
icons:
- src: /images/android-chrome-192x192.png
sizes: 192x192
type: image/png
- src: /images/android-chrome-512x512.png
sizes: 512x512
type: image/png
start_url: /index.html
theme_color: '#ffffff'
background_color: '#ffffff'
display: standalone
serviceWorker:
path: /sw.js
preload:
urls:
- /
posts: 5
opts:
networkTimeoutSeconds: 5
routes:
- pattern: !!js/regexp /hm.baidu.com/
strategy: networkOnly
- pattern: !!js/regexp /.*\.(js|css|jpg|jpeg|png|gif)$/
strategy: cacheFirst
- pattern: !!js/regexp /\//
strategy: networkFirst
priority: 5
npm install hexo-tag-dplayer --save
{% dplayer key=value ... %}
key can be
dplayer options:
'autoplay', 'loop', 'screenshot', 'hotkey', 'mutex', 'dmunlimited' : bool options, use "yes" "y" "true" "1" "on" or just without value to enable
'preload', 'theme', 'lang', 'logo', 'url', 'pic', 'thumbnails', 'vidtype', 'suburl', 'subtype', 'subbottom', 'subcolor', 'subcolor', 'id', 'api', 'token', 'addition', 'dmuser' : string arguments
'volume', 'maximum' : number arguments
container options:
'width', 'height' : string, used in container element style
other:
'code' : value of this key will be append to script tag
{% dplayer "url=https://moeplayer.b0.upaiyun.com/dplayer/hikarunara.mp4" "addition=https://dplayer.daoapp.io/bilibili?aid=4157142" "api=https://api.prprpr.me/dplayer/" "pic=https://moeplayer.b0.upaiyun.com/dplayer/hikarunara.jpg" "id=9E2E3368B56CDBB4" "loop=yes" "theme=#FADFA3" "autoplay=false" "token=tokendemo" %}
npm install --save hexo-tag-aplayer
{% aplayer title author url [picture_url, narrow, autoplay, width:xxx, lrc:xxx] %}
标签参数
title
: 曲目标题author
: 曲目作者url
: 音乐文件 URL 地址picture_url
: (可选) 音乐对应的图片地址narrow
: (可选)播放器袖珍风格autoplay
: (可选) 自动播放,移动端浏览器暂时不支持此功能width:xxx
: (可选) 播放器宽度 (默认:100%)lrc:xxx
: (可选)歌词文件 URL 地址当开启 Hexo 的 文章资源文件夹 功能时,可以将图片、音乐文件、歌词文件放入与文章对应的资源文件夹中,然后直接引用:
{% aplayer "Caffeine" "Jeff Williams" "caffeine.mp3" "picture.jpg" "lrc:caffeine.txt" %}
{% aplayer "你离开了南京,从此没人和我说话" "李志" "https://cdn.lruihao.cn/files/nanjing.mp3" "https://p2.music.126.net/UuSe-Vc6rS7JtRJSQgDU2g==/2323268069553116.jpg?param=300x300" %}
1 | npm install --save hexo-filter-flowchart |
---|
```%flow #去掉%号
st=>start: Start|past:>https://lruihao.cn[blank]
e=>end: End:>https://www.lruihao.cn[blank]
op1=>operation: My Operation|past
op2=>operation: Stuff|current
sub1=>subroutine: My Subroutine|invalid
cond=>condition: Yes
or No?|approved:>/hexo/nextplugin.html
c2=>condition: Good idea|rejected
io=>inputoutput: catch something...|request
st->op1(right)->cond
cond(yes, right)->c2
cond(no)->sub1(left)->op1
c2(yes)->io->e
c2(no)->op2->e
1 | npm install hexo-spoiler --save |
---|
If hexo can’t detect this plugin automatically, you need to modify the
plugins
section of[path_to_your_site]/_config.yml
manually, like:
1 2 | plugins: - hexo-spoiler |
---|
1 | {% spoiler text %} |
---|
It will pixelate your text, and click to reveal. Click again to hide your text again. But you need to add
<br>
manually if you want line breaks after/before it.
When you writes:
1 2 3 4 5 | {% spoiler text %}
{% spoiler |
---|
目前在 next 中可能引起部分 css 冲突,建议在 next 中使用在单个页面中。 依赖于 jQuery,一行 js 可以引入播放器插件。
{% caniuse feature @ periods %}
<!-- Tag Alias -->
{% can feature @ periods %}
feature : Search for the feature you want on https://caniuse.com, then click on the hash sign to the left of the search result heading and you will get the unique name of this feature.
periods : Select the browser versions to display. Supported values: past_1, past_2, past_3, past_4, past_5, current, future_3, future_2, future_1. If this value is empty, the default value 'current' will be used.
Caniuse without periods
1 | {% caniuse fetch %} |
---|
Caniuse with current period
1 | {% can sharedarraybuffer @ current %} |
---|
Caniuse with future periods
1 | {% caniuse loading-lazy-attr @ future_3,future_2,future_1 %} |
---|
Caniuse with past periods
1 | {% caniuse link-rel-modulepreload @ past_1,past_2,past_3,past_4,past_5 %} |
---|
This tag include any raw content into your posts. Path is relative to your site source directory.
1 | {% include_raw '_data/path/to/file.html' %} |
---|
Let’s create include-raw.html file in _data
directory under site root directory with following content:
1 | Any <strong>raw content</strong> may be included with this tag. |
---|
Then in any post we can use this content with include_raw tag:
1 | {% include_raw '_data/path/to/include-raw.html' %} |
---|
Any raw content may be included with this tag.
1 2 3 4 5 6 7 8 9 10 11 | {% button url, text, icon class, title %} <!-- Tag Alias --> {% btn url, text, icon class, title %} url : Absolute or relative path to URL. text : Button text. Required if no icon specified. icon : FontAwesome icon name (without 'fa-' at the begining). Required if no text specified. class : FontAwesome class(es): fa-fw | fa-lg | fa-2x | fa-3x | fa-4x | fa-5x Optional parameter. title : Tooltip at mouseover. Optional parameter. |
---|
{% btn #, Text & Large Icon & Title, home fa-fw fa-lg, Title %}
example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | {% mermaid gitGraph: %} options { "nodeSpacing": 150, "nodeRadius": 10 } end commit branch newbranch checkout newbranch commit checkout master commit merge newbranch {% endmermaid %} |
---|
1 | {% video url %} |
---|
1 2 | {% video https://example.com/sample.mp4 %} {% video /path/to/your/video.mp4 %} |
---|
“tab"为选项卡的名称,可以自定义,数字是几表示从第几个选项卡开始。非必须,若数值为-1 则隐藏选项卡内容。 查看更多
{% 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!
[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.
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.
Optional parameter.
[@icon] : FontAwesome icon name (without 'fa-' at the begining).
Can be specified with or without space; e.g. 'Tab caption @icon' similar to 'Tab caption@icon'.
Optional parameter.
{% tabs tab,2 %}
this is tab1
this is tab2
this is tab3
{% endtabs %}
1 2 |
|
---|
{% tabs 选项,-1 %}
选项 1
选项 2
选项 3
{% endtabs %}
1 2 |
|
---|
{% tabs Fourth unique name %}
This is Tab 1.
This is Tab 2.
This is Tab 3.
{% endtabs %}
1 2 3 4 5 | note 便签 > 主题配置文件搜索 note, 可设置风格和图标是否显示。 |
---|
note:
style: flat icons: true border_radius: 15
light_bg_offset: 0
1 | 写法 |
---|
{% note default %}
类型还有以下几种 {% endnote %} {% note primary %}
内容 {% endnote %} {% note success %}
内容 {% endnote %} {% note info %}
内容 {% endnote %} {% note warning %}
内容 {% endnote %} {% note danger %}
内容 {% endnote %} {% note %}
内容 {% endnote %} {% note danger no-icon %}
内容 {% endnote %}
1 2 3 | 引用(文本居中) |
---|
{% cq %} there are test words {% endcq %}
1 2 3 4 5 6 7 8 | Font Awesome 图标 > Font Awesome 是一套绝佳的图标字体库和 CSS 框架。 > Font Awesome 字体为您提供可缩放矢量图标,它可以被定制大小、颜色、阴影以及任何可以用 CSS 的样式。 > 要使用 Font Awesome 图标,请在 HTML 页面的 部分中添加以下行: #### 1、国内推荐 CDN |
---|
1 | <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> |
---|
next 已经引用了,可以直接用,比如:
1 2 3 4 5 6 7 8 | <i class="fa fa-car"></i> <i class="fa fa-car" style="font-size:48px;"></i> <i class="fa fa-car" style="font-size:60px;color:red;"></i> <i class="fa fa-car fa-lg"></i> <i class="fa fa-car fa-2x"></i> <i class="fa fa-car fa-3x"></i> <i class="fa fa-car fa-4x"></i> <i class="fa fa-car fa-5x"></i> |
---|
动态图标
1 2 3 4 5 | <i class="fa fa-spinner fa-spin"></i> <i class="fa fa-circle-o-notch fa-spin"></i> <i class="fa fa-refresh fa-spin"></i> <i class="fa fa-cog fa-spin"></i> <i class="fa fa-spinner fa-pulse"></i> |
---|
1 2 3 4 | language url code snippet |
---|
1 2 |
|
---|
iframe 在文章中插入 iframe。
1 | {% iframe url width %} |
---|
1 2 3 4 5 6 7 8 9 | <ul><br><li><i class="fa fa-check-square"></i> 已完成</li><br><li><i class="fa fa-square"></i> 未完成</li><br></ul><br><br><!--或者--><br><br>- <i class="fa fa-check-square"></i> 已完成<br>- <i class="fa fa-square"></i> 未完成 |
---|
主题配置文件中打开
1 2 | Label tag. label: true |
---|
@
前面的是 label 的名字,后面的是要显示的文字
1 2 3 | {% label default@default %} primary success info warning danger |
---|
包括小色块、左侧色条、右侧色条、上方色条、数字色块(需要自定义样式)