feat: 支持abcjs乐谱渲染

- 添加相关可配置选项
 - 添加渲染与组件注册相关脚本
 - 添加默认cdn配置
This commit is contained in:
LittleNyima
2023-03-28 14:14:15 +08:00
parent 63dc605794
commit b34eeb0425
5 changed files with 61 additions and 0 deletions

22
scripts/tag/score.js Normal file
View File

@@ -0,0 +1,22 @@
/**
* Music Score
* {% score %}
*/
'use strict';
function score(args, content) {
function escapeHtmlTags(s) {
let lookup = {
'&': "&",
'"': """,
'\'': "'",
'<': "&lt;",
'>': "&gt;"
};
return s.replace(/[&"'<>]/g, c => lookup[c]);
}
return `<div class="abc-music-sheet">${escapeHtmlTags(content)}</div>`;
}
hexo.extend.tag.register('score', score, {ends: true});