提交 c9d5e81c 编写于 作者: EvanOne(文一)'s avatar EvanOne(文一)

feat: Add tag plugin of 'note'

上级 1d86188a
......@@ -86,3 +86,37 @@ Hexo 主题一般都会扩展一些自己特有的标签插件,在这方面做
3. 重启 Hexo 服务器,效果如下。
![](https://raw.githubusercontent.com/liuyib/picBed/master/hexo-theme-stun/doc/20190802171506.png)
### Bootstrap 标注 <Badge text="stable"/> <Badge text="v1.2.0"/>
语法如下:
```
{% note [type] [no-icon] %}
**header text**
any text
{% endnote %}
```
> 标签内可以是任意文字,支持 markdown 和 HTML 语法。
参数:
`[type]`:标注类型
`[no-icon]`:是否显示 ICON
举例:
```
{% note success %}
**Success**
This is success note.
{% endnote %}
```
全部效果如下:
![](https://raw.githubusercontent.com/liuyib/picBed/master/hexo-theme-stun/doc/20190802221712.png)
/* global hexo */
'use strict';
function note(args, content) {
return `<div class="note-plugin ${args.join(' ')}">
${hexo.render
.renderSync({ text: content, engine: 'markdown' })
.split('\n')
.join('')}
</div>`;
}
hexo.extend.tag.register('note', note, { ends: true });
......@@ -11,3 +11,4 @@
@import './copy.styl'
@import './analytics/index.styl'
@import './search/index.styl'
@import './tag-plugin/index.styl'
.note-plugin
position: relative
margin: 1rem 0
border: 1px solid #eee
border-left-width: .35rem
padding: 0 1rem
line-height: 1.7em
&:not(.no-icon)
padding-left: 2rem
&::before
position: absolute
top: .8em
left: .6rem
font-family: 'FontAwesome'
font-size: $font-size-base + 6px
&.default::before
content: '\f0a9'
color: #777
&.success::before
content: '\f058'
color: #5cb85c
&.warning::before
content: '\f06a'
color: #f0ad4e
&.danger::before
content: '\f056'
color: #d9534f
&.default
border-left-color: #777
strong
color: #777
&.success
border-left-color: #5cb85c
strong
color: #5cb85c
&.warning
border-left-color: #f0ad4e
strong
color: #f0ad4e
&.danger
border-left-color: #d9534f
strong
color: #d9534f
h1, h2, h3, h4, h5, h6
margin: 0
strong
font-size: $font-size-base + 6px
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册