Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
大白技术控
yanglr2010
提交
2fab025b
Y
yanglr2010
项目概览
大白技术控
/
yanglr2010
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
yanglr2010
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
2fab025b
编写于
2月 25, 2020
作者:
EvanOne(文一)
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: Add 'info' note plugin & make icon of note plugin configurable
上级
2aabf55f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
85 addition
and
38 deletion
+85
-38
_config.yml
_config.yml
+5
-0
scripts/tags/note.js
scripts/tags/note.js
+27
-2
source/css/_common/components/plugins/note.styl
source/css/_common/components/plugins/note.styl
+46
-36
source/css/_variables/index.styl
source/css/_variables/index.styl
+7
-0
未找到文件。
_config.yml
浏览文件 @
2fab025b
...
...
@@ -820,6 +820,11 @@ icon:
prompt_error
:
fas fa-times-circle
valine_visitor
:
fas fa-eye
post_heading
:
fas fa-link
notetag_default
:
fas fa-arrow-circle-right
notetag_success
:
fas fa-check-circle
notetag_info
:
fas fa-info-circle
notetag_warning
:
fas fa-exclamation-circle
notetag_danger
:
fas fa-minus-circle
# Set a CDN address for the vendor you want to customize.
# ! -------------------------------------------------------------------
...
...
scripts/tags/note.js
浏览文件 @
2fab025b
...
...
@@ -3,9 +3,34 @@
'
use strict
'
;
function
note
(
args
,
content
)
{
var
noteClassName
=
args
.
join
(
'
'
);
var
theme
=
hexo
.
theme
.
config
;
var
icon
=
theme
.
icon
&&
theme
.
icon
.
notetag_default
;
var
iconType
=
'
default
'
;
var
isIcon
=
true
;
if
(
args
.
includes
(
'
no-icon
'
))
{
isIcon
=
false
;
}
if
(
isIcon
&&
theme
.
icon
)
{
var
tagTypes
=
[
'
default
'
,
'
success
'
,
'
info
'
,
'
warning
'
,
'
danger
'
];
tagTypes
.
forEach
(
type
=>
{
if
(
args
.
includes
(
type
))
{
icon
=
theme
.
icon
[
`notetag_
${
type
}
`
];
iconType
=
type
;
}
});
}
var
className
=
args
.
join
(
'
'
);
return
`
<div class="note-plugin
${
noteClassName
}
">
<div class="note-plugin
${
className
}
">
${
isIcon
?
`<span class="note-plugin__icon note-plugin__icon--
${
iconType
}
">
<i class="
${
icon
}
"></i>
</span>`
:
''
}
${
hexo
.
render
.
renderSync
({
text
:
content
,
engine
:
'
markdown
'
})
.
split
(
'
\n
'
)
...
...
source/css/_common/components/plugins/note.styl
浏览文件 @
2fab025b
$note-padding = 12px;
$note-icon-size = $font-size-base + 4px;
.note-plugin {
position: relative;
margin
: 0 0 1rem
;
margin
-bottom: 20px
;
border: 1px solid var(--color-gray-250);
border-left-width: .35rem;
padding: 0 1rem;
line-height: 1.7em;
border-left-width: 6px;
padding: 0 $note-padding + 5px;
&:not(.no-icon) {
padding-left: 40px;
}
h1,
h2,
...
...
@@ -16,75 +22,79 @@
}
p {
margin:
1em
0;
margin:
$note-padding
0;
}
strong {
font-size: $font-size-base + 6px;
font-size: $note-icon-size;
line-height: 1.75;
}
&:not(.no-icon) {
padding-left: 2rem;
&::before {
position: absolute;
top: 1.5rem;
left: .6rem;
fontawesome-base();
font-size: $font-size-base + 6px;
transform: translateY(-50%);
&__icon {
position: absolute;
top: 1em;
left: 12px;
font-size: $note-icon-size;
line-height: 1;
&--default {
color: $note-default-color;
}
&.default::before {
content: $icon-note-default;
color: var(--color-gray-650);
&--success {
color: $note-success-color;
}
&.success::before {
content: $icon-note-success;
color: #42b983;
&--info {
color: $note-info-color;
}
&.warning::before {
content: $icon-note-warning;
color: #e7c000;
&--warning {
color: $note-warning-color;
}
&.danger::before {
content: $icon-note-danger;
color: #dc3b3b;
&--danger {
color: $note-danger-color;
}
}
&.default {
border-left-color:
var(--color-gray-650)
;
border-left-color:
$note-default-color
;
strong {
color:
var(--color-gray-650)
;
color:
$note-default-color
;
}
}
&.success {
border-left-color: #42b983;
border-left-color: $note-success-color;
strong {
color: $note-success-color;
}
}
&.info {
border-left-color: $note-info-color;
strong {
color:
#42b983
;
color:
$note-info-color
;
}
}
&.warning {
border-left-color:
#e7c000
;
border-left-color:
$note-warning-color
;
strong {
color:
#e7c000
;
color:
$note-warning-color
;
}
}
&.danger {
border-left-color:
#dc3b3b
;
border-left-color:
$note-danger-color
;
strong {
color:
#dc3b3b
;
color:
$note-danger-color
;
}
}
}
source/css/_variables/index.styl
浏览文件 @
2fab025b
...
...
@@ -182,3 +182,10 @@ $alert-success-color = #52c41a
$alert-info-color = #1890ff
$alert-warning-color = #faad14
$alert-error-color = #f5222d
// Note plugin
$note-default-color = var(--color-gray-600)
$note-success-color = #42b983
$note-info-color = #4898dd
$note-warning-color = #e7c000
$note-danger-color = #dc3b3b
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录