mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-12 22:17:06 +08:00
feat: 支持abcjs乐谱渲染
- 添加相关可配置选项 - 添加渲染与组件注册相关脚本 - 添加默认cdn配置
This commit is contained in:
22
scripts/tag/score.js
Normal file
22
scripts/tag/score.js
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Music Score
|
||||
* {% score %}
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
function score(args, content) {
|
||||
function escapeHtmlTags(s) {
|
||||
let lookup = {
|
||||
'&': "&",
|
||||
'"': """,
|
||||
'\'': "'",
|
||||
'<': "<",
|
||||
'>': ">"
|
||||
};
|
||||
return s.replace(/[&"'<>]/g, c => lookup[c]);
|
||||
}
|
||||
return `<div class="abc-music-sheet">${escapeHtmlTags(content)}</div>`;
|
||||
}
|
||||
|
||||
hexo.extend.tag.register('score', score, {ends: true});
|
||||
Reference in New Issue
Block a user