Bläddra i källkod

website: remove double-escaping of inline code blocks

Renée Kooi 5 år sedan
förälder
incheckning
b44bc21c09
1 ändrade filer med 0 tillägg och 9 borttagningar
  1. 0 9
      website/scripts/highlight.js

+ 0 - 9
website/scripts/highlight.js

@@ -13,16 +13,8 @@ global.Prism = Prism
 require('prismjs/components/')()
 delete global.Prism
 
-const rawInlineCodeRx = /<code>([^\n]+?)<\/code>/ig
 const unhighlightedCodeRx = /<pre><code class="([^"]*)?">([\s\S]*?)<\/code><\/pre>/igm
 
-function escapeInlineCodeBlocks (data) {
-  data.content = data.content.replace(rawInlineCodeRx, (_, code) => {
-    return `<code>${entities.encode(code)}</code>`
-  })
-  return data
-}
-
 function highlight (lang, code) {
   const startTag = `<figure class="highlight ${lang}"><table><tr><td class="code"><pre>`
   const endTag = `</pre></td></tr></table></figure>`
@@ -69,7 +61,6 @@ hexo.extend.tag.register('codeblock', code, true)
 hexo.extend.tag.register('include_code', includeCode, { async: true })
 hexo.extend.tag.register('include-code', includeCode, { async: true })
 
-hexo.extend.filter.register('after_post_render', escapeInlineCodeBlocks)
 // Hexo includes its own code block handling by default which may
 // cause the above to miss some things, so do another pass when the page
 // is done rendering to pick up any code blocks we may have missed.