Skip to content

Commit

Permalink
🤖 Merge PR #49964 markdown-it: remove dependency highlight.js (and …
Browse files Browse the repository at this point in the history
…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` (markdown-it/markdown-it#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
  • Loading branch information
UNIDY2002 committed Dec 16, 2020
1 parent 7530362 commit 305f212
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion types/markdown-it/index.d.ts
@@ -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>
Expand Down
8 changes: 4 additions & 4 deletions types/markdown-it/lib/index.d.ts
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion types/markdown-it/package.json
@@ -1,7 +1,6 @@
{
"private": true,
"dependencies": {
"highlight.js": "^9.7.0",
"@types/highlight.js": "^9.7.0"
}
}
12 changes: 12 additions & 0 deletions types/markdown-it/test/index.ts
Expand Up @@ -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 ""; },
};
}

{
Expand Down

0 comments on commit 305f212

Please sign in to comment.