🗜️ build v5.0.0 [skip ci]

This commit is contained in:
MarkedJS bot 2023-05-02 04:35:05 +00:00
parent fa21b9f60a
commit 66034750fa
4 changed files with 450 additions and 375 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/**
* marked v4.3.0 - a markdown parser
* marked v5.0.0 - a markdown parser
* Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed)
* https://github.com/markedjs/marked
*/
@ -274,10 +274,42 @@ function findClosingBracket(str, b) {
return -1;
}
function checkSanitizeDeprecation(opt) {
if (opt && opt.sanitize && !opt.silent) {
function checkDeprecations(opt, callback) {
if (!opt || opt.silent) {
return;
}
if (callback) {
console.warn('marked(): callback is deprecated since version 5.0.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/using_pro#async');
}
if (opt.sanitize || opt.sanitizer) {
console.warn('marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options');
}
if (opt.highlight || opt.langPrefix) {
console.warn('marked(): highlight and langPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-highlight.');
}
if (opt.mangle) {
console.warn('marked(): mangle parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-mangle.');
}
if (opt.baseUrl) {
console.warn('marked(): baseUrl parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-base-url.');
}
if (opt.smartypants) {
console.warn('marked(): smartypants parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-smartypants.');
}
if (opt.xhtml) {
console.warn('marked(): xhtml parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-xhtml.');
}
if (opt.headerIds || opt.headerPrefix) {
console.warn('marked(): headerIds and headerPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-gfm-heading-id.');
}
}
// copied from https://stackoverflow.com/a/5450113/806777
@ -656,6 +688,7 @@ class Tokenizer {
if (cap) {
const token = {
type: 'html',
block: true,
raw: cap[0],
pre: !this.options.sanitizer
&& (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
@ -813,6 +846,7 @@ class Tokenizer {
raw: cap[0],
inLink: this.lexer.state.inLink,
inRawBlock: this.lexer.state.inRawBlock,
block: false,
text: this.options.sanitize
? (this.options.sanitizer
? this.options.sanitizer(cap[0])
@ -1932,7 +1966,7 @@ class Renderer {
return `<blockquote>\n${quote}</blockquote>\n`;
}
html(html) {
html(html, block) {
return html;
}
@ -2355,8 +2389,7 @@ class Parser {
continue;
}
case 'html': {
// TODO parse inline content if parameter markdown=1
out += this.renderer.html(token.text);
out += this.renderer.html(token.text, token.block);
continue;
}
case 'paragraph': {
@ -2541,7 +2574,7 @@ function parseMarkdown(lexer, parser) {
+ Object.prototype.toString.call(src) + ', string expected'));
}
checkSanitizeDeprecation(opt);
checkDeprecations(opt, callback);
if (opt.hooks) {
opt.hooks.options = opt;

File diff suppressed because one or more lines are too long

4
marked.min.js vendored

File diff suppressed because one or more lines are too long