feature: 增加 tags 標簽外挂 inlineImg

This commit is contained in:
Jerry
2021-03-15 20:44:35 +08:00
parent 7bc46c47ed
commit ae09fb89b5
3 changed files with 24 additions and 1 deletions

17
scripts/tag/inlineImg.js Normal file
View File

@@ -0,0 +1,17 @@
/**
* inlineImg 圖片
* {% inlineImg src height %}
*/
'use strict'
const urlFor = require('hexo-util').url_for.bind(hexo)
function inlineImg (args) {
const img = args[0]
const height = args[1] ? `style="height:${args[1]}"` : ''
return `<img class="inline-img" src="${urlFor(img)}" ${height}/>`
}
hexo.extend.tag.register('inlineImg', inlineImg, { ends: false })