-
-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
159 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* global hexo */ | ||
|
||
'use strict' | ||
|
||
const noteTag = require('./note')(hexo) | ||
hexo.extend.tag.register('note', noteTag, true) | ||
hexo.extend.tag.register('keep-note', noteTag, true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict' | ||
|
||
module.exports = (ctx) => | ||
function (args, content) { | ||
const keywords = ['default', 'primary', 'info', 'success', 'warning', 'danger'] | ||
let typeClassName = 'default' | ||
|
||
if (args[0] && keywords.includes(args[0])) { | ||
typeClassName = args[0] | ||
} | ||
|
||
let noteTitleContent = '' | ||
if (args[1]) { | ||
noteTitleContent = `<div class="keep-note-title">${args[1]}</div>` | ||
} | ||
|
||
content = ctx.render.renderSync({ text: content, engine: 'markdown' }) | ||
|
||
return `<div class="keep-note ${typeClassName}">${noteTitleContent}${content}</div>` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
.keep-note { | ||
position relative | ||
box-sizing border-box | ||
width 100% | ||
margin-bottom 2rem | ||
padding 0.8rem 1rem | ||
font-size 0.9rem | ||
border-style solid | ||
border-width 0.1rem | ||
border-radius 0.4rem | ||
|
||
&.default { | ||
color var(--note-default-color) | ||
background-color var(--note-default-background-color) | ||
border-color var(--note-default-border-color) | ||
} | ||
|
||
|
||
&.primary { | ||
color var(--note-primary-color) | ||
background-color var(--note-primary-background-color) | ||
border-color var(--note-primary-border-color) | ||
} | ||
|
||
|
||
&.success { | ||
color var(--note-success-color) | ||
background-color var(--note-success-background-color) | ||
border-color var(--note-success-border-color) | ||
} | ||
|
||
|
||
&.warning { | ||
color var(--note-warning-color) | ||
background-color var(--note-warning-background-color) | ||
border-color var(--note-warning-border-color) | ||
} | ||
|
||
|
||
&.danger { | ||
color var(--note-danger-color) | ||
background-color var(--note-danger-background-color) | ||
border-color var(--note-danger-border-color) | ||
} | ||
|
||
|
||
.keep-note-title { | ||
box-sizing border-box | ||
padding 0.6rem 0 0 0 | ||
color inherit | ||
font-weight 600 | ||
font-size 1rem | ||
} | ||
|
||
|
||
p { | ||
color inherit | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters