🤖 Merge PR #49964 markdown-it: remove dependency highlight.js (and only keep @types/highlight.js) to resolve vulnerability GHSA-7wwv-vh3v-89cq by @UNIDY2002

* Bump dependency `highlight.js` of `types/markdown-it` from 9.7.0 to 10.4.1

* Add support for changed API of `markdown-it` (https://github.com/markdown-it/markdown-it/issues/626) at 12.0.0

* Revert dependency `highlight.js` to ^9.7.0
(So that the TypeScript version can remain 2.0, and will not break the requirements of the dependents of this library.)

* Adjust test code for types/markdown-it
This commit is contained in:
Xun Sun
2020-12-16 21:27:45 +08:00
committed by GitHub
parent 7530362d17
commit 305f212868
4 changed files with 17 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
// Type definitions for markdown-it v10.0.0
// Type definitions for markdown-it v12.0.2
// Project: https://github.com/markdown-it/markdown-it
// Definitions by: York Yao <https://github.com/plantain-00>
// Robert Coie <https://github.com/rapropos>

View File

@@ -82,12 +82,12 @@ declare namespace MarkdownIt {
/**
* 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. If result starts with <pre... internal wrapper is skipped.
* Highlighter `function (str, lang, attrs)` should return escaped HTML. It can
* also return empty string if the source was not changed and should be escaped
* externally. If result starts with <pre... internal wrapper is skipped.
* @default null
*/
highlight?: ((str: string, lang: string) => string) | null;
highlight?: ((str: string, lang: string, attrs: string) => string) | null;
}
type PluginSimple = (md: MarkdownIt) => void;

View File

@@ -1,7 +1,6 @@
{
"private": true,
"dependencies": {
"highlight.js": "^9.7.0",
"@types/highlight.js": "^9.7.0"
}
}

View File

@@ -46,6 +46,18 @@ import LinkifyIt = require('linkify-it');
quotes: '\u201c\u201d\u2018\u2019' /* “”‘’ */,
highlight: null,
};
// highlight
options = {
html: false,
xhtmlOut: false,
breaks: false,
langPrefix: 'language-',
linkify: false,
typographer: false,
quotes: '\u201c\u201d\u2018\u2019' /* “”‘’ */,
highlight: function(str, lang, attrs) { return ""; },
};
}
{