diff --git a/README.md b/README.md index 4bede02..46e7aff 100644 --- a/README.md +++ b/README.md @@ -161,7 +161,7 @@ var md = require('markdown-it')({ }); ``` -Or with full wrapper override (if you need assign class to `
`): +Or with full wrapper override (if you need assign class to `` or ``): ```js var hljs = require('highlight.js'); // https://highlightjs.org @@ -171,13 +171,13 @@ var md = require('markdown-it')({ highlight: function (str, lang) { if (lang && hljs.getLanguage(lang)) { try { - return '
' + + return '
'; } catch (__) {} } - return '' + hljs.highlight(str, { language: lang, ignoreIllegals: true }).value + '
'; + return '' + md.utils.escapeHtml(str) + '
'; } }); ``` diff --git a/lib/index.js b/lib/index.js index afec8d8..6c482b4 100644 --- a/lib/index.js +++ b/lib/index.js @@ -197,7 +197,7 @@ function normalizeLinkText(url) { * }); * ``` * - * Or with full wrapper override (if you need assign class to `' + md.utils.escapeHtml(str) + '
`): + * Or with full wrapper override (if you need assign class to `` or ``): * * ```javascript * var hljs = require('highlight.js') // https://highlightjs.org/ @@ -207,13 +207,13 @@ function normalizeLinkText(url) { * highlight: function (str, lang) { * if (lang && hljs.getLanguage(lang)) { * try { - * return '
' + + * return '
'; * } catch (__) {} * } * - * return '' + * hljs.highlight(str, { language: lang, ignoreIllegals: true }).value + * '
'; + * return '' + md.utils.escapeHtml(str) + '
'; * } * }); * ``` diff --git a/support/api_header.md b/support/api_header.md index 6e1fb73..92e2cc1 100644 --- a/support/api_header.md +++ b/support/api_header.md @@ -126,7 +126,7 @@ var md = require('markdown-it')({ }); ``` -Or with full wrapper override (if you need assign class to `' + md.utils.escapeHtml(str) + '
`): +Or with full wrapper override (if you need assign class to `` or ``): ```js var hljs = require('highlight.js') // https://highlightjs.org/ @@ -136,13 +136,13 @@ var md = require('markdown-it')({ highlight: function (str, lang) { if (lang && hljs.getLanguage(lang)) { try { - return '
' + + return '
'; } catch (__) {} } - return '' + hljs.highlight(str, { language: lang, ignoreIllegals: true }).value + '
'; + return '' + md.utils.escapeHtml(str) + '
'; } }); ``` diff --git a/support/demo_template/index.js b/support/demo_template/index.js index 8ecc764..f8340f1 100644 --- a/support/demo_template/index.js +++ b/support/demo_template/index.js @@ -107,7 +107,7 @@ defaults.highlight = function (str, lang) { } } catch (__) { /**/ } - return '' + md.utils.escapeHtml(str) + '
'; + return '' + esc(str) + '
'; }; function setOptionClass(name, val) {' + esc(str) + '