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

View File

@ -1,6 +1,6 @@
{
"name": "hexo-theme-butterfly",
"version": "3.7.0-b7",
"version": "3.7.0-b8",
"description": "A Simple and Card UI Design theme for Hexo",
"main": "package.json",
"scripts": {

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 })

View File

@ -0,0 +1,6 @@
#article-container
.inline-img
display: inline
margin: 0 3px
height: 1.1em
vertical-align: text-bottom