mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2025-09-15 12:58:48 +08:00
feature: 增加 tags 標簽外挂 inlineImg
This commit is contained in:
parent
7bc46c47ed
commit
ae09fb89b5
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hexo-theme-butterfly",
|
"name": "hexo-theme-butterfly",
|
||||||
"version": "3.7.0-b7",
|
"version": "3.7.0-b8",
|
||||||
"description": "A Simple and Card UI Design theme for Hexo",
|
"description": "A Simple and Card UI Design theme for Hexo",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
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 })
|
||||||
6
source/css/_tags/inlineImg.styl
Normal file
6
source/css/_tags/inlineImg.styl
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#article-container
|
||||||
|
.inline-img
|
||||||
|
display: inline
|
||||||
|
margin: 0 3px
|
||||||
|
height: 1.1em
|
||||||
|
vertical-align: text-bottom
|
||||||
Loading…
Reference in New Issue
Block a user