You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
846 B

4 years ago
/**
* note.js
* transplant from hexo-theme-next
*/
'use strict';
4 years ago
function postNote(args) {
args = args.join(' ').split(',')
4 years ago
if (args.length > 1) {
let cls = args[0].trim()
let text = args[1].trim()
return `<div class="note ${cls}">${hexo.render.renderSync({text: text, engine: 'markdown'}).split('\n').join('')}</div>`;
} else if (args.length > 0) {
let text = args[0].trim()
return `<div class="note">${hexo.render.renderSync({text: text, engine: 'markdown'}).split('\n').join('')}</div>`;
}
4 years ago
}
function postNoteBlock(args, content) {
4 years ago
return `<div class="note ${args.join(' ')}">
${hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('')}
</div>`;
}
4 years ago
hexo.extend.tag.register('note', postNote);
hexo.extend.tag.register('noteblock', postNoteBlock, {ends: true});