mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2025-09-15 12:58:48 +08:00
improvement: 文章頁標題改為h1(seo) improvement: 改用hexo 內置的 injector 插入 inject 的代碼 improvement: canonical 改為hexo提供的函數生成 improvement: 優化手機toc 的特效和按鈕出現的時機 remove: 刪除搜索不必要的配置 remove: 移除豆瓣配置,如需配置,請使用 hexo-butterfly-douban fix: 修復上一個版本導致的搜索按鈕在pjax下無法點擊的bugs close #387 fix: 修復上一個版本更新的toc z-index 過低的bugs
28 lines
805 B
JavaScript
28 lines
805 B
JavaScript
/**
|
|
* note.js
|
|
* transplant from hexo-theme-next
|
|
* Modify by Jerry
|
|
*/
|
|
|
|
'use strict'
|
|
|
|
function postNote (args, content) {
|
|
const styleConfig = hexo.theme.config.note.style
|
|
const lastArgs = args[args.length - 1]
|
|
if (!(lastArgs === 'flat' || lastArgs === 'modern' || lastArgs === 'simple' || lastArgs === 'disabled')) {
|
|
args.push(styleConfig)
|
|
}
|
|
|
|
let icon = ''
|
|
const iconArray = args[args.length - 2]
|
|
if (iconArray && iconArray.startsWith('fa')) {
|
|
icon = `<i class="note-icon ${iconArray}"></i>`
|
|
args[args.length - 2] = 'icon'
|
|
}
|
|
|
|
return `<div class="note ${args.join(' ')}">${icon + hexo.render.renderSync({ text: content, engine: 'markdown' })}</div>`
|
|
}
|
|
|
|
hexo.extend.tag.register('note', postNote, { ends: true })
|
|
hexo.extend.tag.register('subnote', postNote, { ends: true })
|