Compare commits

..
3 changed files with 9 additions and 8 deletions

No files matched your search

+1 -1
View File
@@ -151,7 +151,7 @@ Thanks to all the developers who have contributed to the Butterfly theme!
## ⭐ Star History
[![Star History Chart](https://api.star-history.com/svg?repos=jerryc127/hexo-theme-butterfly&type=Date)](https://star-history.com/#jerryc127/hexo-theme-butterfly&Date)
[![Star History Chart](https://star-history.dera.page/svg?repos=jerryc127/hexo-theme-butterfly&type=Date)](https://star-history.dera.page/#jerryc127/hexo-theme-butterfly&Date)
## 🤝 Building a Better Theme Together
+1 -1
View File
@@ -151,7 +151,7 @@ npm install hexo-renderer-pug hexo-renderer-stylus --save
## ⭐ Star 趨勢
[![Star History Chart](https://api.star-history.com/svg?repos=jerryc127/hexo-theme-butterfly&type=Date)](https://star-history.com/#jerryc127/hexo-theme-butterfly&Date)
[![Star History Chart](https://star-history.dera.page/svg?repos=jerryc127/hexo-theme-butterfly&type=Date)](https://star-history.dera.page/#jerryc127/hexo-theme-butterfly&Date)
## 🤝 一起構建更美好的主題
+7 -6
View File
@@ -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('')