mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-10-05 06:32:00 +08:00
Compare commits
4
Commits
No files matched your search
@@ -151,7 +151,7 @@ Thanks to all the developers who have contributed to the Butterfly theme!
|
||||
|
||||
## ⭐ Star History
|
||||
|
||||
[](https://star-history.com/#jerryc127/hexo-theme-butterfly&Date)
|
||||
[](https://star-history.dera.page/#jerryc127/hexo-theme-butterfly&Date)
|
||||
|
||||
## 🤝 Building a Better Theme Together
|
||||
|
||||
|
||||
+1
-1
@@ -151,7 +151,7 @@ npm install hexo-renderer-pug hexo-renderer-stylus --save
|
||||
|
||||
## ⭐ Star 趨勢
|
||||
|
||||
[](https://star-history.com/#jerryc127/hexo-theme-butterfly&Date)
|
||||
[](https://star-history.dera.page/#jerryc127/hexo-theme-butterfly&Date)
|
||||
|
||||
## 🤝 一起構建更美好的主題
|
||||
|
||||
|
||||
@@ -6,23 +6,24 @@
|
||||
|
||||
const { url_for, escapeHTML } = require('hexo-util')
|
||||
const urlFor = url_for.bind(hexo)
|
||||
const safeEscape = value => escapeHTML(value == null ? '' : String(value))
|
||||
|
||||
const flinkFn = (args, content) => {
|
||||
const data = hexo.render.renderSync({ text: content, engine: 'yaml' })
|
||||
let result = ''
|
||||
|
||||
data.forEach(item => {
|
||||
const className = item.class_name ? `<div class="flink-name">${escapeHTML(item.class_name)}</div>` : ''
|
||||
const classDesc = item.class_desc ? `<div class="flink-desc">${escapeHTML(item.class_desc)}</div>` : ''
|
||||
const className = item.class_name ? `<div class="flink-name">${safeEscape(item.class_name)}</div>` : ''
|
||||
const classDesc = item.class_desc ? `<div class="flink-desc">${safeEscape(item.class_desc)}</div>` : ''
|
||||
|
||||
const listResult = item.link_list.map(link => `
|
||||
<div class="flink-list-item">
|
||||
<a href="${escapeHTML(link.link)}" title="${escapeHTML(link.name)}" target="_blank">
|
||||
<a href="${safeEscape(link.link)}" title="${safeEscape(link.name)}" target="_blank">
|
||||
<div class="flink-item-icon">
|
||||
<img class="no-lightbox" src="${escapeHTML(link.avatar)}" onerror='this.onerror=null;this.src="${urlFor(hexo.theme.config.error_img.flink)}"' alt="${escapeHTML(link.name)}" />
|
||||
<img class="no-lightbox" src="${safeEscape(link.avatar)}" onerror='this.onerror=null;this.src="${urlFor(hexo.theme.config.error_img.flink)}"' alt="${safeEscape(link.name)}" />
|
||||
</div>
|
||||
<div class="flink-item-name">${escapeHTML(link.name)}</div>
|
||||
<div class="flink-item-desc" title="${escapeHTML(link.descr)}">${escapeHTML(link.descr)}</div>
|
||||
<div class="flink-item-name">${safeEscape(link.name)}</div>
|
||||
<div class="flink-item-desc" title="${safeEscape(link.descr)}">${safeEscape(link.descr)}</div>
|
||||
</a>
|
||||
</div>`).join('')
|
||||
|
||||
|
||||
Reference in new issue
Block a user