前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >hexo 插件及 next 内置样式集

hexo 插件及 next 内置样式集

作者头像
Cell
发布2022-02-25 13:51:30
4660
发布2022-02-25 13:51:30
举报
文章被收录于专栏:Cell的前端专栏

hexo 插件

hexo-lazyload-image
代码语言:javascript
复制
npm install hexo-lazyload-image --save

First add configuration in _config.yml from your hexo project.

代码语言:javascript
复制
lazyload:
  enable: true 
  onlypost: false
  loadingImg: # eg ./images/loading.gif
hexo-ruby-marks

不支持ruby新标签的浏览器将显示rp中的内容。

代码语言:javascript
复制
<ruby>博採眾長<rp>(</rp> <rt>lruihao.cn</rt><rp>)</rp></ruby>

博採眾長( lruihao.cn)

插件使用

代码语言:javascript
复制
npm i hexo-ruby-marks
代码语言:javascript
复制
{% ruby _**base**_|_**top text**_ %}
hexo-pwa
代码语言:javascript
复制
npm install --save hexo-pwa

You can configure this plugin in _config.yml.(配置完即可使用不许单独设置manifest.json文件及配置,插件生成)

代码语言:javascript
复制
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
hexo-tag-dplayer

hexo-tag-dplayer

代码语言:javascript
复制
npm install hexo-tag-dplayer --save
代码语言:javascript
复制
{% dplayer key=value ... %}

key can be

代码语言:javascript
复制
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
代码语言:javascript
复制
{% 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" %}
hexo-tag-aplayer

more

代码语言:javascript
复制
npm install --save hexo-tag-aplayer
代码语言:javascript
复制
{% 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 的 文章资源文件夹 功能时,可以将图片、音乐文件、歌词文件放入与文章对应的资源文件夹中,然后直接引用:

代码语言:javascript
复制
{% 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" %}
hexo-pdf

pdf 传送门

hexo-filter-flowchart(流程图)

语法

1

npm install --save hexo-filter-flowchart

代码语言:javascript
复制
```%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

代码语言:txt
复制
hexo-spoiler

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 text %} {% spoiler *text* %} {% spoiler **text** %} {% spoiler **hello welcome to 博採眾長!** %}

宅音乐侧栏播放器插件

体验 源码

目前在 next 中可能引起部分 css 冲突,建议在 next 中使用在单个页面中。 依赖于 jQuery,一行 js 可以引入播放器插件。

caniuse

使用
代码语言:javascript
复制
{% 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 %}

Include Raw

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.

button

more info

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 %}

代码语言:txt
复制

Mermaid

more info

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 %}

video

Usage

1

{% video url %}

Examples

1 2

{% video https://example.com/sample.mp4 %} {% video /path/to/your/video.mp4 %}

tab 选项卡

“tab"为选项卡的名称,可以自定义,数字是几表示从第几个选项卡开始。非必须,若数值为-1 则隐藏选项卡内容。 查看更多

代码语言:javascript
复制
{% 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

数值为-1

{% 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 tag (bs-callout).

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: flat icons: true border_radius: 15

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

写法

{% note default %}

default

类型还有以下几种 {% endnote %} {% note primary %}

primary

内容 {% endnote %} {% note success %}

success

内容 {% endnote %} {% note info %}

info

内容 {% endnote %} {% note warning %}

warning

内容 {% endnote %} {% note danger %}

danger

内容 {% endnote %} {% note %}

不填

内容 {% endnote %} {% note danger no-icon %}

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

代码语言:#### 2、海外推荐 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

  • printf("Hello World!"); + printf("Hello_World!");

iframe 在文章中插入 iframe。

1

{% iframe url width %}

Todo list

  • 已完成
  • 未完成

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> 未完成

Label

主题配置文件中打开

1 2

Label tag. label: true

@前面的是 label 的名字,后面的是要显示的文字

1 2 3

{% label default@default %} primary success info warning danger

其他

包括小色块、左侧色条、右侧色条、上方色条、数字色块(需要自定义样式)

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2018-11-24,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 宅音乐侧栏播放器插件
  • caniuse
  • Include Raw
  • button
  • Mermaid
  • video
  • tab 选项卡
  • Note tag (bs-callout).
  • 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.
  • 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.
    • 代码块等
      • Todo list
        • Label
          • 其他
          相关产品与服务
          内容分发网络 CDN
          内容分发网络(Content Delivery Network,CDN)通过将站点内容发布至遍布全球的海量加速节点,使其用户可就近获取所需内容,避免因网络拥堵、跨运营商、跨地域、跨境等因素带来的网络不稳定、访问延迟高等问题,有效提升下载速度、降低响应时间,提供流畅的用户体验。
          领券
          问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档