From 0fa80de9ff43433fdc7021f8150d41eecc6ffe91 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Oct 2023 00:08:47 +0000 Subject: [PATCH 1/2] Bump marked from 5.1.0 to 9.0.3 Bumps [marked](https://github.com/markedjs/marked) from 5.1.0 to 9.0.3. - [Release notes](https://github.com/markedjs/marked/releases) - [Changelog](https://github.com/markedjs/marked/blob/master/.releaserc.json) - [Commits](https://github.com/markedjs/marked/compare/v5.1.0...v9.0.3) --- updated-dependencies: - dependency-name: marked dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package-lock.json | 16 ++++++++-------- package.json | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1b2aeb2437..a3caec4dd0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,7 +35,7 @@ "@vaadin/router": "^1.7.5", "firebase": "^10.4.0", "lit": "^2.8.0", - "marked": "^5.1.0", + "marked": "^9.0.3", "pwa-helpers": "^0.9.1", "register-service-worker": "^1.7.2", "web-vitals": "^3.5.0" @@ -16806,14 +16806,14 @@ } }, "node_modules/marked": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-5.1.0.tgz", - "integrity": "sha512-z3/nBe7aTI8JDszlYLk7dDVNpngjw0o1ZJtrA9kIfkkHcIF+xH7mO23aISl4WxP83elU+MFROgahqdpd05lMEQ==", + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/marked/-/marked-9.0.3.tgz", + "integrity": "sha512-pI/k4nzBG1PEq1J3XFEHxVvjicfjl8rgaMaqclouGSMPhk7Q3Ejb2ZRxx/ZQOcQ1909HzVoWCFYq6oLgtL4BpQ==", "bin": { "marked": "bin/marked.js" }, "engines": { - "node": ">= 18" + "node": ">= 16" } }, "node_modules/mathml-tag-names": { @@ -33823,9 +33823,9 @@ "dev": true }, "marked": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-5.1.0.tgz", - "integrity": "sha512-z3/nBe7aTI8JDszlYLk7dDVNpngjw0o1ZJtrA9kIfkkHcIF+xH7mO23aISl4WxP83elU+MFROgahqdpd05lMEQ==" + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/marked/-/marked-9.0.3.tgz", + "integrity": "sha512-pI/k4nzBG1PEq1J3XFEHxVvjicfjl8rgaMaqclouGSMPhk7Q3Ejb2ZRxx/ZQOcQ1909HzVoWCFYq6oLgtL4BpQ==" }, "mathml-tag-names": { "version": "2.1.3", diff --git a/package.json b/package.json index 83f803a577..ebd6b99a40 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "@vaadin/router": "^1.7.5", "firebase": "^10.4.0", "lit": "^2.8.0", - "marked": "^5.1.0", + "marked": "^9.0.3", "pwa-helpers": "^0.9.1", "register-service-worker": "^1.7.2", "web-vitals": "^3.5.0" From a0477a018b86fe069f2db95b97084f54022abd68 Mon Sep 17 00:00:00 2001 From: Abraham Williams <4braham@gmail.com> Date: Tue, 3 Oct 2023 20:03:03 -0500 Subject: [PATCH 2/2] Use marked-gfm-heading-id for markdown headers --- package-lock.json | 30 ++++++++++++++++++++++++++++++ package.json | 1 + src/components/markdown/base.ts | 5 ++--- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index a3caec4dd0..e13f278bf4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,6 +36,7 @@ "firebase": "^10.4.0", "lit": "^2.8.0", "marked": "^9.0.3", + "marked-gfm-heading-id": "^3.1.0", "pwa-helpers": "^0.9.1", "register-service-worker": "^1.7.2", "web-vitals": "^3.5.0" @@ -13697,6 +13698,11 @@ "node": ">= 14" } }, + "node_modules/github-slugger": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/github-slugger/-/github-slugger-2.0.0.tgz", + "integrity": "sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==" + }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -16816,6 +16822,17 @@ "node": ">= 16" } }, + "node_modules/marked-gfm-heading-id": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/marked-gfm-heading-id/-/marked-gfm-heading-id-3.1.0.tgz", + "integrity": "sha512-PYgLXDbL64Ga6kCpvVuKVoIVsV6MKUtkOXnR8mIqyjiycAeKNhQxcGpO0mHEogOTzyY8A8TcK49k5VwYMUCCbg==", + "dependencies": { + "github-slugger": "^2.0.0" + }, + "peerDependencies": { + "marked": ">=4 <10" + } + }, "node_modules/mathml-tag-names": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz", @@ -31474,6 +31491,11 @@ "fs-extra": "^8.1.0" } }, + "github-slugger": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/github-slugger/-/github-slugger-2.0.0.tgz", + "integrity": "sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==" + }, "glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -33827,6 +33849,14 @@ "resolved": "https://registry.npmjs.org/marked/-/marked-9.0.3.tgz", "integrity": "sha512-pI/k4nzBG1PEq1J3XFEHxVvjicfjl8rgaMaqclouGSMPhk7Q3Ejb2ZRxx/ZQOcQ1909HzVoWCFYq6oLgtL4BpQ==" }, + "marked-gfm-heading-id": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/marked-gfm-heading-id/-/marked-gfm-heading-id-3.1.0.tgz", + "integrity": "sha512-PYgLXDbL64Ga6kCpvVuKVoIVsV6MKUtkOXnR8mIqyjiycAeKNhQxcGpO0mHEogOTzyY8A8TcK49k5VwYMUCCbg==", + "requires": { + "github-slugger": "^2.0.0" + } + }, "mathml-tag-names": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz", diff --git a/package.json b/package.json index ebd6b99a40..f491dcff50 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "firebase": "^10.4.0", "lit": "^2.8.0", "marked": "^9.0.3", + "marked-gfm-heading-id": "^3.1.0", "pwa-helpers": "^0.9.1", "register-service-worker": "^1.7.2", "web-vitals": "^3.5.0" diff --git a/src/components/markdown/base.ts b/src/components/markdown/base.ts index ee1ffd4bd8..a84837f981 100644 --- a/src/components/markdown/base.ts +++ b/src/components/markdown/base.ts @@ -1,12 +1,11 @@ import { html } from 'lit'; import { property } from 'lit/decorators.js'; import { marked } from 'marked'; +import { gfmHeadingId } from 'marked-gfm-heading-id'; import { hasUnsupportedTags, unsupportedHtmlTags } from '../../utils/markdown'; import { ThemedElement } from '../themed-element'; -marked.setOptions({ - headerIds: true, -}); +marked.use(gfmHeadingId()); export class Markdown extends ThemedElement { static override get styles() {