docs: support data field in playground.html

This commit is contained in:
harttle
2021-06-20 21:26:16 +08:00
parent 1c64ff051e
commit f7313fe563
5 changed files with 45 additions and 21 deletions
+6 -1
View File
@@ -37,7 +37,12 @@ hexo.extend.helper.register('page_nav', function () {
})
hexo.extend.helper.register('raw', function (filepath) {
const content = readFileSync(resolve(this.view_dir, filepath))
const content = readFileSync(resolve(this.view_dir, filepath), 'utf8')
.replace(/&/g, '&')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;')
return content
})