|
|
@ -158,7 +158,8 @@ function normalizeLinkText(url) { |
|
|
|
* `['«\xA0', '\xA0»', '‹\xA0', '\xA0›']` for French (including nbsp). |
|
|
|
* - __highlight__ - `null`. Highlighter function for fenced code blocks. |
|
|
|
* Highlighter `function (str, lang)` should return escaped HTML. It can also |
|
|
|
* return empty string if the source was not changed and should be escaped externaly. |
|
|
|
* return empty string if the source was not changed and should be escaped |
|
|
|
* externaly. If result starts with <pre... internal wrapper is skipped. |
|
|
|
* |
|
|
|
* ##### Example |
|
|
|
* |
|
|
@ -190,14 +191,32 @@ function normalizeLinkText(url) { |
|
|
|
* } catch (__) {} |
|
|
|
* } |
|
|
|
* |
|
|
|
* try { |
|
|
|
* return hljs.highlightAuto(str).value; |
|
|
|
* } catch (__) {} |
|
|
|
* |
|
|
|
* return ''; // use external default escaping
|
|
|
|
* } |
|
|
|
* }); |
|
|
|
* ``` |
|
|
|
* |
|
|
|
* Or with full wrapper override (if you need assign class to <pre>): |
|
|
|
* |
|
|
|
* ```javascript
|
|
|
|
* var hljs = require('highlight.js') // https://highlightjs.org/
|
|
|
|
* |
|
|
|
* // Actual default values
|
|
|
|
* var md = require('markdown-it')({ |
|
|
|
* highlight: function (str, lang) { |
|
|
|
* if (lang && hljs.getLanguage(lang)) { |
|
|
|
* try { |
|
|
|
* return '<pre class="hljs"><code>' + |
|
|
|
* hljs.highlight(lang, str).value + |
|
|
|
* '</code></pre>'; |
|
|
|
* } catch (__) {} |
|
|
|
* } |
|
|
|
* |
|
|
|
* return '<pre class="hljs"><code>' + md.utils.esccapeHtml(str) + '</code></pre>'; |
|
|
|
* } |
|
|
|
* }); |
|
|
|
* ``` |
|
|
|
* |
|
|
|
**/ |
|
|
|
function MarkdownIt(presetName, options) { |
|
|
|
if (!(this instanceof MarkdownIt)) { |
|
|
|