mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-12 22:17:06 +08:00
feature: 增加 tags 標簽外挂 inlineImg
This commit is contained in:
17
scripts/tag/inlineImg.js
Normal file
17
scripts/tag/inlineImg.js
Normal 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 })
|
||||
Reference in New Issue
Block a user