From 07069a861c6dba3e8c41738c1cd979dfc5182e9b Mon Sep 17 00:00:00 2001 From: UNIDY2002 Date: Sat, 5 Dec 2020 14:46:29 +0800 Subject: [PATCH 1/4] Bump dependency `highlight.js` of `types/markdown-it` from 9.7.0 to 10.4.1 --- types/markdown-it/index.d.ts | 4 ++-- types/markdown-it/package.json | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/types/markdown-it/index.d.ts b/types/markdown-it/index.d.ts index e4b46fb49aa2f9..f447ffb372d5f2 100644 --- a/types/markdown-it/index.d.ts +++ b/types/markdown-it/index.d.ts @@ -1,10 +1,10 @@ -// 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 // Robert Coie // duduluu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.0 +// TypeScript Version: 3.6 import MarkdownIt = require('./lib'); diff --git a/types/markdown-it/package.json b/types/markdown-it/package.json index 8e8e452b5d49d6..b715d730670289 100644 --- a/types/markdown-it/package.json +++ b/types/markdown-it/package.json @@ -1,7 +1,6 @@ { "private": true, "dependencies": { - "highlight.js": "^9.7.0", - "@types/highlight.js": "^9.7.0" + "highlight.js": "10.4.1" } } From dfd08bb4df4712c759f4b83d503c250c5d2cc769 Mon Sep 17 00:00:00 2001 From: UNIDY2002 Date: Sat, 5 Dec 2020 14:48:00 +0800 Subject: [PATCH 2/4] Add support for changed API of `markdown-it` (https://github.com/markdown-it/markdown-it/issues/626) at 12.0.0 --- types/markdown-it/lib/index.d.ts | 8 ++++---- types/markdown-it/test/index.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/types/markdown-it/lib/index.d.ts b/types/markdown-it/lib/index.d.ts index fda1d248683a06..126f8518335876 100644 --- a/types/markdown-it/lib/index.d.ts +++ b/types/markdown-it/lib/index.d.ts @@ -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 string) | null; + highlight?: ((str: string, lang: string, attrs: string) => string) | null; } type PluginSimple = (md: MarkdownIt) => void; diff --git a/types/markdown-it/test/index.ts b/types/markdown-it/test/index.ts index d818113c85bbe6..6cb0cbb20a633f 100644 --- a/types/markdown-it/test/index.ts +++ b/types/markdown-it/test/index.ts @@ -44,7 +44,7 @@ import LinkifyIt = require('linkify-it'); linkify: false, typographer: false, quotes: '\u201c\u201d\u2018\u2019' /* “”‘’ */, - highlight: null, + highlight: function(str, lang, attrs) { return ""; }, }; } From c0cf2db47ecac40ae656b9830bd6d26c42a27083 Mon Sep 17 00:00:00 2001 From: UNIDY2002 Date: Sat, 5 Dec 2020 16:20:31 +0800 Subject: [PATCH 3/4] 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.) --- types/markdown-it/index.d.ts | 2 +- types/markdown-it/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/markdown-it/index.d.ts b/types/markdown-it/index.d.ts index f447ffb372d5f2..03fab3f815b275 100644 --- a/types/markdown-it/index.d.ts +++ b/types/markdown-it/index.d.ts @@ -4,7 +4,7 @@ // Robert Coie // duduluu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.6 +// TypeScript Version: 2.0 import MarkdownIt = require('./lib'); diff --git a/types/markdown-it/package.json b/types/markdown-it/package.json index b715d730670289..68c2ce3ccd7c52 100644 --- a/types/markdown-it/package.json +++ b/types/markdown-it/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "highlight.js": "10.4.1" + "@types/highlight.js": "^9.7.0" } } From f6e7cf5ec78bd152393f847e4dd60a0761b7830a Mon Sep 17 00:00:00 2001 From: UNIDY2002 Date: Sat, 5 Dec 2020 16:36:12 +0800 Subject: [PATCH 4/4] Adjust test code for types/markdown-it --- types/markdown-it/test/index.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/types/markdown-it/test/index.ts b/types/markdown-it/test/index.ts index 6cb0cbb20a633f..0272444c27ab89 100644 --- a/types/markdown-it/test/index.ts +++ b/types/markdown-it/test/index.ts @@ -36,6 +36,18 @@ import LinkifyIt = require('linkify-it'); }; // default + options = { + html: false, + xhtmlOut: false, + breaks: false, + langPrefix: 'language-', + linkify: false, + typographer: false, + quotes: '\u201c\u201d\u2018\u2019' /* “”‘’ */, + highlight: null, + }; + + // highlight options = { html: false, xhtmlOut: false,