mirror of
https://github.com/grafana/grafana.git
synced 2025-02-03 20:21:01 -06:00
Update dependency marked to v12 (#82245)
* Update dependency marked to v12 * make sure marked return value is synchronous --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
This commit is contained in:
parent
d956282913
commit
8a7828da48
@ -329,7 +329,7 @@
|
|||||||
"lru-cache": "10.2.0",
|
"lru-cache": "10.2.0",
|
||||||
"lru-memoize": "^1.1.0",
|
"lru-memoize": "^1.1.0",
|
||||||
"lucene": "^2.1.1",
|
"lucene": "^2.1.1",
|
||||||
"marked": "5.1.1",
|
"marked": "12.0.0",
|
||||||
"marked-mangle": "1.1.7",
|
"marked-mangle": "1.1.7",
|
||||||
"memoize-one": "6.0.0",
|
"memoize-one": "6.0.0",
|
||||||
"ml-regression-polynomial": "^3.0.0",
|
"ml-regression-polynomial": "^3.0.0",
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
"fast_array_intersect": "1.1.0",
|
"fast_array_intersect": "1.1.0",
|
||||||
"history": "4.10.1",
|
"history": "4.10.1",
|
||||||
"lodash": "4.17.21",
|
"lodash": "4.17.21",
|
||||||
"marked": "5.1.1",
|
"marked": "12.0.0",
|
||||||
"marked-mangle": "1.1.7",
|
"marked-mangle": "1.1.7",
|
||||||
"moment": "2.30.1",
|
"moment": "2.30.1",
|
||||||
"moment-timezone": "0.5.45",
|
"moment-timezone": "0.5.45",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { marked } from 'marked';
|
import { marked, MarkedOptions } from 'marked';
|
||||||
import { mangle } from 'marked-mangle';
|
import { mangle } from 'marked-mangle';
|
||||||
|
|
||||||
import { sanitizeTextPanelContent } from './sanitize';
|
import { sanitizeTextPanelContent } from './sanitize';
|
||||||
@ -10,13 +10,9 @@ export interface RenderMarkdownOptions {
|
|||||||
breaks?: boolean;
|
breaks?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const markdownOptions = {
|
const markdownOptions: MarkedOptions = {
|
||||||
headerIds: false,
|
|
||||||
pedantic: false,
|
pedantic: false,
|
||||||
gfm: true,
|
gfm: true,
|
||||||
smartLists: true,
|
|
||||||
smartypants: false,
|
|
||||||
xhtml: false,
|
|
||||||
breaks: false,
|
breaks: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -36,6 +32,12 @@ export function renderMarkdown(str?: string, options?: RenderMarkdownOptions): s
|
|||||||
}
|
}
|
||||||
const html = marked(str || '', opts);
|
const html = marked(str || '', opts);
|
||||||
|
|
||||||
|
// `marked()` returns a promise if using any extensions that require async processing.
|
||||||
|
// we don't use any async extensions, but there is no way for typescript to know this, so we need to check the type.
|
||||||
|
if (typeof html !== 'string') {
|
||||||
|
throw new Error('Failed to process markdown synchronously.');
|
||||||
|
}
|
||||||
|
|
||||||
if (options?.noSanitize) {
|
if (options?.noSanitize) {
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
@ -51,6 +53,13 @@ export function renderTextPanelMarkdown(str?: string, options?: RenderMarkdownOp
|
|||||||
}
|
}
|
||||||
|
|
||||||
const html = marked(str || '');
|
const html = marked(str || '');
|
||||||
|
|
||||||
|
// `marked()` returns a promise if using any extensions that require async processing.
|
||||||
|
// we don't use any async extensions, but there is no way for typescript to know this, so we need to check the type.
|
||||||
|
if (typeof html !== 'string') {
|
||||||
|
throw new Error('Failed to process markdown synchronously.');
|
||||||
|
}
|
||||||
|
|
||||||
if (options?.noSanitize) {
|
if (options?.noSanitize) {
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
"eventemitter3": "5.0.1",
|
"eventemitter3": "5.0.1",
|
||||||
"lodash": "4.17.21",
|
"lodash": "4.17.21",
|
||||||
"lru-cache": "10.2.0",
|
"lru-cache": "10.2.0",
|
||||||
"marked": "5.1.1",
|
"marked": "12.0.0",
|
||||||
"marked-mangle": "1.1.7",
|
"marked-mangle": "1.1.7",
|
||||||
"moment": "2.30.1",
|
"moment": "2.30.1",
|
||||||
"moment-timezone": "0.5.45",
|
"moment-timezone": "0.5.45",
|
||||||
|
14
yarn.lock
14
yarn.lock
@ -3540,7 +3540,7 @@ __metadata:
|
|||||||
fast_array_intersect: "npm:1.1.0"
|
fast_array_intersect: "npm:1.1.0"
|
||||||
history: "npm:4.10.1"
|
history: "npm:4.10.1"
|
||||||
lodash: "npm:4.17.21"
|
lodash: "npm:4.17.21"
|
||||||
marked: "npm:5.1.1"
|
marked: "npm:12.0.0"
|
||||||
marked-mangle: "npm:1.1.7"
|
marked-mangle: "npm:1.1.7"
|
||||||
moment: "npm:2.30.1"
|
moment: "npm:2.30.1"
|
||||||
moment-timezone: "npm:0.5.45"
|
moment-timezone: "npm:0.5.45"
|
||||||
@ -3957,7 +3957,7 @@ __metadata:
|
|||||||
jest-matcher-utils: "npm:29.7.0"
|
jest-matcher-utils: "npm:29.7.0"
|
||||||
lodash: "npm:4.17.21"
|
lodash: "npm:4.17.21"
|
||||||
lru-cache: "npm:10.2.0"
|
lru-cache: "npm:10.2.0"
|
||||||
marked: "npm:5.1.1"
|
marked: "npm:12.0.0"
|
||||||
marked-mangle: "npm:1.1.7"
|
marked-mangle: "npm:1.1.7"
|
||||||
moment: "npm:2.30.1"
|
moment: "npm:2.30.1"
|
||||||
moment-timezone: "npm:0.5.45"
|
moment-timezone: "npm:0.5.45"
|
||||||
@ -18371,7 +18371,7 @@ __metadata:
|
|||||||
lru-cache: "npm:10.2.0"
|
lru-cache: "npm:10.2.0"
|
||||||
lru-memoize: "npm:^1.1.0"
|
lru-memoize: "npm:^1.1.0"
|
||||||
lucene: "npm:^2.1.1"
|
lucene: "npm:^2.1.1"
|
||||||
marked: "npm:5.1.1"
|
marked: "npm:12.0.0"
|
||||||
marked-mangle: "npm:1.1.7"
|
marked-mangle: "npm:1.1.7"
|
||||||
memoize-one: "npm:6.0.0"
|
memoize-one: "npm:6.0.0"
|
||||||
mini-css-extract-plugin: "npm:2.8.0"
|
mini-css-extract-plugin: "npm:2.8.0"
|
||||||
@ -22104,12 +22104,12 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"marked@npm:5.1.1":
|
"marked@npm:12.0.0":
|
||||||
version: 5.1.1
|
version: 12.0.0
|
||||||
resolution: "marked@npm:5.1.1"
|
resolution: "marked@npm:12.0.0"
|
||||||
bin:
|
bin:
|
||||||
marked: bin/marked.js
|
marked: bin/marked.js
|
||||||
checksum: 10/88bf0b1db52a84222956bc32e7e7cc7b3ecc6a978ec37acafd4e45aeb6c1c5a62640ab570fc1fccbaf385d39b4783a41a2e1d71f2766cf905e32164dc74eeec5
|
checksum: 10/ac2e5a3ebf33f8636e65c1eb7f73267cbe101fea1ad08abab60d51e5b4fda30faa59050e2837dc03fb6dbf58f630485c8d01ae5b9d90d36bf4562d7f40c1d33e
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user