فهرست منبع

use plaintext language

Yuki Takei 7 سال پیش
والد
کامیت
2581524525
1فایلهای تغییر یافته به همراه2 افزوده شده و 5 حذف شده
  1. 2 5
      src/client/js/util/GrowiRenderer.js

+ 2 - 5
src/client/js/util/GrowiRenderer.js

@@ -1,5 +1,4 @@
 import MarkdownIt from 'markdown-it';
-import xss from 'xss';
 
 import Linker        from './PreProcessor/Linker';
 import CsvToTable    from './PreProcessor/CsvToTable';
@@ -34,8 +33,6 @@ export default class GrowiRenderer {
       { isAutoSetup: true },      // default options
       options || {});             // specified options
 
-    this.xssFilterForCode = new xss.FilterXSS();
-
     // initialize processors
     //  that will be retrieved if originRenderer exists
     this.preProcessors = this.originRenderer.preProcessors || [
@@ -186,12 +183,12 @@ export default class GrowiRenderer {
         }
       }
       else {
-        const escapedCode = this.xssFilterForCode.process(code);
+        const escapedCode = hljs.highlight('plaintext', code, true).value;
         return `<pre class="hljs ${noborder}">${citeTag}<code>${escapedCode}</code></pre>`;
       }
     }
 
-    const escapedCode = this.xssFilterForCode.process(code);
+    const escapedCode = hljs.highlight('plaintext', code, true).value;
     return `<pre class="hljs ${noborder}"><code>${escapedCode}</code></pre>`;
   }