From ec5c0f95e7de2ff5605a1b384c9345f069b8b76a Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Wed, 2 Jan 2019 07:39:49 +0100 Subject: [PATCH] chore: update marked to version 0.6.0 --- package.json | 4 ++-- src/services/MarkdownRenderer.ts | 4 +++- yarn.lock | 15 ++++++++------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index a0c7d83375..a622346f24 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "@types/lodash": "^4.14.118", "@types/lunr": "^2.1.6", "@types/mark.js": "^8.11.1", - "@types/marked": "^0.4.2", + "@types/marked": "^0.5.0", "@types/prismjs": "^1.6.4", "@types/prop-types": "^15.5.6", "@types/react": "^16.7.7", @@ -139,7 +139,7 @@ "json-schema-ref-parser": "^6.0.1", "lunr": "^2.3.2", "mark.js": "^8.11.1", - "marked": "^0.5.2", + "marked": "^0.6.0", "memoize-one": "^4.0.0", "mobx-react": "^5.2.5", "openapi-sampler": "1.0.0-beta.14", diff --git a/src/services/MarkdownRenderer.ts b/src/services/MarkdownRenderer.ts index a944dac3e7..19a33789e2 100644 --- a/src/services/MarkdownRenderer.ts +++ b/src/services/MarkdownRenderer.ts @@ -50,9 +50,11 @@ export class MarkdownRenderer { private headingEnhanceRenderer: marked.Renderer; private originalHeadingRule: typeof marked.Renderer.prototype.heading; + private slugger: marked.Slugger; constructor(public options?: RedocNormalizedOptions) { this.headingEnhanceRenderer = new marked.Renderer(); + this.slugger = new marked.Slugger(); this.originalHeadingRule = this.headingEnhanceRenderer.heading.bind( this.headingEnhanceRenderer, ); @@ -129,7 +131,7 @@ export class MarkdownRenderer { this.currentTopHeading && this.currentTopHeading.id, ); } - return this.originalHeadingRule(text, level, raw); + return this.originalHeadingRule(text, level, raw, this.slugger); }; renderMd(rawText: string, extractHeadings: boolean = false): string { diff --git a/yarn.lock b/yarn.lock index bb73dd91d4..6ccc3428e2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -768,10 +768,10 @@ dependencies: "@types/jquery" "*" -"@types/marked@^0.4.2": - version "0.4.2" - resolved "https://registry.yarnpkg.com/@types/marked/-/marked-0.4.2.tgz#64a89e53ea37f61cc0f3ee1732c555c2dbf6452f" - integrity sha512-cDB930/7MbzaGF6U3IwSQp6XBru8xWajF5PV2YZZeV8DyiliTuld11afVztGI9+yJZ29il5E+NpGA6ooV/Cjkg== +"@types/marked@^0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@types/marked/-/marked-0.5.0.tgz#4b91c66ee8cf0abb6938e02fdec207279959962e" + integrity sha512-5uRumM3yeMj+JcvWGku/FRJJCmSWZczLd8FJf76a90YCltRHVpjF2gKHiL6U+pi4qyATn7HvxR0Mk7mDySwaOQ== "@types/minimatch@3.0.3": version "3.0.3" @@ -6257,9 +6257,10 @@ mark.js@^8.11.1: resolved "https://registry.yarnpkg.com/mark.js/-/mark.js-8.11.1.tgz#180f1f9ebef8b0e638e4166ad52db879beb2ffc5" integrity sha1-GA8fnr74sOY45BZq1S24eb6y/8U= -"marked@https://github.com/markedjs/marked#fb48827": - version "0.5.1" - resolved "https://github.com/markedjs/marked#fb48827236ed3a43e611d2adb3c070ca3f55ed8e" +marked@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/marked/-/marked-0.6.0.tgz#a18d01cfdcf8d15c3c455b71c8329e5e0f01faa1" + integrity sha512-HduzIW2xApSXKXJSpCipSxKyvMbwRRa/TwMbepmlZziKdH8548WSoDP4SxzulEKjlo8BE39l+2fwJZuRKOln6g== math-random@^1.0.1: version "1.0.1"