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.
35 lines
1.0 KiB
35 lines
1.0 KiB
'use strict'; |
|
|
|
function postBtns(args, content) { |
|
return `<div class="btns ${args.join(' ')}"> |
|
${hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('')} |
|
</div>`; |
|
} |
|
|
|
function postCell(args, content) { |
|
args = args.join(' ').split(',') |
|
let text = args[0] || '' |
|
let url = args[1] || '' |
|
text = text.trim() |
|
url = url.trim() |
|
if (url.length > 0) { |
|
url = "href='" + url + "'" |
|
} |
|
let icon = '' |
|
let img = 'https://cdn.jsdelivr.net/gh/xaoxuu/cdn-assets/placeholder/d570170f4f12e1ee829ca0e85a7dffeb77343a.svg' |
|
if (args.length > 2) { |
|
if (args[2].indexOf(' fa-') > -1) { |
|
icon = args[2].trim() |
|
} else { |
|
img = args[2].trim() |
|
} |
|
} |
|
if (icon.length > 0) { |
|
return `<p class='cell'><a ${url} title='${text}'><i class='${icon}'></i>${text}</a></p>` |
|
} else { |
|
return `<p class='cell'><a ${url} title='${text}'><img src='${img}'>${text}</a></p>` |
|
} |
|
} |
|
|
|
hexo.extend.tag.register('btns', postBtns, {ends: true}); |
|
hexo.extend.tag.register('cell', postCell);
|
|
|