chore: bump marked version

This commit is contained in:
Oprysk 2021-12-10 15:03:12 +02:00 committed by Oprysk Vyacheslav
parent f82eb53ccf
commit a42d29d5c9
3 changed files with 21 additions and 18 deletions

30
package-lock.json generated
View File

@ -19,7 +19,7 @@
"json-pointer": "^0.6.1", "json-pointer": "^0.6.1",
"lunr": "^2.3.9", "lunr": "^2.3.9",
"mark.js": "^8.11.1", "mark.js": "^8.11.1",
"marked": "^0.7.0", "marked": "^3.0.4",
"mobx-react": "^7.2.0", "mobx-react": "^7.2.0",
"openapi-sampler": "^1.0.1", "openapi-sampler": "^1.0.1",
"path-browserify": "^1.0.1", "path-browserify": "^1.0.1",
@ -58,7 +58,7 @@
"@types/lodash": "^4.14.170", "@types/lodash": "^4.14.170",
"@types/lunr": "^2.3.3", "@types/lunr": "^2.3.3",
"@types/mark.js": "^8.11.5", "@types/mark.js": "^8.11.5",
"@types/marked": "^1.1.0", "@types/marked": "^3.0.1",
"@types/node": "^15.6.1", "@types/node": "^15.6.1",
"@types/prismjs": "^1.16.5", "@types/prismjs": "^1.16.5",
"@types/prop-types": "^15.7.3", "@types/prop-types": "^15.7.3",
@ -3079,9 +3079,9 @@
} }
}, },
"node_modules/@types/marked": { "node_modules/@types/marked": {
"version": "1.2.2", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/@types/marked/-/marked-1.2.2.tgz", "resolved": "https://registry.npmjs.org/@types/marked/-/marked-3.0.3.tgz",
"integrity": "sha512-wLfw1hnuuDYrFz97IzJja0pdVsC0oedtS4QsKH1/inyW9qkLQbXgMUqEQT0MVtUBx3twjWeInUfjQbhBVLECXw==", "integrity": "sha512-ZgAr847Wl68W+B0sWH7F4fDPxTzerLnRuUXjUpp1n4NjGSs8hgPAjAp7NQIXblG34MXTrf5wWkAK8PVJ2LIlVg==",
"dev": true "dev": true
}, },
"node_modules/@types/minimatch": { "node_modules/@types/minimatch": {
@ -12792,14 +12792,14 @@
"integrity": "sha1-GA8fnr74sOY45BZq1S24eb6y/8U=" "integrity": "sha1-GA8fnr74sOY45BZq1S24eb6y/8U="
}, },
"node_modules/marked": { "node_modules/marked": {
"version": "0.7.0", "version": "3.0.8",
"resolved": "https://registry.npmjs.org/marked/-/marked-0.7.0.tgz", "resolved": "https://registry.npmjs.org/marked/-/marked-3.0.8.tgz",
"integrity": "sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg==", "integrity": "sha512-0gVrAjo5m0VZSJb4rpL59K1unJAMb/hm8HRXqasD8VeC8m91ytDPMritgFSlKonfdt+rRYYpP/JfLxgIX8yoSw==",
"bin": { "bin": {
"marked": "bin/marked" "marked": "bin/marked"
}, },
"engines": { "engines": {
"node": ">=0.10.0" "node": ">= 12"
} }
}, },
"node_modules/media-typer": { "node_modules/media-typer": {
@ -21064,9 +21064,9 @@
} }
}, },
"@types/marked": { "@types/marked": {
"version": "1.2.2", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/@types/marked/-/marked-1.2.2.tgz", "resolved": "https://registry.npmjs.org/@types/marked/-/marked-3.0.3.tgz",
"integrity": "sha512-wLfw1hnuuDYrFz97IzJja0pdVsC0oedtS4QsKH1/inyW9qkLQbXgMUqEQT0MVtUBx3twjWeInUfjQbhBVLECXw==", "integrity": "sha512-ZgAr847Wl68W+B0sWH7F4fDPxTzerLnRuUXjUpp1n4NjGSs8hgPAjAp7NQIXblG34MXTrf5wWkAK8PVJ2LIlVg==",
"dev": true "dev": true
}, },
"@types/minimatch": { "@types/minimatch": {
@ -28484,9 +28484,9 @@
"integrity": "sha1-GA8fnr74sOY45BZq1S24eb6y/8U=" "integrity": "sha1-GA8fnr74sOY45BZq1S24eb6y/8U="
}, },
"marked": { "marked": {
"version": "0.7.0", "version": "3.0.8",
"resolved": "https://registry.npmjs.org/marked/-/marked-0.7.0.tgz", "resolved": "https://registry.npmjs.org/marked/-/marked-3.0.8.tgz",
"integrity": "sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg==" "integrity": "sha512-0gVrAjo5m0VZSJb4rpL59K1unJAMb/hm8HRXqasD8VeC8m91ytDPMritgFSlKonfdt+rRYYpP/JfLxgIX8yoSw=="
}, },
"media-typer": { "media-typer": {
"version": "0.3.0", "version": "0.3.0",

View File

@ -85,7 +85,7 @@
"@types/lodash": "^4.14.170", "@types/lodash": "^4.14.170",
"@types/lunr": "^2.3.3", "@types/lunr": "^2.3.3",
"@types/mark.js": "^8.11.5", "@types/mark.js": "^8.11.5",
"@types/marked": "^1.1.0", "@types/marked": "^3.0.1",
"@types/node": "^15.6.1", "@types/node": "^15.6.1",
"@types/prismjs": "^1.16.5", "@types/prismjs": "^1.16.5",
"@types/prop-types": "^15.7.3", "@types/prop-types": "^15.7.3",
@ -163,7 +163,7 @@
"json-pointer": "^0.6.1", "json-pointer": "^0.6.1",
"lunr": "^2.3.9", "lunr": "^2.3.9",
"mark.js": "^8.11.1", "mark.js": "^8.11.1",
"marked": "^0.7.0", "marked": "^3.0.4",
"mobx-react": "^7.2.0", "mobx-react": "^7.2.0",
"openapi-sampler": "^1.0.1", "openapi-sampler": "^1.0.1",
"path-browserify": "^1.0.1", "path-browserify": "^1.0.1",

View File

@ -1,3 +1,4 @@
import * as React from 'react';
import * as marked from 'marked'; import * as marked from 'marked';
import { highlight, safeSlugify, unescapeHTMLChars } from '../utils'; import { highlight, safeSlugify, unescapeHTMLChars } from '../utils';
@ -56,10 +57,12 @@ export class MarkdownRenderer {
headings: MarkdownHeading[] = []; headings: MarkdownHeading[] = [];
currentTopHeading: MarkdownHeading; currentTopHeading: MarkdownHeading;
public parser: marked.Parser; // required initialization, `parser` is used by `marked.Renderer` instance under the hood
private headingEnhanceRenderer: marked.Renderer; private headingEnhanceRenderer: marked.Renderer;
private originalHeadingRule: typeof marked.Renderer.prototype.heading; private originalHeadingRule: typeof marked.Renderer.prototype.heading;
constructor(public options?: RedocNormalizedOptions) { constructor(public options?: RedocNormalizedOptions) {
this.parser = new marked.Parser();
this.headingEnhanceRenderer = new marked.Renderer(); this.headingEnhanceRenderer = new marked.Renderer();
this.originalHeadingRule = this.headingEnhanceRenderer.heading.bind( this.originalHeadingRule = this.headingEnhanceRenderer.heading.bind(
this.headingEnhanceRenderer, this.headingEnhanceRenderer,
@ -129,7 +132,7 @@ export class MarkdownRenderer {
level: 1 | 2 | 3 | 4 | 5 | 6, level: 1 | 2 | 3 | 4 | 5 | 6,
raw: string, raw: string,
slugger: marked.Slugger, slugger: marked.Slugger,
) => { ): string => {
if (level === 1) { if (level === 1) {
this.currentTopHeading = this.saveHeading(text, level); this.currentTopHeading = this.saveHeading(text, level);
} else if (level === 2) { } else if (level === 2) {