Added markdown rendering
This commit is contained in:
parent
26ca510785
commit
5a0340c226
172 changed files with 12198 additions and 8338 deletions
10
static/js/lib/node_modules/marked/README.md
generated
vendored
10
static/js/lib/node_modules/marked/README.md
generated
vendored
|
|
@ -5,7 +5,6 @@
|
|||
# Marked
|
||||
|
||||
[](https://www.npmjs.com/package/marked)
|
||||
[](https://cdn.jsdelivr.net/npm/marked/marked.min.js)
|
||||
[](https://packagephobia.now.sh/result?p=marked)
|
||||
[](https://www.npmjs.com/package/marked)
|
||||
[](https://github.com/markedjs/marked/actions)
|
||||
|
|
@ -18,7 +17,7 @@
|
|||
|
||||
## Demo
|
||||
|
||||
Checkout the [demo page](https://marked.js.org/demo/) to see marked in action ⛹️
|
||||
Check out the [demo page](https://marked.js.org/demo/) to see Marked in action ⛹️
|
||||
|
||||
## Docs
|
||||
|
||||
|
|
@ -33,7 +32,7 @@ Also read about:
|
|||
|
||||
**Node.js:** Only [current and LTS](https://nodejs.org/en/about/releases/) Node.js versions are supported. End of life Node.js versions may become incompatible with Marked at any point in time.
|
||||
|
||||
**Browser:** Not IE11 :)
|
||||
**Browser:** [Baseline Widely Available](https://developer.mozilla.org/en-US/docs/Glossary/Baseline/Compatibility)
|
||||
|
||||
## Installation
|
||||
|
||||
|
|
@ -84,7 +83,7 @@ $ marked --help
|
|||
</head>
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked/lib/marked.umd.js"></script>
|
||||
<script>
|
||||
document.getElementById('content').innerHTML =
|
||||
marked.parse('# Marked in the browser\n\nRendered by **marked**.');
|
||||
|
|
@ -104,4 +103,5 @@ or import esm module
|
|||
|
||||
## License
|
||||
|
||||
Copyright (c) 2011-2022, Christopher Jeffrey. (MIT License)
|
||||
Copyright (c) 2018+, MarkedJS. (MIT License)
|
||||
Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
|
||||
|
|
|
|||
45
static/js/lib/node_modules/marked/bin/main.js
generated
vendored
45
static/js/lib/node_modules/marked/bin/main.js
generated
vendored
|
|
@ -2,13 +2,15 @@
|
|||
|
||||
/**
|
||||
* Marked CLI
|
||||
* Copyright (c) 2011-2013, Christopher Jeffrey (MIT License)
|
||||
* Copyright (c) 2018+, MarkedJS. (MIT License)
|
||||
* Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
|
||||
*/
|
||||
|
||||
import { promises } from 'node:fs';
|
||||
import { dirname, resolve } from 'node:path';
|
||||
import { homedir } from 'node:os';
|
||||
import { createRequire } from 'node:module';
|
||||
import { pathToFileURL } from 'node:url';
|
||||
import { marked } from '../lib/marked.esm.js';
|
||||
|
||||
const { access, readFile, writeFile } = promises;
|
||||
|
|
@ -28,18 +30,21 @@ export async function main(nodeProcess) {
|
|||
const options = {
|
||||
cwd: nodeProcess.cwd(),
|
||||
env: nodeProcess.env,
|
||||
stdio: 'inherit'
|
||||
stdio: 'inherit',
|
||||
};
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const helpText = await readFile(resolve(__dirname, '../man/marked.1.md'), 'utf8');
|
||||
|
||||
// eslint-disable-next-line promise/param-names
|
||||
await new Promise(res => {
|
||||
spawn('man', [resolve(__dirname, '../man/marked.1')], options)
|
||||
.on('error', () => {
|
||||
console.log(helpText);
|
||||
})
|
||||
const manProcess = spawn('man', [resolve(__dirname, '../man/marked.1')], options);
|
||||
nodeProcess.on('SIGINT', () => {
|
||||
manProcess.kill('SIGINT');
|
||||
});
|
||||
|
||||
manProcess.on('error', () => {
|
||||
console.log(helpText);
|
||||
})
|
||||
.on('close', res);
|
||||
});
|
||||
}
|
||||
|
|
@ -128,7 +133,7 @@ export async function main(nodeProcess) {
|
|||
default:
|
||||
if (arg.indexOf('--') === 0) {
|
||||
opt = camelize(arg.replace(/^--(no-)?/, ''));
|
||||
if (!marked.defaults.hasOwnProperty(opt)) {
|
||||
if (!(opt in marked.defaults)) {
|
||||
continue;
|
||||
}
|
||||
if (arg.indexOf('--no-') === 0) {
|
||||
|
|
@ -148,11 +153,11 @@ export async function main(nodeProcess) {
|
|||
}
|
||||
|
||||
async function getData() {
|
||||
if (string) {
|
||||
return string;
|
||||
}
|
||||
if (!input) {
|
||||
if (files.length <= 2) {
|
||||
if (string) {
|
||||
return string;
|
||||
}
|
||||
if (files.length === 0) {
|
||||
return await getStdin();
|
||||
}
|
||||
input = files.pop();
|
||||
|
|
@ -174,12 +179,12 @@ export async function main(nodeProcess) {
|
|||
try {
|
||||
// try require for json
|
||||
markedConfig = require(configFile);
|
||||
} catch (err) {
|
||||
} catch(err) {
|
||||
if (err.code !== 'ERR_REQUIRE_ESM') {
|
||||
throw err;
|
||||
}
|
||||
// must import esm
|
||||
markedConfig = await import('file:///' + configFile);
|
||||
markedConfig = await import(pathToFileURL(configFile).href);
|
||||
}
|
||||
|
||||
if (markedConfig.default) {
|
||||
|
|
@ -205,7 +210,7 @@ export async function main(nodeProcess) {
|
|||
const defaultConfig = [
|
||||
'~/.marked.json',
|
||||
'~/.marked.js',
|
||||
'~/.marked/index.js'
|
||||
'~/.marked/index.js',
|
||||
];
|
||||
|
||||
for (const configFile of defaultConfig) {
|
||||
|
|
@ -222,8 +227,7 @@ export async function main(nodeProcess) {
|
|||
|
||||
if (output) {
|
||||
if (noclobber && await fileExists(output)) {
|
||||
nodeProcess.stderr.write('marked: output file \'' + output + '\' already exists, disable the \'-n\' / \'--no-clobber\' flag to overwrite\n');
|
||||
nodeProcess.exit(1);
|
||||
throw Error('marked: output file \'' + output + '\' already exists, disable the \'-n\' / \'--no-clobber\' flag to overwrite\n');
|
||||
}
|
||||
return await writeFile(output, html);
|
||||
}
|
||||
|
|
@ -269,11 +273,12 @@ export async function main(nodeProcess) {
|
|||
try {
|
||||
await start(nodeProcess.argv.slice());
|
||||
nodeProcess.exit(0);
|
||||
} catch (err) {
|
||||
} catch(err) {
|
||||
if (err.code === 'ENOENT') {
|
||||
nodeProcess.stderr.write('marked: output to ' + err.path + ': No such directory');
|
||||
nodeProcess.stderr.write('marked: ' + err.path + ': No such file or directory');
|
||||
} else {
|
||||
nodeProcess.stderr.write(err.message);
|
||||
}
|
||||
nodeProcess.stderr.write(err);
|
||||
return nodeProcess.exit(1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
3
static/js/lib/node_modules/marked/bin/marked.js
generated
vendored
3
static/js/lib/node_modules/marked/bin/marked.js
generated
vendored
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
/**
|
||||
* Marked CLI
|
||||
* Copyright (c) 2011-2013, Christopher Jeffrey (MIT License)
|
||||
* Copyright (c) 2018+, MarkedJS. (MIT License)
|
||||
* Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
|
||||
*/
|
||||
|
||||
import { main } from './main.js';
|
||||
|
|
|
|||
2442
static/js/lib/node_modules/marked/lib/marked.cjs
generated
vendored
2442
static/js/lib/node_modules/marked/lib/marked.cjs
generated
vendored
File diff suppressed because it is too large
Load diff
1
static/js/lib/node_modules/marked/lib/marked.cjs.map
generated
vendored
1
static/js/lib/node_modules/marked/lib/marked.cjs.map
generated
vendored
File diff suppressed because one or more lines are too long
638
static/js/lib/node_modules/marked/lib/marked.d.cts
generated
vendored
638
static/js/lib/node_modules/marked/lib/marked.d.cts
generated
vendored
|
|
@ -1,638 +0,0 @@
|
|||
// Generated by dts-bundle-generator v9.0.0
|
||||
|
||||
export type Token = (Tokens.Space | Tokens.Code | Tokens.Heading | Tokens.Table | Tokens.Hr | Tokens.Blockquote | Tokens.List | Tokens.ListItem | Tokens.Paragraph | Tokens.HTML | Tokens.Text | Tokens.Def | Tokens.Escape | Tokens.Tag | Tokens.Image | Tokens.Link | Tokens.Strong | Tokens.Em | Tokens.Codespan | Tokens.Br | Tokens.Del | Tokens.Generic);
|
||||
export declare namespace Tokens {
|
||||
interface Space {
|
||||
type: "space";
|
||||
raw: string;
|
||||
}
|
||||
interface Code {
|
||||
type: "code";
|
||||
raw: string;
|
||||
codeBlockStyle?: "indented" | undefined;
|
||||
lang?: string | undefined;
|
||||
text: string;
|
||||
escaped?: boolean;
|
||||
}
|
||||
interface Heading {
|
||||
type: "heading";
|
||||
raw: string;
|
||||
depth: number;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Table {
|
||||
type: "table";
|
||||
raw: string;
|
||||
align: Array<"center" | "left" | "right" | null>;
|
||||
header: TableCell[];
|
||||
rows: TableCell[][];
|
||||
}
|
||||
interface TableCell {
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Hr {
|
||||
type: "hr";
|
||||
raw: string;
|
||||
}
|
||||
interface Blockquote {
|
||||
type: "blockquote";
|
||||
raw: string;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface List {
|
||||
type: "list";
|
||||
raw: string;
|
||||
ordered: boolean;
|
||||
start: number | "";
|
||||
loose: boolean;
|
||||
items: ListItem[];
|
||||
}
|
||||
interface ListItem {
|
||||
type: "list_item";
|
||||
raw: string;
|
||||
task: boolean;
|
||||
checked?: boolean | undefined;
|
||||
loose: boolean;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Paragraph {
|
||||
type: "paragraph";
|
||||
raw: string;
|
||||
pre?: boolean | undefined;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface HTML {
|
||||
type: "html";
|
||||
raw: string;
|
||||
pre: boolean;
|
||||
text: string;
|
||||
block: boolean;
|
||||
}
|
||||
interface Text {
|
||||
type: "text";
|
||||
raw: string;
|
||||
text: string;
|
||||
tokens?: Token[];
|
||||
}
|
||||
interface Def {
|
||||
type: "def";
|
||||
raw: string;
|
||||
tag: string;
|
||||
href: string;
|
||||
title: string;
|
||||
}
|
||||
interface Escape {
|
||||
type: "escape";
|
||||
raw: string;
|
||||
text: string;
|
||||
}
|
||||
interface Tag {
|
||||
type: "text" | "html";
|
||||
raw: string;
|
||||
inLink: boolean;
|
||||
inRawBlock: boolean;
|
||||
text: string;
|
||||
block: boolean;
|
||||
}
|
||||
interface Link {
|
||||
type: "link";
|
||||
raw: string;
|
||||
href: string;
|
||||
title?: string | null;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Image {
|
||||
type: "image";
|
||||
raw: string;
|
||||
href: string;
|
||||
title: string | null;
|
||||
text: string;
|
||||
}
|
||||
interface Strong {
|
||||
type: "strong";
|
||||
raw: string;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Em {
|
||||
type: "em";
|
||||
raw: string;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Codespan {
|
||||
type: "codespan";
|
||||
raw: string;
|
||||
text: string;
|
||||
}
|
||||
interface Br {
|
||||
type: "br";
|
||||
raw: string;
|
||||
}
|
||||
interface Del {
|
||||
type: "del";
|
||||
raw: string;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Generic {
|
||||
[index: string]: any;
|
||||
type: string;
|
||||
raw: string;
|
||||
tokens?: Token[] | undefined;
|
||||
}
|
||||
}
|
||||
export type Links = Record<string, Pick<Tokens.Link | Tokens.Image, "href" | "title">>;
|
||||
export type TokensList = Token[] & {
|
||||
links: Links;
|
||||
};
|
||||
declare class _Renderer {
|
||||
options: MarkedOptions;
|
||||
constructor(options?: MarkedOptions);
|
||||
code(code: string, infostring: string | undefined, escaped: boolean): string;
|
||||
blockquote(quote: string): string;
|
||||
html(html: string, block?: boolean): string;
|
||||
heading(text: string, level: number, raw: string): string;
|
||||
hr(): string;
|
||||
list(body: string, ordered: boolean, start: number | ""): string;
|
||||
listitem(text: string, task: boolean, checked: boolean): string;
|
||||
checkbox(checked: boolean): string;
|
||||
paragraph(text: string): string;
|
||||
table(header: string, body: string): string;
|
||||
tablerow(content: string): string;
|
||||
tablecell(content: string, flags: {
|
||||
header: boolean;
|
||||
align: "center" | "left" | "right" | null;
|
||||
}): string;
|
||||
/**
|
||||
* span level renderer
|
||||
*/
|
||||
strong(text: string): string;
|
||||
em(text: string): string;
|
||||
codespan(text: string): string;
|
||||
br(): string;
|
||||
del(text: string): string;
|
||||
link(href: string, title: string | null | undefined, text: string): string;
|
||||
image(href: string, title: string | null, text: string): string;
|
||||
text(text: string): string;
|
||||
}
|
||||
declare class _TextRenderer {
|
||||
strong(text: string): string;
|
||||
em(text: string): string;
|
||||
codespan(text: string): string;
|
||||
del(text: string): string;
|
||||
html(text: string): string;
|
||||
text(text: string): string;
|
||||
link(href: string, title: string | null | undefined, text: string): string;
|
||||
image(href: string, title: string | null, text: string): string;
|
||||
br(): string;
|
||||
}
|
||||
declare class _Parser {
|
||||
options: MarkedOptions;
|
||||
renderer: _Renderer;
|
||||
textRenderer: _TextRenderer;
|
||||
constructor(options?: MarkedOptions);
|
||||
/**
|
||||
* Static Parse Method
|
||||
*/
|
||||
static parse(tokens: Token[], options?: MarkedOptions): string;
|
||||
/**
|
||||
* Static Parse Inline Method
|
||||
*/
|
||||
static parseInline(tokens: Token[], options?: MarkedOptions): string;
|
||||
/**
|
||||
* Parse Loop
|
||||
*/
|
||||
parse(tokens: Token[], top?: boolean): string;
|
||||
/**
|
||||
* Parse Inline Tokens
|
||||
*/
|
||||
parseInline(tokens: Token[], renderer?: _Renderer | _TextRenderer): string;
|
||||
}
|
||||
declare const blockNormal: {
|
||||
blockquote: RegExp;
|
||||
code: RegExp;
|
||||
def: RegExp;
|
||||
fences: RegExp;
|
||||
heading: RegExp;
|
||||
hr: RegExp;
|
||||
html: RegExp;
|
||||
lheading: RegExp;
|
||||
list: RegExp;
|
||||
newline: RegExp;
|
||||
paragraph: RegExp;
|
||||
table: RegExp;
|
||||
text: RegExp;
|
||||
};
|
||||
export type BlockKeys = keyof typeof blockNormal;
|
||||
declare const inlineNormal: {
|
||||
_backpedal: RegExp;
|
||||
anyPunctuation: RegExp;
|
||||
autolink: RegExp;
|
||||
blockSkip: RegExp;
|
||||
br: RegExp;
|
||||
code: RegExp;
|
||||
del: RegExp;
|
||||
emStrongLDelim: RegExp;
|
||||
emStrongRDelimAst: RegExp;
|
||||
emStrongRDelimUnd: RegExp;
|
||||
escape: RegExp;
|
||||
link: RegExp;
|
||||
nolink: RegExp;
|
||||
punctuation: RegExp;
|
||||
reflink: RegExp;
|
||||
reflinkSearch: RegExp;
|
||||
tag: RegExp;
|
||||
text: RegExp;
|
||||
url: RegExp;
|
||||
};
|
||||
export type InlineKeys = keyof typeof inlineNormal;
|
||||
/**
|
||||
* exports
|
||||
*/
|
||||
export declare const block: {
|
||||
normal: {
|
||||
blockquote: RegExp;
|
||||
code: RegExp;
|
||||
def: RegExp;
|
||||
fences: RegExp;
|
||||
heading: RegExp;
|
||||
hr: RegExp;
|
||||
html: RegExp;
|
||||
lheading: RegExp;
|
||||
list: RegExp;
|
||||
newline: RegExp;
|
||||
paragraph: RegExp;
|
||||
table: RegExp;
|
||||
text: RegExp;
|
||||
};
|
||||
gfm: Record<"code" | "blockquote" | "hr" | "html" | "table" | "text" | "heading" | "list" | "paragraph" | "def" | "fences" | "lheading" | "newline", RegExp>;
|
||||
pedantic: Record<"code" | "blockquote" | "hr" | "html" | "table" | "text" | "heading" | "list" | "paragraph" | "def" | "fences" | "lheading" | "newline", RegExp>;
|
||||
};
|
||||
export declare const inline: {
|
||||
normal: {
|
||||
_backpedal: RegExp;
|
||||
anyPunctuation: RegExp;
|
||||
autolink: RegExp;
|
||||
blockSkip: RegExp;
|
||||
br: RegExp;
|
||||
code: RegExp;
|
||||
del: RegExp;
|
||||
emStrongLDelim: RegExp;
|
||||
emStrongRDelimAst: RegExp;
|
||||
emStrongRDelimUnd: RegExp;
|
||||
escape: RegExp;
|
||||
link: RegExp;
|
||||
nolink: RegExp;
|
||||
punctuation: RegExp;
|
||||
reflink: RegExp;
|
||||
reflinkSearch: RegExp;
|
||||
tag: RegExp;
|
||||
text: RegExp;
|
||||
url: RegExp;
|
||||
};
|
||||
gfm: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
|
||||
breaks: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
|
||||
pedantic: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
|
||||
};
|
||||
export interface Rules {
|
||||
block: Record<BlockKeys, RegExp>;
|
||||
inline: Record<InlineKeys, RegExp>;
|
||||
}
|
||||
declare class _Tokenizer {
|
||||
options: MarkedOptions;
|
||||
rules: Rules;
|
||||
lexer: _Lexer;
|
||||
constructor(options?: MarkedOptions);
|
||||
space(src: string): Tokens.Space | undefined;
|
||||
code(src: string): Tokens.Code | undefined;
|
||||
fences(src: string): Tokens.Code | undefined;
|
||||
heading(src: string): Tokens.Heading | undefined;
|
||||
hr(src: string): Tokens.Hr | undefined;
|
||||
blockquote(src: string): Tokens.Blockquote | undefined;
|
||||
list(src: string): Tokens.List | undefined;
|
||||
html(src: string): Tokens.HTML | undefined;
|
||||
def(src: string): Tokens.Def | undefined;
|
||||
table(src: string): Tokens.Table | undefined;
|
||||
lheading(src: string): Tokens.Heading | undefined;
|
||||
paragraph(src: string): Tokens.Paragraph | undefined;
|
||||
text(src: string): Tokens.Text | undefined;
|
||||
escape(src: string): Tokens.Escape | undefined;
|
||||
tag(src: string): Tokens.Tag | undefined;
|
||||
link(src: string): Tokens.Link | Tokens.Image | undefined;
|
||||
reflink(src: string, links: Links): Tokens.Link | Tokens.Image | Tokens.Text | undefined;
|
||||
emStrong(src: string, maskedSrc: string, prevChar?: string): Tokens.Em | Tokens.Strong | undefined;
|
||||
codespan(src: string): Tokens.Codespan | undefined;
|
||||
br(src: string): Tokens.Br | undefined;
|
||||
del(src: string): Tokens.Del | undefined;
|
||||
autolink(src: string): Tokens.Link | undefined;
|
||||
url(src: string): Tokens.Link | undefined;
|
||||
inlineText(src: string): Tokens.Text | undefined;
|
||||
}
|
||||
declare class _Hooks {
|
||||
options: MarkedOptions;
|
||||
constructor(options?: MarkedOptions);
|
||||
static passThroughHooks: Set<string>;
|
||||
/**
|
||||
* Process markdown before marked
|
||||
*/
|
||||
preprocess(markdown: string): string;
|
||||
/**
|
||||
* Process HTML after marked is finished
|
||||
*/
|
||||
postprocess(html: string): string;
|
||||
/**
|
||||
* Process all tokens before walk tokens
|
||||
*/
|
||||
processAllTokens(tokens: Token[] | TokensList): Token[] | TokensList;
|
||||
}
|
||||
export interface TokenizerThis {
|
||||
lexer: _Lexer;
|
||||
}
|
||||
export type TokenizerExtensionFunction = (this: TokenizerThis, src: string, tokens: Token[] | TokensList) => Tokens.Generic | undefined;
|
||||
export type TokenizerStartFunction = (this: TokenizerThis, src: string) => number | void;
|
||||
export interface TokenizerExtension {
|
||||
name: string;
|
||||
level: "block" | "inline";
|
||||
start?: TokenizerStartFunction | undefined;
|
||||
tokenizer: TokenizerExtensionFunction;
|
||||
childTokens?: string[] | undefined;
|
||||
}
|
||||
export interface RendererThis {
|
||||
parser: _Parser;
|
||||
}
|
||||
export type RendererExtensionFunction = (this: RendererThis, token: Tokens.Generic) => string | false | undefined;
|
||||
export interface RendererExtension {
|
||||
name: string;
|
||||
renderer: RendererExtensionFunction;
|
||||
}
|
||||
export type TokenizerAndRendererExtension = TokenizerExtension | RendererExtension | (TokenizerExtension & RendererExtension);
|
||||
export type HooksApi = Omit<_Hooks, "constructor" | "options">;
|
||||
export type HooksObject = {
|
||||
[K in keyof HooksApi]?: (...args: Parameters<HooksApi[K]>) => ReturnType<HooksApi[K]> | Promise<ReturnType<HooksApi[K]>>;
|
||||
};
|
||||
export type RendererApi = Omit<_Renderer, "constructor" | "options">;
|
||||
export type RendererObject = {
|
||||
[K in keyof RendererApi]?: (...args: Parameters<RendererApi[K]>) => ReturnType<RendererApi[K]> | false;
|
||||
};
|
||||
export type TokenizerApi = Omit<_Tokenizer, "constructor" | "options" | "rules" | "lexer">;
|
||||
export type TokenizerObject = {
|
||||
[K in keyof TokenizerApi]?: (...args: Parameters<TokenizerApi[K]>) => ReturnType<TokenizerApi[K]> | false;
|
||||
};
|
||||
export interface MarkedExtension {
|
||||
/**
|
||||
* True will tell marked to await any walkTokens functions before parsing the tokens and returning an HTML string.
|
||||
*/
|
||||
async?: boolean;
|
||||
/**
|
||||
* Enable GFM line breaks. This option requires the gfm option to be true.
|
||||
*/
|
||||
breaks?: boolean | undefined;
|
||||
/**
|
||||
* Add tokenizers and renderers to marked
|
||||
*/
|
||||
extensions?: TokenizerAndRendererExtension[] | undefined | null;
|
||||
/**
|
||||
* Enable GitHub flavored markdown.
|
||||
*/
|
||||
gfm?: boolean | undefined;
|
||||
/**
|
||||
* Hooks are methods that hook into some part of marked.
|
||||
* preprocess is called to process markdown before sending it to marked.
|
||||
* processAllTokens is called with the TokensList before walkTokens.
|
||||
* postprocess is called to process html after marked has finished parsing.
|
||||
*/
|
||||
hooks?: HooksObject | undefined | null;
|
||||
/**
|
||||
* Conform to obscure parts of markdown.pl as much as possible. Don't fix any of the original markdown bugs or poor behavior.
|
||||
*/
|
||||
pedantic?: boolean | undefined;
|
||||
/**
|
||||
* Type: object Default: new Renderer()
|
||||
*
|
||||
* An object containing functions to render tokens to HTML.
|
||||
*/
|
||||
renderer?: RendererObject | undefined | null;
|
||||
/**
|
||||
* Shows an HTML error message when rendering fails.
|
||||
*/
|
||||
silent?: boolean | undefined;
|
||||
/**
|
||||
* The tokenizer defines how to turn markdown text into tokens.
|
||||
*/
|
||||
tokenizer?: TokenizerObject | undefined | null;
|
||||
/**
|
||||
* The walkTokens function gets called with every token.
|
||||
* Child tokens are called before moving on to sibling tokens.
|
||||
* Each token is passed by reference so updates are persisted when passed to the parser.
|
||||
* The return value of the function is ignored.
|
||||
*/
|
||||
walkTokens?: ((token: Token) => void | Promise<void>) | undefined | null;
|
||||
}
|
||||
export interface MarkedOptions extends Omit<MarkedExtension, "hooks" | "renderer" | "tokenizer" | "extensions" | "walkTokens"> {
|
||||
/**
|
||||
* Hooks are methods that hook into some part of marked.
|
||||
*/
|
||||
hooks?: _Hooks | undefined | null;
|
||||
/**
|
||||
* Type: object Default: new Renderer()
|
||||
*
|
||||
* An object containing functions to render tokens to HTML.
|
||||
*/
|
||||
renderer?: _Renderer | undefined | null;
|
||||
/**
|
||||
* The tokenizer defines how to turn markdown text into tokens.
|
||||
*/
|
||||
tokenizer?: _Tokenizer | undefined | null;
|
||||
/**
|
||||
* Custom extensions
|
||||
*/
|
||||
extensions?: null | {
|
||||
renderers: {
|
||||
[name: string]: RendererExtensionFunction;
|
||||
};
|
||||
childTokens: {
|
||||
[name: string]: string[];
|
||||
};
|
||||
inline?: TokenizerExtensionFunction[];
|
||||
block?: TokenizerExtensionFunction[];
|
||||
startInline?: TokenizerStartFunction[];
|
||||
startBlock?: TokenizerStartFunction[];
|
||||
};
|
||||
/**
|
||||
* walkTokens function returns array of values for Promise.all
|
||||
*/
|
||||
walkTokens?: null | ((token: Token) => void | Promise<void> | (void | Promise<void>)[]);
|
||||
}
|
||||
declare class _Lexer {
|
||||
tokens: TokensList;
|
||||
options: MarkedOptions;
|
||||
state: {
|
||||
inLink: boolean;
|
||||
inRawBlock: boolean;
|
||||
top: boolean;
|
||||
};
|
||||
private tokenizer;
|
||||
private inlineQueue;
|
||||
constructor(options?: MarkedOptions);
|
||||
/**
|
||||
* Expose Rules
|
||||
*/
|
||||
static get rules(): {
|
||||
block: {
|
||||
normal: {
|
||||
blockquote: RegExp;
|
||||
code: RegExp;
|
||||
def: RegExp;
|
||||
fences: RegExp;
|
||||
heading: RegExp;
|
||||
hr: RegExp;
|
||||
html: RegExp;
|
||||
lheading: RegExp;
|
||||
list: RegExp;
|
||||
newline: RegExp;
|
||||
paragraph: RegExp;
|
||||
table: RegExp;
|
||||
text: RegExp;
|
||||
};
|
||||
gfm: Record<"code" | "blockquote" | "hr" | "html" | "table" | "text" | "heading" | "list" | "paragraph" | "def" | "fences" | "lheading" | "newline", RegExp>;
|
||||
pedantic: Record<"code" | "blockquote" | "hr" | "html" | "table" | "text" | "heading" | "list" | "paragraph" | "def" | "fences" | "lheading" | "newline", RegExp>;
|
||||
};
|
||||
inline: {
|
||||
normal: {
|
||||
_backpedal: RegExp;
|
||||
anyPunctuation: RegExp;
|
||||
autolink: RegExp;
|
||||
blockSkip: RegExp;
|
||||
br: RegExp;
|
||||
code: RegExp;
|
||||
del: RegExp;
|
||||
emStrongLDelim: RegExp;
|
||||
emStrongRDelimAst: RegExp;
|
||||
emStrongRDelimUnd: RegExp;
|
||||
escape: RegExp;
|
||||
link: RegExp;
|
||||
nolink: RegExp;
|
||||
punctuation: RegExp;
|
||||
reflink: RegExp;
|
||||
reflinkSearch: RegExp;
|
||||
tag: RegExp;
|
||||
text: RegExp;
|
||||
url: RegExp;
|
||||
};
|
||||
gfm: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
|
||||
breaks: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
|
||||
pedantic: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
|
||||
};
|
||||
};
|
||||
/**
|
||||
* Static Lex Method
|
||||
*/
|
||||
static lex(src: string, options?: MarkedOptions): TokensList;
|
||||
/**
|
||||
* Static Lex Inline Method
|
||||
*/
|
||||
static lexInline(src: string, options?: MarkedOptions): Token[];
|
||||
/**
|
||||
* Preprocessing
|
||||
*/
|
||||
lex(src: string): TokensList;
|
||||
/**
|
||||
* Lexing
|
||||
*/
|
||||
blockTokens(src: string, tokens?: Token[]): Token[];
|
||||
blockTokens(src: string, tokens?: TokensList): TokensList;
|
||||
inline(src: string, tokens?: Token[]): Token[];
|
||||
/**
|
||||
* Lexing/Compiling
|
||||
*/
|
||||
inlineTokens(src: string, tokens?: Token[]): Token[];
|
||||
}
|
||||
declare function _getDefaults(): MarkedOptions;
|
||||
declare let _defaults: MarkedOptions;
|
||||
export type MaybePromise = void | Promise<void>;
|
||||
export declare class Marked {
|
||||
#private;
|
||||
defaults: MarkedOptions;
|
||||
options: (opt: MarkedOptions) => this;
|
||||
parse: (src: string, options?: MarkedOptions | undefined | null) => string | Promise<string>;
|
||||
parseInline: (src: string, options?: MarkedOptions | undefined | null) => string | Promise<string>;
|
||||
Parser: typeof _Parser;
|
||||
Renderer: typeof _Renderer;
|
||||
TextRenderer: typeof _TextRenderer;
|
||||
Lexer: typeof _Lexer;
|
||||
Tokenizer: typeof _Tokenizer;
|
||||
Hooks: typeof _Hooks;
|
||||
constructor(...args: MarkedExtension[]);
|
||||
/**
|
||||
* Run callback for every token
|
||||
*/
|
||||
walkTokens(tokens: Token[] | TokensList, callback: (token: Token) => MaybePromise | MaybePromise[]): MaybePromise[];
|
||||
use(...args: MarkedExtension[]): this;
|
||||
setOptions(opt: MarkedOptions): this;
|
||||
lexer(src: string, options?: MarkedOptions): TokensList;
|
||||
parser(tokens: Token[], options?: MarkedOptions): string;
|
||||
}
|
||||
/**
|
||||
* Compiles markdown to HTML asynchronously.
|
||||
*
|
||||
* @param src String of markdown source to be compiled
|
||||
* @param options Hash of options, having async: true
|
||||
* @return Promise of string of compiled HTML
|
||||
*/
|
||||
export declare function marked(src: string, options: MarkedOptions & {
|
||||
async: true;
|
||||
}): Promise<string>;
|
||||
/**
|
||||
* Compiles markdown to HTML.
|
||||
*
|
||||
* @param src String of markdown source to be compiled
|
||||
* @param options Optional hash of options
|
||||
* @return String of compiled HTML. Wil be a Promise of string if async is set to true by any extensions.
|
||||
*/
|
||||
export declare function marked(src: string, options?: MarkedOptions): string | Promise<string>;
|
||||
export declare namespace marked {
|
||||
var options: (options: MarkedOptions) => typeof marked;
|
||||
var setOptions: (options: MarkedOptions) => typeof marked;
|
||||
var getDefaults: typeof _getDefaults;
|
||||
var defaults: MarkedOptions;
|
||||
var use: (...args: MarkedExtension[]) => typeof marked;
|
||||
var walkTokens: (tokens: Token[] | TokensList, callback: (token: Token) => MaybePromise | MaybePromise[]) => MaybePromise[];
|
||||
var parseInline: (src: string, options?: MarkedOptions | null | undefined) => string | Promise<string>;
|
||||
var Parser: typeof _Parser;
|
||||
var parser: typeof _Parser.parse;
|
||||
var Renderer: typeof _Renderer;
|
||||
var TextRenderer: typeof _TextRenderer;
|
||||
var Lexer: typeof _Lexer;
|
||||
var lexer: typeof _Lexer.lex;
|
||||
var Tokenizer: typeof _Tokenizer;
|
||||
var Hooks: typeof _Hooks;
|
||||
var parse: typeof marked;
|
||||
}
|
||||
export declare const options: (options: MarkedOptions) => typeof marked;
|
||||
export declare const setOptions: (options: MarkedOptions) => typeof marked;
|
||||
export declare const use: (...args: MarkedExtension[]) => typeof marked;
|
||||
export declare const walkTokens: (tokens: Token[] | TokensList, callback: (token: Token) => MaybePromise | MaybePromise[]) => MaybePromise[];
|
||||
export declare const parseInline: (src: string, options?: MarkedOptions | null | undefined) => string | Promise<string>;
|
||||
export declare const parse: typeof marked;
|
||||
export declare const parser: typeof _Parser.parse;
|
||||
export declare const lexer: typeof _Lexer.lex;
|
||||
|
||||
export {
|
||||
_Hooks as Hooks,
|
||||
_Lexer as Lexer,
|
||||
_Parser as Parser,
|
||||
_Renderer as Renderer,
|
||||
_TextRenderer as TextRenderer,
|
||||
_Tokenizer as Tokenizer,
|
||||
_defaults as defaults,
|
||||
_getDefaults as getDefaults,
|
||||
};
|
||||
|
||||
export {};
|
||||
644
static/js/lib/node_modules/marked/lib/marked.d.ts
generated
vendored
644
static/js/lib/node_modules/marked/lib/marked.d.ts
generated
vendored
|
|
@ -1,19 +1,66 @@
|
|||
// Generated by dts-bundle-generator v9.0.0
|
||||
// Generated by dts-bundle-generator v9.5.1
|
||||
|
||||
export type Token = (Tokens.Space | Tokens.Code | Tokens.Heading | Tokens.Table | Tokens.Hr | Tokens.Blockquote | Tokens.List | Tokens.ListItem | Tokens.Paragraph | Tokens.HTML | Tokens.Text | Tokens.Def | Tokens.Escape | Tokens.Tag | Tokens.Image | Tokens.Link | Tokens.Strong | Tokens.Em | Tokens.Codespan | Tokens.Br | Tokens.Del | Tokens.Generic);
|
||||
export type MarkedToken = (Tokens.Blockquote | Tokens.Br | Tokens.Checkbox | Tokens.Code | Tokens.Codespan | Tokens.Def | Tokens.Del | Tokens.Em | Tokens.Escape | Tokens.Heading | Tokens.Hr | Tokens.HTML | Tokens.Image | Tokens.Link | Tokens.List | Tokens.ListItem | Tokens.Paragraph | Tokens.Space | Tokens.Strong | Tokens.Table | Tokens.Tag | Tokens.Text);
|
||||
export type Token = (MarkedToken | Tokens.Generic);
|
||||
export declare namespace Tokens {
|
||||
interface Space {
|
||||
type: "space";
|
||||
interface Blockquote {
|
||||
type: "blockquote";
|
||||
raw: string;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Br {
|
||||
type: "br";
|
||||
raw: string;
|
||||
}
|
||||
interface Checkbox {
|
||||
type: "checkbox";
|
||||
raw: string;
|
||||
checked: boolean;
|
||||
}
|
||||
interface Code {
|
||||
type: "code";
|
||||
raw: string;
|
||||
codeBlockStyle?: "indented" | undefined;
|
||||
lang?: string | undefined;
|
||||
codeBlockStyle?: "indented";
|
||||
lang?: string;
|
||||
text: string;
|
||||
escaped?: boolean;
|
||||
}
|
||||
interface Codespan {
|
||||
type: "codespan";
|
||||
raw: string;
|
||||
text: string;
|
||||
}
|
||||
interface Def {
|
||||
type: "def";
|
||||
raw: string;
|
||||
tag: string;
|
||||
href: string;
|
||||
title: string;
|
||||
}
|
||||
interface Del {
|
||||
type: "del";
|
||||
raw: string;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Em {
|
||||
type: "em";
|
||||
raw: string;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Escape {
|
||||
type: "escape";
|
||||
raw: string;
|
||||
text: string;
|
||||
}
|
||||
interface Generic {
|
||||
[index: string]: any;
|
||||
type: string;
|
||||
raw: string;
|
||||
tokens?: Token[];
|
||||
}
|
||||
interface Heading {
|
||||
type: "heading";
|
||||
raw: string;
|
||||
|
|
@ -21,24 +68,30 @@ export declare namespace Tokens {
|
|||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Table {
|
||||
type: "table";
|
||||
raw: string;
|
||||
align: Array<"center" | "left" | "right" | null>;
|
||||
header: TableCell[];
|
||||
rows: TableCell[][];
|
||||
}
|
||||
interface TableCell {
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Hr {
|
||||
type: "hr";
|
||||
raw: string;
|
||||
}
|
||||
interface Blockquote {
|
||||
type: "blockquote";
|
||||
interface HTML {
|
||||
type: "html";
|
||||
raw: string;
|
||||
pre: boolean;
|
||||
text: string;
|
||||
block: boolean;
|
||||
}
|
||||
interface Image {
|
||||
type: "image";
|
||||
raw: string;
|
||||
href: string;
|
||||
title: string | null;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Link {
|
||||
type: "link";
|
||||
raw: string;
|
||||
href: string;
|
||||
title?: string | null;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
|
|
@ -54,7 +107,7 @@ export declare namespace Tokens {
|
|||
type: "list_item";
|
||||
raw: string;
|
||||
task: boolean;
|
||||
checked?: boolean | undefined;
|
||||
checked?: boolean;
|
||||
loose: boolean;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
|
|
@ -62,14 +115,41 @@ export declare namespace Tokens {
|
|||
interface Paragraph {
|
||||
type: "paragraph";
|
||||
raw: string;
|
||||
pre?: boolean | undefined;
|
||||
pre?: boolean;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface HTML {
|
||||
interface Space {
|
||||
type: "space";
|
||||
raw: string;
|
||||
}
|
||||
interface Strong {
|
||||
type: "strong";
|
||||
raw: string;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Table {
|
||||
type: "table";
|
||||
raw: string;
|
||||
align: Array<"center" | "left" | "right" | null>;
|
||||
header: TableCell[];
|
||||
rows: TableCell[][];
|
||||
}
|
||||
interface TableCell {
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
header: boolean;
|
||||
align: "center" | "left" | "right" | null;
|
||||
}
|
||||
interface TableRow<P = string> {
|
||||
text: P;
|
||||
}
|
||||
interface Tag {
|
||||
type: "html";
|
||||
raw: string;
|
||||
pre: boolean;
|
||||
inLink: boolean;
|
||||
inRawBlock: boolean;
|
||||
text: string;
|
||||
block: boolean;
|
||||
}
|
||||
|
|
@ -78,143 +158,145 @@ export declare namespace Tokens {
|
|||
raw: string;
|
||||
text: string;
|
||||
tokens?: Token[];
|
||||
}
|
||||
interface Def {
|
||||
type: "def";
|
||||
raw: string;
|
||||
tag: string;
|
||||
href: string;
|
||||
title: string;
|
||||
}
|
||||
interface Escape {
|
||||
type: "escape";
|
||||
raw: string;
|
||||
text: string;
|
||||
}
|
||||
interface Tag {
|
||||
type: "text" | "html";
|
||||
raw: string;
|
||||
inLink: boolean;
|
||||
inRawBlock: boolean;
|
||||
text: string;
|
||||
block: boolean;
|
||||
}
|
||||
interface Link {
|
||||
type: "link";
|
||||
raw: string;
|
||||
href: string;
|
||||
title?: string | null;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Image {
|
||||
type: "image";
|
||||
raw: string;
|
||||
href: string;
|
||||
title: string | null;
|
||||
text: string;
|
||||
}
|
||||
interface Strong {
|
||||
type: "strong";
|
||||
raw: string;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Em {
|
||||
type: "em";
|
||||
raw: string;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Codespan {
|
||||
type: "codespan";
|
||||
raw: string;
|
||||
text: string;
|
||||
}
|
||||
interface Br {
|
||||
type: "br";
|
||||
raw: string;
|
||||
}
|
||||
interface Del {
|
||||
type: "del";
|
||||
raw: string;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Generic {
|
||||
[index: string]: any;
|
||||
type: string;
|
||||
raw: string;
|
||||
tokens?: Token[] | undefined;
|
||||
escaped?: boolean;
|
||||
}
|
||||
}
|
||||
export type Links = Record<string, Pick<Tokens.Link | Tokens.Image, "href" | "title">>;
|
||||
export type TokensList = Token[] & {
|
||||
links: Links;
|
||||
};
|
||||
declare class _Renderer {
|
||||
options: MarkedOptions;
|
||||
constructor(options?: MarkedOptions);
|
||||
code(code: string, infostring: string | undefined, escaped: boolean): string;
|
||||
blockquote(quote: string): string;
|
||||
html(html: string, block?: boolean): string;
|
||||
heading(text: string, level: number, raw: string): string;
|
||||
hr(): string;
|
||||
list(body: string, ordered: boolean, start: number | ""): string;
|
||||
listitem(text: string, task: boolean, checked: boolean): string;
|
||||
checkbox(checked: boolean): string;
|
||||
paragraph(text: string): string;
|
||||
table(header: string, body: string): string;
|
||||
tablerow(content: string): string;
|
||||
tablecell(content: string, flags: {
|
||||
header: boolean;
|
||||
align: "center" | "left" | "right" | null;
|
||||
}): string;
|
||||
/**
|
||||
* Renderer
|
||||
*/
|
||||
declare class _Renderer<ParserOutput = string, RendererOutput = string> {
|
||||
options: MarkedOptions<ParserOutput, RendererOutput>;
|
||||
parser: _Parser<ParserOutput, RendererOutput>;
|
||||
constructor(options?: MarkedOptions<ParserOutput, RendererOutput>);
|
||||
space(token: Tokens.Space): RendererOutput;
|
||||
code({ text, lang, escaped }: Tokens.Code): RendererOutput;
|
||||
blockquote({ tokens }: Tokens.Blockquote): RendererOutput;
|
||||
html({ text }: Tokens.HTML | Tokens.Tag): RendererOutput;
|
||||
def(token: Tokens.Def): RendererOutput;
|
||||
heading({ tokens, depth }: Tokens.Heading): RendererOutput;
|
||||
hr(token: Tokens.Hr): RendererOutput;
|
||||
list(token: Tokens.List): RendererOutput;
|
||||
listitem(item: Tokens.ListItem): RendererOutput;
|
||||
checkbox({ checked }: Tokens.Checkbox): RendererOutput;
|
||||
paragraph({ tokens }: Tokens.Paragraph): RendererOutput;
|
||||
table(token: Tokens.Table): RendererOutput;
|
||||
tablerow({ text }: Tokens.TableRow<ParserOutput>): RendererOutput;
|
||||
tablecell(token: Tokens.TableCell): RendererOutput;
|
||||
/**
|
||||
* span level renderer
|
||||
*/
|
||||
strong(text: string): string;
|
||||
em(text: string): string;
|
||||
codespan(text: string): string;
|
||||
br(): string;
|
||||
del(text: string): string;
|
||||
link(href: string, title: string | null | undefined, text: string): string;
|
||||
image(href: string, title: string | null, text: string): string;
|
||||
text(text: string): string;
|
||||
strong({ tokens }: Tokens.Strong): RendererOutput;
|
||||
em({ tokens }: Tokens.Em): RendererOutput;
|
||||
codespan({ text }: Tokens.Codespan): RendererOutput;
|
||||
br(token: Tokens.Br): RendererOutput;
|
||||
del({ tokens }: Tokens.Del): RendererOutput;
|
||||
link({ href, title, tokens }: Tokens.Link): RendererOutput;
|
||||
image({ href, title, text, tokens }: Tokens.Image): RendererOutput;
|
||||
text(token: Tokens.Text | Tokens.Escape): RendererOutput;
|
||||
}
|
||||
declare class _TextRenderer {
|
||||
strong(text: string): string;
|
||||
em(text: string): string;
|
||||
codespan(text: string): string;
|
||||
del(text: string): string;
|
||||
html(text: string): string;
|
||||
text(text: string): string;
|
||||
link(href: string, title: string | null | undefined, text: string): string;
|
||||
image(href: string, title: string | null, text: string): string;
|
||||
br(): string;
|
||||
/**
|
||||
* TextRenderer
|
||||
* returns only the textual part of the token
|
||||
*/
|
||||
declare class _TextRenderer<RendererOutput = string> {
|
||||
strong({ text }: Tokens.Strong): RendererOutput;
|
||||
em({ text }: Tokens.Em): RendererOutput;
|
||||
codespan({ text }: Tokens.Codespan): RendererOutput;
|
||||
del({ text }: Tokens.Del): RendererOutput;
|
||||
html({ text }: Tokens.HTML | Tokens.Tag): RendererOutput;
|
||||
text({ text }: Tokens.Text | Tokens.Escape | Tokens.Tag): RendererOutput;
|
||||
link({ text }: Tokens.Link): RendererOutput;
|
||||
image({ text }: Tokens.Image): RendererOutput;
|
||||
br(): RendererOutput;
|
||||
checkbox({ raw }: Tokens.Checkbox): RendererOutput;
|
||||
}
|
||||
declare class _Parser {
|
||||
options: MarkedOptions;
|
||||
renderer: _Renderer;
|
||||
textRenderer: _TextRenderer;
|
||||
constructor(options?: MarkedOptions);
|
||||
/**
|
||||
* Parsing & Compiling
|
||||
*/
|
||||
declare class _Parser<ParserOutput = string, RendererOutput = string> {
|
||||
options: MarkedOptions<ParserOutput, RendererOutput>;
|
||||
renderer: _Renderer<ParserOutput, RendererOutput>;
|
||||
textRenderer: _TextRenderer<RendererOutput>;
|
||||
constructor(options?: MarkedOptions<ParserOutput, RendererOutput>);
|
||||
/**
|
||||
* Static Parse Method
|
||||
*/
|
||||
static parse(tokens: Token[], options?: MarkedOptions): string;
|
||||
static parse<ParserOutput = string, RendererOutput = string>(tokens: Token[], options?: MarkedOptions<ParserOutput, RendererOutput>): ParserOutput;
|
||||
/**
|
||||
* Static Parse Inline Method
|
||||
*/
|
||||
static parseInline(tokens: Token[], options?: MarkedOptions): string;
|
||||
static parseInline<ParserOutput = string, RendererOutput = string>(tokens: Token[], options?: MarkedOptions<ParserOutput, RendererOutput>): ParserOutput;
|
||||
/**
|
||||
* Parse Loop
|
||||
*/
|
||||
parse(tokens: Token[], top?: boolean): string;
|
||||
parse(tokens: Token[]): ParserOutput;
|
||||
/**
|
||||
* Parse Inline Tokens
|
||||
*/
|
||||
parseInline(tokens: Token[], renderer?: _Renderer | _TextRenderer): string;
|
||||
parseInline(tokens: Token[], renderer?: _Renderer<ParserOutput, RendererOutput> | _TextRenderer<RendererOutput>): ParserOutput;
|
||||
}
|
||||
declare const other: {
|
||||
codeRemoveIndent: RegExp;
|
||||
outputLinkReplace: RegExp;
|
||||
indentCodeCompensation: RegExp;
|
||||
beginningSpace: RegExp;
|
||||
endingHash: RegExp;
|
||||
startingSpaceChar: RegExp;
|
||||
endingSpaceChar: RegExp;
|
||||
nonSpaceChar: RegExp;
|
||||
newLineCharGlobal: RegExp;
|
||||
tabCharGlobal: RegExp;
|
||||
multipleSpaceGlobal: RegExp;
|
||||
blankLine: RegExp;
|
||||
doubleBlankLine: RegExp;
|
||||
blockquoteStart: RegExp;
|
||||
blockquoteSetextReplace: RegExp;
|
||||
blockquoteSetextReplace2: RegExp;
|
||||
listReplaceNesting: RegExp;
|
||||
listIsTask: RegExp;
|
||||
listReplaceTask: RegExp;
|
||||
listTaskCheckbox: RegExp;
|
||||
anyLine: RegExp;
|
||||
hrefBrackets: RegExp;
|
||||
tableDelimiter: RegExp;
|
||||
tableAlignChars: RegExp;
|
||||
tableRowBlankLine: RegExp;
|
||||
tableAlignRight: RegExp;
|
||||
tableAlignCenter: RegExp;
|
||||
tableAlignLeft: RegExp;
|
||||
startATag: RegExp;
|
||||
endATag: RegExp;
|
||||
startPreScriptTag: RegExp;
|
||||
endPreScriptTag: RegExp;
|
||||
startAngleBracket: RegExp;
|
||||
endAngleBracket: RegExp;
|
||||
pedanticHrefTitle: RegExp;
|
||||
unicodeAlphaNumeric: RegExp;
|
||||
escapeTest: RegExp;
|
||||
escapeReplace: RegExp;
|
||||
escapeTestNoEncode: RegExp;
|
||||
escapeReplaceNoEncode: RegExp;
|
||||
caret: RegExp;
|
||||
percentDecode: RegExp;
|
||||
findPipe: RegExp;
|
||||
splitPipe: RegExp;
|
||||
slashPipe: RegExp;
|
||||
carriageReturn: RegExp;
|
||||
spaceLine: RegExp;
|
||||
notSpaceStart: RegExp;
|
||||
endingNewline: RegExp;
|
||||
listItemRegex: (bull: string) => RegExp;
|
||||
nextBulletRegex: (indent: number) => RegExp;
|
||||
hrRegex: (indent: number) => RegExp;
|
||||
fencesBeginRegex: (indent: number) => RegExp;
|
||||
headingBeginRegex: (indent: number) => RegExp;
|
||||
htmlBeginRegex: (indent: number) => RegExp;
|
||||
blockquoteBeginRegex: (indent: number) => RegExp;
|
||||
};
|
||||
declare const blockNormal: {
|
||||
blockquote: RegExp;
|
||||
code: RegExp;
|
||||
|
|
@ -239,6 +321,8 @@ declare const inlineNormal: {
|
|||
br: RegExp;
|
||||
code: RegExp;
|
||||
del: RegExp;
|
||||
delLDelim: RegExp;
|
||||
delRDelim: RegExp;
|
||||
emStrongLDelim: RegExp;
|
||||
emStrongRDelimAst: RegExp;
|
||||
emStrongRDelimUnd: RegExp;
|
||||
|
|
@ -253,63 +337,19 @@ declare const inlineNormal: {
|
|||
url: RegExp;
|
||||
};
|
||||
export type InlineKeys = keyof typeof inlineNormal;
|
||||
/**
|
||||
* exports
|
||||
*/
|
||||
export declare const block: {
|
||||
normal: {
|
||||
blockquote: RegExp;
|
||||
code: RegExp;
|
||||
def: RegExp;
|
||||
fences: RegExp;
|
||||
heading: RegExp;
|
||||
hr: RegExp;
|
||||
html: RegExp;
|
||||
lheading: RegExp;
|
||||
list: RegExp;
|
||||
newline: RegExp;
|
||||
paragraph: RegExp;
|
||||
table: RegExp;
|
||||
text: RegExp;
|
||||
};
|
||||
gfm: Record<"code" | "blockquote" | "hr" | "html" | "table" | "text" | "heading" | "list" | "paragraph" | "def" | "fences" | "lheading" | "newline", RegExp>;
|
||||
pedantic: Record<"code" | "blockquote" | "hr" | "html" | "table" | "text" | "heading" | "list" | "paragraph" | "def" | "fences" | "lheading" | "newline", RegExp>;
|
||||
};
|
||||
export declare const inline: {
|
||||
normal: {
|
||||
_backpedal: RegExp;
|
||||
anyPunctuation: RegExp;
|
||||
autolink: RegExp;
|
||||
blockSkip: RegExp;
|
||||
br: RegExp;
|
||||
code: RegExp;
|
||||
del: RegExp;
|
||||
emStrongLDelim: RegExp;
|
||||
emStrongRDelimAst: RegExp;
|
||||
emStrongRDelimUnd: RegExp;
|
||||
escape: RegExp;
|
||||
link: RegExp;
|
||||
nolink: RegExp;
|
||||
punctuation: RegExp;
|
||||
reflink: RegExp;
|
||||
reflinkSearch: RegExp;
|
||||
tag: RegExp;
|
||||
text: RegExp;
|
||||
url: RegExp;
|
||||
};
|
||||
gfm: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
|
||||
breaks: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
|
||||
pedantic: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
|
||||
};
|
||||
export interface Rules {
|
||||
other: typeof other;
|
||||
block: Record<BlockKeys, RegExp>;
|
||||
inline: Record<InlineKeys, RegExp>;
|
||||
}
|
||||
declare class _Tokenizer {
|
||||
options: MarkedOptions;
|
||||
/**
|
||||
* Tokenizer
|
||||
*/
|
||||
declare class _Tokenizer<ParserOutput = string, RendererOutput = string> {
|
||||
options: MarkedOptions<ParserOutput, RendererOutput>;
|
||||
rules: Rules;
|
||||
lexer: _Lexer;
|
||||
constructor(options?: MarkedOptions);
|
||||
lexer: _Lexer<ParserOutput, RendererOutput>;
|
||||
constructor(options?: MarkedOptions<ParserOutput, RendererOutput>);
|
||||
space(src: string): Tokens.Space | undefined;
|
||||
code(src: string): Tokens.Code | undefined;
|
||||
fences(src: string): Tokens.Code | undefined;
|
||||
|
|
@ -330,15 +370,17 @@ declare class _Tokenizer {
|
|||
emStrong(src: string, maskedSrc: string, prevChar?: string): Tokens.Em | Tokens.Strong | undefined;
|
||||
codespan(src: string): Tokens.Codespan | undefined;
|
||||
br(src: string): Tokens.Br | undefined;
|
||||
del(src: string): Tokens.Del | undefined;
|
||||
del(src: string, maskedSrc: string, prevChar?: string): Tokens.Del | undefined;
|
||||
autolink(src: string): Tokens.Link | undefined;
|
||||
url(src: string): Tokens.Link | undefined;
|
||||
inlineText(src: string): Tokens.Text | undefined;
|
||||
}
|
||||
declare class _Hooks {
|
||||
options: MarkedOptions;
|
||||
constructor(options?: MarkedOptions);
|
||||
declare class _Hooks<ParserOutput = string, RendererOutput = string> {
|
||||
options: MarkedOptions<ParserOutput, RendererOutput>;
|
||||
block?: boolean;
|
||||
constructor(options?: MarkedOptions<ParserOutput, RendererOutput>);
|
||||
static passThroughHooks: Set<string>;
|
||||
static passThroughHooksRespectAsync: Set<string>;
|
||||
/**
|
||||
* Process markdown before marked
|
||||
*/
|
||||
|
|
@ -346,11 +388,23 @@ declare class _Hooks {
|
|||
/**
|
||||
* Process HTML after marked is finished
|
||||
*/
|
||||
postprocess(html: string): string;
|
||||
postprocess(html: ParserOutput): ParserOutput;
|
||||
/**
|
||||
* Process all tokens before walk tokens
|
||||
*/
|
||||
processAllTokens(tokens: Token[] | TokensList): Token[] | TokensList;
|
||||
/**
|
||||
* Mask contents that should not be interpreted as em/strong delimiters
|
||||
*/
|
||||
emStrongMask(src: string): string;
|
||||
/**
|
||||
* Provide function to tokenize markdown
|
||||
*/
|
||||
provideLexer(block?: boolean | undefined): typeof _Lexer.lexInline;
|
||||
/**
|
||||
* Provide function to parse tokens
|
||||
*/
|
||||
provideParser(block?: boolean | undefined): (tokens: Token[], options?: MarkedOptions<ParserOutput, RendererOutput> | undefined) => ParserOutput;
|
||||
}
|
||||
export interface TokenizerThis {
|
||||
lexer: _Lexer;
|
||||
|
|
@ -360,32 +414,32 @@ export type TokenizerStartFunction = (this: TokenizerThis, src: string) => numbe
|
|||
export interface TokenizerExtension {
|
||||
name: string;
|
||||
level: "block" | "inline";
|
||||
start?: TokenizerStartFunction | undefined;
|
||||
start?: TokenizerStartFunction;
|
||||
tokenizer: TokenizerExtensionFunction;
|
||||
childTokens?: string[] | undefined;
|
||||
childTokens?: string[];
|
||||
}
|
||||
export interface RendererThis {
|
||||
parser: _Parser;
|
||||
export interface RendererThis<ParserOutput = string, RendererOutput = string> {
|
||||
parser: _Parser<ParserOutput, RendererOutput>;
|
||||
}
|
||||
export type RendererExtensionFunction = (this: RendererThis, token: Tokens.Generic) => string | false | undefined;
|
||||
export interface RendererExtension {
|
||||
export type RendererExtensionFunction<ParserOutput = string, RendererOutput = string> = (this: RendererThis<ParserOutput, RendererOutput>, token: Tokens.Generic) => RendererOutput | false | undefined;
|
||||
export interface RendererExtension<ParserOutput = string, RendererOutput = string> {
|
||||
name: string;
|
||||
renderer: RendererExtensionFunction;
|
||||
renderer: RendererExtensionFunction<ParserOutput, RendererOutput>;
|
||||
}
|
||||
export type TokenizerAndRendererExtension = TokenizerExtension | RendererExtension | (TokenizerExtension & RendererExtension);
|
||||
export type HooksApi = Omit<_Hooks, "constructor" | "options">;
|
||||
export type HooksObject = {
|
||||
[K in keyof HooksApi]?: (...args: Parameters<HooksApi[K]>) => ReturnType<HooksApi[K]> | Promise<ReturnType<HooksApi[K]>>;
|
||||
export type TokenizerAndRendererExtension<ParserOutput = string, RendererOutput = string> = TokenizerExtension | RendererExtension<ParserOutput, RendererOutput> | (TokenizerExtension & RendererExtension<ParserOutput, RendererOutput>);
|
||||
export type HooksApi<ParserOutput = string, RendererOutput = string> = Omit<_Hooks<ParserOutput, RendererOutput>, "constructor" | "options" | "block">;
|
||||
export type HooksObject<ParserOutput = string, RendererOutput = string> = {
|
||||
[K in keyof HooksApi<ParserOutput, RendererOutput>]?: (this: _Hooks<ParserOutput, RendererOutput>, ...args: Parameters<HooksApi<ParserOutput, RendererOutput>[K]>) => ReturnType<HooksApi<ParserOutput, RendererOutput>[K]> | Promise<ReturnType<HooksApi<ParserOutput, RendererOutput>[K]>>;
|
||||
};
|
||||
export type RendererApi = Omit<_Renderer, "constructor" | "options">;
|
||||
export type RendererObject = {
|
||||
[K in keyof RendererApi]?: (...args: Parameters<RendererApi[K]>) => ReturnType<RendererApi[K]> | false;
|
||||
export type RendererApi<ParserOutput = string, RendererOutput = string> = Omit<_Renderer<ParserOutput, RendererOutput>, "constructor" | "options" | "parser">;
|
||||
export type RendererObject<ParserOutput = string, RendererOutput = string> = {
|
||||
[K in keyof RendererApi<ParserOutput, RendererOutput>]?: (this: _Renderer<ParserOutput, RendererOutput>, ...args: Parameters<RendererApi<ParserOutput, RendererOutput>[K]>) => ReturnType<RendererApi<ParserOutput, RendererOutput>[K]> | false;
|
||||
};
|
||||
export type TokenizerApi = Omit<_Tokenizer, "constructor" | "options" | "rules" | "lexer">;
|
||||
export type TokenizerObject = {
|
||||
[K in keyof TokenizerApi]?: (...args: Parameters<TokenizerApi[K]>) => ReturnType<TokenizerApi[K]> | false;
|
||||
export type TokenizerApi<ParserOutput = string, RendererOutput = string> = Omit<_Tokenizer<ParserOutput, RendererOutput>, "constructor" | "options" | "rules" | "lexer">;
|
||||
export type TokenizerObject<ParserOutput = string, RendererOutput = string> = {
|
||||
[K in keyof TokenizerApi<ParserOutput, RendererOutput>]?: (this: _Tokenizer<ParserOutput, RendererOutput>, ...args: Parameters<TokenizerApi<ParserOutput, RendererOutput>[K]>) => ReturnType<TokenizerApi<ParserOutput, RendererOutput>[K]> | false;
|
||||
};
|
||||
export interface MarkedExtension {
|
||||
export interface MarkedExtension<ParserOutput = string, RendererOutput = string> {
|
||||
/**
|
||||
* True will tell marked to await any walkTokens functions before parsing the tokens and returning an HTML string.
|
||||
*/
|
||||
|
|
@ -393,69 +447,72 @@ export interface MarkedExtension {
|
|||
/**
|
||||
* Enable GFM line breaks. This option requires the gfm option to be true.
|
||||
*/
|
||||
breaks?: boolean | undefined;
|
||||
breaks?: boolean;
|
||||
/**
|
||||
* Add tokenizers and renderers to marked
|
||||
*/
|
||||
extensions?: TokenizerAndRendererExtension[] | undefined | null;
|
||||
extensions?: TokenizerAndRendererExtension<ParserOutput, RendererOutput>[] | null;
|
||||
/**
|
||||
* Enable GitHub flavored markdown.
|
||||
*/
|
||||
gfm?: boolean | undefined;
|
||||
gfm?: boolean;
|
||||
/**
|
||||
* Hooks are methods that hook into some part of marked.
|
||||
* preprocess is called to process markdown before sending it to marked.
|
||||
* processAllTokens is called with the TokensList before walkTokens.
|
||||
* postprocess is called to process html after marked has finished parsing.
|
||||
* emStrongMask is called to mask contents that should not be interpreted as em/strong delimiters.
|
||||
* provideLexer is called to provide a function to tokenize markdown.
|
||||
* provideParser is called to provide a function to parse tokens.
|
||||
*/
|
||||
hooks?: HooksObject | undefined | null;
|
||||
hooks?: HooksObject<ParserOutput, RendererOutput> | null;
|
||||
/**
|
||||
* Conform to obscure parts of markdown.pl as much as possible. Don't fix any of the original markdown bugs or poor behavior.
|
||||
*/
|
||||
pedantic?: boolean | undefined;
|
||||
pedantic?: boolean;
|
||||
/**
|
||||
* Type: object Default: new Renderer()
|
||||
*
|
||||
* An object containing functions to render tokens to HTML.
|
||||
*/
|
||||
renderer?: RendererObject | undefined | null;
|
||||
renderer?: RendererObject<ParserOutput, RendererOutput> | null;
|
||||
/**
|
||||
* Shows an HTML error message when rendering fails.
|
||||
*/
|
||||
silent?: boolean | undefined;
|
||||
silent?: boolean;
|
||||
/**
|
||||
* The tokenizer defines how to turn markdown text into tokens.
|
||||
*/
|
||||
tokenizer?: TokenizerObject | undefined | null;
|
||||
tokenizer?: TokenizerObject | null;
|
||||
/**
|
||||
* The walkTokens function gets called with every token.
|
||||
* Child tokens are called before moving on to sibling tokens.
|
||||
* Each token is passed by reference so updates are persisted when passed to the parser.
|
||||
* The return value of the function is ignored.
|
||||
*/
|
||||
walkTokens?: ((token: Token) => void | Promise<void>) | undefined | null;
|
||||
walkTokens?: ((token: Token) => void | Promise<void>) | null;
|
||||
}
|
||||
export interface MarkedOptions extends Omit<MarkedExtension, "hooks" | "renderer" | "tokenizer" | "extensions" | "walkTokens"> {
|
||||
export interface MarkedOptions<ParserOutput = string, RendererOutput = string> extends Omit<MarkedExtension<ParserOutput, RendererOutput>, "hooks" | "renderer" | "tokenizer" | "extensions" | "walkTokens"> {
|
||||
/**
|
||||
* Hooks are methods that hook into some part of marked.
|
||||
*/
|
||||
hooks?: _Hooks | undefined | null;
|
||||
hooks?: _Hooks<ParserOutput, RendererOutput> | null;
|
||||
/**
|
||||
* Type: object Default: new Renderer()
|
||||
*
|
||||
* An object containing functions to render tokens to HTML.
|
||||
*/
|
||||
renderer?: _Renderer | undefined | null;
|
||||
renderer?: _Renderer<ParserOutput, RendererOutput> | null;
|
||||
/**
|
||||
* The tokenizer defines how to turn markdown text into tokens.
|
||||
*/
|
||||
tokenizer?: _Tokenizer | undefined | null;
|
||||
tokenizer?: _Tokenizer<ParserOutput, RendererOutput> | null;
|
||||
/**
|
||||
* Custom extensions
|
||||
*/
|
||||
extensions?: null | {
|
||||
renderers: {
|
||||
[name: string]: RendererExtensionFunction;
|
||||
[name: string]: RendererExtensionFunction<ParserOutput, RendererOutput>;
|
||||
};
|
||||
childTokens: {
|
||||
[name: string]: string[];
|
||||
|
|
@ -470,17 +527,23 @@ export interface MarkedOptions extends Omit<MarkedExtension, "hooks" | "renderer
|
|||
*/
|
||||
walkTokens?: null | ((token: Token) => void | Promise<void> | (void | Promise<void>)[]);
|
||||
}
|
||||
declare class _Lexer {
|
||||
/**
|
||||
* Block Lexer
|
||||
*/
|
||||
declare class _Lexer<ParserOutput = string, RendererOutput = string> {
|
||||
tokens: TokensList;
|
||||
options: MarkedOptions;
|
||||
options: MarkedOptions<ParserOutput, RendererOutput>;
|
||||
state: {
|
||||
inLink: boolean;
|
||||
inRawBlock: boolean;
|
||||
top: boolean;
|
||||
};
|
||||
inlineQueue: {
|
||||
src: string;
|
||||
tokens: Token[];
|
||||
}[];
|
||||
private tokenizer;
|
||||
private inlineQueue;
|
||||
constructor(options?: MarkedOptions);
|
||||
constructor(options?: MarkedOptions<ParserOutput, RendererOutput>);
|
||||
/**
|
||||
* Expose Rules
|
||||
*/
|
||||
|
|
@ -501,8 +564,8 @@ declare class _Lexer {
|
|||
table: RegExp;
|
||||
text: RegExp;
|
||||
};
|
||||
gfm: Record<"code" | "blockquote" | "hr" | "html" | "table" | "text" | "heading" | "list" | "paragraph" | "def" | "fences" | "lheading" | "newline", RegExp>;
|
||||
pedantic: Record<"code" | "blockquote" | "hr" | "html" | "table" | "text" | "heading" | "list" | "paragraph" | "def" | "fences" | "lheading" | "newline", RegExp>;
|
||||
gfm: Record<"code" | "blockquote" | "hr" | "html" | "table" | "text" | "def" | "heading" | "list" | "paragraph" | "fences" | "lheading" | "newline", RegExp>;
|
||||
pedantic: Record<"code" | "blockquote" | "hr" | "html" | "table" | "text" | "def" | "heading" | "list" | "paragraph" | "fences" | "lheading" | "newline", RegExp>;
|
||||
};
|
||||
inline: {
|
||||
normal: {
|
||||
|
|
@ -513,6 +576,8 @@ declare class _Lexer {
|
|||
br: RegExp;
|
||||
code: RegExp;
|
||||
del: RegExp;
|
||||
delLDelim: RegExp;
|
||||
delRDelim: RegExp;
|
||||
emStrongLDelim: RegExp;
|
||||
emStrongRDelimAst: RegExp;
|
||||
emStrongRDelimUnd: RegExp;
|
||||
|
|
@ -526,19 +591,19 @@ declare class _Lexer {
|
|||
text: RegExp;
|
||||
url: RegExp;
|
||||
};
|
||||
gfm: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
|
||||
breaks: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
|
||||
pedantic: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
|
||||
gfm: Record<"link" | "code" | "url" | "br" | "del" | "text" | "tag" | "escape" | "reflink" | "nolink" | "_backpedal" | "anyPunctuation" | "autolink" | "blockSkip" | "delLDelim" | "delRDelim" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
|
||||
breaks: Record<"link" | "code" | "url" | "br" | "del" | "text" | "tag" | "escape" | "reflink" | "nolink" | "_backpedal" | "anyPunctuation" | "autolink" | "blockSkip" | "delLDelim" | "delRDelim" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
|
||||
pedantic: Record<"link" | "code" | "url" | "br" | "del" | "text" | "tag" | "escape" | "reflink" | "nolink" | "_backpedal" | "anyPunctuation" | "autolink" | "blockSkip" | "delLDelim" | "delRDelim" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
|
||||
};
|
||||
};
|
||||
/**
|
||||
* Static Lex Method
|
||||
*/
|
||||
static lex(src: string, options?: MarkedOptions): TokensList;
|
||||
static lex<ParserOutput = string, RendererOutput = string>(src: string, options?: MarkedOptions<ParserOutput, RendererOutput>): TokensList;
|
||||
/**
|
||||
* Static Lex Inline Method
|
||||
*/
|
||||
static lexInline(src: string, options?: MarkedOptions): Token[];
|
||||
static lexInline<ParserOutput = string, RendererOutput = string>(src: string, options?: MarkedOptions<ParserOutput, RendererOutput>): Token[];
|
||||
/**
|
||||
* Preprocessing
|
||||
*/
|
||||
|
|
@ -546,38 +611,73 @@ declare class _Lexer {
|
|||
/**
|
||||
* Lexing
|
||||
*/
|
||||
blockTokens(src: string, tokens?: Token[]): Token[];
|
||||
blockTokens(src: string, tokens?: TokensList): TokensList;
|
||||
blockTokens(src: string, tokens?: Token[], lastParagraphClipped?: boolean): Token[];
|
||||
blockTokens(src: string, tokens?: TokensList, lastParagraphClipped?: boolean): TokensList;
|
||||
inline(src: string, tokens?: Token[]): Token[];
|
||||
/**
|
||||
* Lexing/Compiling
|
||||
*/
|
||||
inlineTokens(src: string, tokens?: Token[]): Token[];
|
||||
private infiniteLoopError;
|
||||
}
|
||||
declare function _getDefaults(): MarkedOptions;
|
||||
declare let _defaults: MarkedOptions;
|
||||
/**
|
||||
* Gets the original marked default options.
|
||||
*/
|
||||
declare function _getDefaults<ParserOutput = string, RendererOutput = string>(): MarkedOptions<ParserOutput, RendererOutput>;
|
||||
declare let _defaults: MarkedOptions<any, any>;
|
||||
export type MaybePromise = void | Promise<void>;
|
||||
export declare class Marked {
|
||||
#private;
|
||||
defaults: MarkedOptions;
|
||||
options: (opt: MarkedOptions) => this;
|
||||
parse: (src: string, options?: MarkedOptions | undefined | null) => string | Promise<string>;
|
||||
parseInline: (src: string, options?: MarkedOptions | undefined | null) => string | Promise<string>;
|
||||
Parser: typeof _Parser;
|
||||
Renderer: typeof _Renderer;
|
||||
TextRenderer: typeof _TextRenderer;
|
||||
export declare class Marked<ParserOutput = string, RendererOutput = string> {
|
||||
defaults: MarkedOptions<ParserOutput, RendererOutput>;
|
||||
options: (opt: MarkedOptions<ParserOutput, RendererOutput>) => this;
|
||||
parse: {
|
||||
(src: string, options: MarkedOptions<ParserOutput, RendererOutput> & {
|
||||
async: true;
|
||||
}): Promise<ParserOutput>;
|
||||
(src: string, options: MarkedOptions<ParserOutput, RendererOutput> & {
|
||||
async: false;
|
||||
}): ParserOutput;
|
||||
(src: string, options?: MarkedOptions<ParserOutput, RendererOutput> | null): ParserOutput | Promise<ParserOutput>;
|
||||
};
|
||||
parseInline: {
|
||||
(src: string, options: MarkedOptions<ParserOutput, RendererOutput> & {
|
||||
async: true;
|
||||
}): Promise<ParserOutput>;
|
||||
(src: string, options: MarkedOptions<ParserOutput, RendererOutput> & {
|
||||
async: false;
|
||||
}): ParserOutput;
|
||||
(src: string, options?: MarkedOptions<ParserOutput, RendererOutput> | null): ParserOutput | Promise<ParserOutput>;
|
||||
};
|
||||
Parser: {
|
||||
new (options?: MarkedOptions<ParserOutput, RendererOutput> | undefined): _Parser<ParserOutput, RendererOutput>;
|
||||
parse<ParserOutput_1 = string, RendererOutput_1 = string>(tokens: Token[], options?: MarkedOptions<ParserOutput_1, RendererOutput_1>): ParserOutput_1;
|
||||
parseInline<ParserOutput_1 = string, RendererOutput_1 = string>(tokens: Token[], options?: MarkedOptions<ParserOutput_1, RendererOutput_1>): ParserOutput_1;
|
||||
};
|
||||
Renderer: {
|
||||
new (options?: MarkedOptions<ParserOutput, RendererOutput> | undefined): _Renderer<ParserOutput, RendererOutput>;
|
||||
};
|
||||
TextRenderer: {
|
||||
new (): _TextRenderer<RendererOutput>;
|
||||
};
|
||||
Lexer: typeof _Lexer;
|
||||
Tokenizer: typeof _Tokenizer;
|
||||
Hooks: typeof _Hooks;
|
||||
constructor(...args: MarkedExtension[]);
|
||||
Tokenizer: {
|
||||
new (options?: MarkedOptions<ParserOutput, RendererOutput> | undefined): _Tokenizer<ParserOutput, RendererOutput>;
|
||||
};
|
||||
Hooks: {
|
||||
new (options?: MarkedOptions<ParserOutput, RendererOutput> | undefined): _Hooks<ParserOutput, RendererOutput>;
|
||||
passThroughHooks: Set<string>;
|
||||
passThroughHooksRespectAsync: Set<string>;
|
||||
};
|
||||
constructor(...args: MarkedExtension<ParserOutput, RendererOutput>[]);
|
||||
/**
|
||||
* Run callback for every token
|
||||
*/
|
||||
walkTokens(tokens: Token[] | TokensList, callback: (token: Token) => MaybePromise | MaybePromise[]): MaybePromise[];
|
||||
use(...args: MarkedExtension[]): this;
|
||||
setOptions(opt: MarkedOptions): this;
|
||||
lexer(src: string, options?: MarkedOptions): TokensList;
|
||||
parser(tokens: Token[], options?: MarkedOptions): string;
|
||||
use(...args: MarkedExtension<ParserOutput, RendererOutput>[]): this;
|
||||
setOptions(opt: MarkedOptions<ParserOutput, RendererOutput>): this;
|
||||
lexer(src: string, options?: MarkedOptions<ParserOutput, RendererOutput>): TokensList;
|
||||
parser(tokens: Token[], options?: MarkedOptions<ParserOutput, RendererOutput>): ParserOutput;
|
||||
private parseMarkdown;
|
||||
private onError;
|
||||
}
|
||||
/**
|
||||
* Compiles markdown to HTML asynchronously.
|
||||
|
|
@ -594,17 +694,31 @@ export declare function marked(src: string, options: MarkedOptions & {
|
|||
*
|
||||
* @param src String of markdown source to be compiled
|
||||
* @param options Optional hash of options
|
||||
* @return String of compiled HTML. Wil be a Promise of string if async is set to true by any extensions.
|
||||
* @return String of compiled HTML. Will be a Promise of string if async is set to true by any extensions.
|
||||
*/
|
||||
export declare function marked(src: string, options?: MarkedOptions): string | Promise<string>;
|
||||
export declare function marked(src: string, options: MarkedOptions & {
|
||||
async: false;
|
||||
}): string;
|
||||
export declare function marked(src: string, options: MarkedOptions & {
|
||||
async: true;
|
||||
}): Promise<string>;
|
||||
export declare function marked(src: string, options?: MarkedOptions | null): string | Promise<string>;
|
||||
export declare namespace marked {
|
||||
var options: (options: MarkedOptions) => typeof marked;
|
||||
var setOptions: (options: MarkedOptions) => typeof marked;
|
||||
var getDefaults: typeof _getDefaults;
|
||||
var defaults: MarkedOptions;
|
||||
var defaults: MarkedOptions<any, any>;
|
||||
var use: (...args: MarkedExtension[]) => typeof marked;
|
||||
var walkTokens: (tokens: Token[] | TokensList, callback: (token: Token) => MaybePromise | MaybePromise[]) => MaybePromise[];
|
||||
var parseInline: (src: string, options?: MarkedOptions | null | undefined) => string | Promise<string>;
|
||||
var parseInline: {
|
||||
(src: string, options: MarkedOptions<string, string> & {
|
||||
async: true;
|
||||
}): Promise<string>;
|
||||
(src: string, options: MarkedOptions<string, string> & {
|
||||
async: false;
|
||||
}): string;
|
||||
(src: string, options?: MarkedOptions<string, string> | null | undefined): string | Promise<string>;
|
||||
};
|
||||
var Parser: typeof _Parser;
|
||||
var parser: typeof _Parser.parse;
|
||||
var Renderer: typeof _Renderer;
|
||||
|
|
@ -619,7 +733,15 @@ export declare const options: (options: MarkedOptions) => typeof marked;
|
|||
export declare const setOptions: (options: MarkedOptions) => typeof marked;
|
||||
export declare const use: (...args: MarkedExtension[]) => typeof marked;
|
||||
export declare const walkTokens: (tokens: Token[] | TokensList, callback: (token: Token) => MaybePromise | MaybePromise[]) => MaybePromise[];
|
||||
export declare const parseInline: (src: string, options?: MarkedOptions | null | undefined) => string | Promise<string>;
|
||||
export declare const parseInline: {
|
||||
(src: string, options: MarkedOptions<string, string> & {
|
||||
async: true;
|
||||
}): Promise<string>;
|
||||
(src: string, options: MarkedOptions<string, string> & {
|
||||
async: false;
|
||||
}): string;
|
||||
(src: string, options?: MarkedOptions<string, string> | null | undefined): string | Promise<string>;
|
||||
};
|
||||
export declare const parse: typeof marked;
|
||||
export declare const parser: typeof _Parser.parse;
|
||||
export declare const lexer: typeof _Lexer.lex;
|
||||
|
|
|
|||
2481
static/js/lib/node_modules/marked/lib/marked.esm.js
generated
vendored
2481
static/js/lib/node_modules/marked/lib/marked.esm.js
generated
vendored
File diff suppressed because one or more lines are too long
8
static/js/lib/node_modules/marked/lib/marked.esm.js.map
generated
vendored
8
static/js/lib/node_modules/marked/lib/marked.esm.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2507
static/js/lib/node_modules/marked/lib/marked.umd.js
generated
vendored
2507
static/js/lib/node_modules/marked/lib/marked.umd.js
generated
vendored
File diff suppressed because one or more lines are too long
8
static/js/lib/node_modules/marked/lib/marked.umd.js.map
generated
vendored
8
static/js/lib/node_modules/marked/lib/marked.umd.js.map
generated
vendored
File diff suppressed because one or more lines are too long
6
static/js/lib/node_modules/marked/man/marked.1
generated
vendored
6
static/js/lib/node_modules/marked/man/marked.1
generated
vendored
|
|
@ -1,4 +1,4 @@
|
|||
.TH "MARKED" "1" "December 2023" "11.1.0"
|
||||
.TH "MARKED" "1" "May 2026" "18.0.2"
|
||||
.SH "NAME"
|
||||
\fBmarked\fR \- a javascript markdown parser
|
||||
.SH SYNOPSIS
|
||||
|
|
@ -104,7 +104,9 @@ marked\.parse('*foo*');
|
|||
Please report any bugs to https://github.com/markedjs/marked
|
||||
.SH LICENSE
|
||||
.P
|
||||
Copyright (c) 2011\-2014, Christopher Jeffrey (MIT License)\.
|
||||
Copyright (c) 2018+, MarkedJS\. (MIT License)
|
||||
.br
|
||||
Copyright (c) 2011\-2018, Christopher Jeffrey\. (MIT License)
|
||||
.SH SEE ALSO
|
||||
.P
|
||||
markdown(1), nodejs(1)
|
||||
|
|
|
|||
3
static/js/lib/node_modules/marked/man/marked.1.md
generated
vendored
3
static/js/lib/node_modules/marked/man/marked.1.md
generated
vendored
|
|
@ -85,7 +85,8 @@ Please report any bugs to <https://github.com/markedjs/marked>.
|
|||
|
||||
## LICENSE
|
||||
|
||||
Copyright (c) 2011-2014, Christopher Jeffrey (MIT License).
|
||||
Copyright (c) 2018+, MarkedJS. (MIT License)
|
||||
Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
|
||||
|
||||
## SEE ALSO
|
||||
|
||||
|
|
|
|||
6
static/js/lib/node_modules/marked/marked.min.js
generated
vendored
6
static/js/lib/node_modules/marked/marked.min.js
generated
vendored
File diff suppressed because one or more lines are too long
113
static/js/lib/node_modules/marked/package.json
generated
vendored
113
static/js/lib/node_modules/marked/package.json
generated
vendored
|
|
@ -2,9 +2,9 @@
|
|||
"name": "marked",
|
||||
"description": "A markdown parser built for speed",
|
||||
"author": "Christopher Jeffrey",
|
||||
"version": "11.1.1",
|
||||
"version": "18.0.3",
|
||||
"type": "module",
|
||||
"main": "./lib/marked.cjs",
|
||||
"main": "./lib/marked.esm.js",
|
||||
"module": "./lib/marked.esm.js",
|
||||
"browser": "./lib/marked.umd.js",
|
||||
"types": "./lib/marked.d.ts",
|
||||
|
|
@ -15,25 +15,23 @@
|
|||
"files": [
|
||||
"bin/",
|
||||
"lib/",
|
||||
"man/",
|
||||
"marked.min.js"
|
||||
"man/"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./lib/marked.d.ts",
|
||||
"default": "./lib/marked.esm.js"
|
||||
},
|
||||
"default": {
|
||||
"types": "./lib/marked.d.cts",
|
||||
"default": "./lib/marked.cjs"
|
||||
}
|
||||
"types": "./lib/marked.d.ts",
|
||||
"default": "./lib/marked.esm.js"
|
||||
},
|
||||
"./bin/marked": "./bin/marked.js",
|
||||
"./marked.min.js": "./marked.min.js",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"repository": "git://github.com/markedjs/marked.git",
|
||||
"publishConfig": {
|
||||
"provenance": true
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/markedjs/marked.git"
|
||||
},
|
||||
"homepage": "https://marked.js.org",
|
||||
"bugs": {
|
||||
"url": "http://github.com/markedjs/marked/issues"
|
||||
|
|
@ -50,59 +48,56 @@
|
|||
"html"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@markedjs/testutils": "9.1.5-0",
|
||||
"@arethetypeswrong/cli": "^0.13.5",
|
||||
"@rollup/plugin-terser": "^0.4.4",
|
||||
"@rollup/plugin-typescript": "^11.1.5",
|
||||
"@semantic-release/commit-analyzer": "^11.1.0",
|
||||
"@arethetypeswrong/cli": "^0.18.2",
|
||||
"@markedjs/eslint-config": "^1.0.14",
|
||||
"@markedjs/testutils": "18.0.0-1",
|
||||
"@semantic-release/commit-analyzer": "^13.0.1",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"@semantic-release/github": "^9.2.6",
|
||||
"@semantic-release/npm": "^11.0.2",
|
||||
"@semantic-release/release-notes-generator": "^12.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "^6.15.0",
|
||||
"@typescript-eslint/parser": "^6.13.2",
|
||||
"cheerio": "^1.0.0-rc.12",
|
||||
"commonmark": "0.30.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"dts-bundle-generator": "^9.0.0",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-config-standard": "^17.1.0",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"eslint-plugin-n": "^16.5.0",
|
||||
"eslint-plugin-promise": "^6.1.1",
|
||||
"highlight.js": "^11.9.0",
|
||||
"markdown-it": "13.0.2",
|
||||
"marked-highlight": "^2.1.0",
|
||||
"marked-man": "^2.0.0",
|
||||
"node-fetch": "^3.3.2",
|
||||
"recheck": "^4.4.5",
|
||||
"rollup": "^4.9.1",
|
||||
"semantic-release": "^22.0.12",
|
||||
"@semantic-release/github": "^12.0.6",
|
||||
"@semantic-release/npm": "^13.1.5",
|
||||
"@semantic-release/release-notes-generator": "^14.1.0",
|
||||
"cheerio": "1.2.0",
|
||||
"commonmark": "0.31.2",
|
||||
"cross-env": "^10.1.0",
|
||||
"dts-bundle-generator": "^9.5.1",
|
||||
"esbuild": "^0.28.0",
|
||||
"esbuild-plugin-umd-wrapper": "^3.0.0",
|
||||
"eslint": "^10.2.1",
|
||||
"highlight.js": "^11.11.1",
|
||||
"markdown-it": "14.1.1",
|
||||
"marked-highlight": "^2.2.4",
|
||||
"marked-man": "^2.1.0",
|
||||
"recheck": "^4.5.0",
|
||||
"rimraf": "^6.1.3",
|
||||
"semantic-release": "^25.0.3",
|
||||
"titleize": "^4.0.0",
|
||||
"ts-expect": "^1.3.0",
|
||||
"typescript": "5.3.3"
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "6.0.3"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "npm run build && npm run test:specs && npm run test:unit",
|
||||
"test:all": "npm test && npm run test:umd && npm run test:types && npm run test:lint",
|
||||
"test:unit": "node --test --test-reporter=spec test/unit",
|
||||
"test:specs": "node --test --test-reporter=spec test/run-spec-tests.js",
|
||||
"test:lint": "eslint .",
|
||||
"test:redos": "node test/recheck.js > vuln.js",
|
||||
"test:types": "tsc --project tsconfig-type-test.json && attw -P --exclude-entrypoints ./bin/marked ./marked.min.js",
|
||||
"test:umd": "node test/umd-test.js",
|
||||
"test:update": "node test/update-specs.js",
|
||||
"rules": "node test/rules.js",
|
||||
"bench": "npm run build && node test/bench.js",
|
||||
"lint": "eslint --fix .",
|
||||
"build:reset": "git checkout upstream/master lib/marked.cjs lib/marked.umd.js lib/marked.esm.js marked.min.js",
|
||||
"build": "npm run rollup && npm run build:types && npm run build:man",
|
||||
"build": "npm run build:esbuild && npm run build:types && npm run build:man",
|
||||
"build:docs": "npm run build && node docs/build.js",
|
||||
"build:types": "tsc && dts-bundle-generator --project tsconfig.json -o lib/marked.d.ts src/marked.ts && dts-bundle-generator --project tsconfig.json -o lib/marked.d.cts src/marked.ts",
|
||||
"build:esbuild": "node esbuild.config.js",
|
||||
"build:man": "marked-man man/marked.1.md > man/marked.1",
|
||||
"rollup": "rollup -c rollup.config.js"
|
||||
"build:reset": "rimraf ./lib ./public",
|
||||
"build:types": "tsc && dts-bundle-generator --export-referenced-types --project tsconfig.json -o lib/marked.d.ts src/marked.ts",
|
||||
"lint": "eslint --fix",
|
||||
"rules": "node test/rules.js",
|
||||
"test": "npm run build:reset && npm run build:docs && npm run test:specs && npm run test:unit && npm run test:umd && npm run test:cjs && npm run test:types && npm run test:lint",
|
||||
"test:cjs": "node test/cjs-test.cjs",
|
||||
"test:lint": "eslint",
|
||||
"test:only": "npm run build && npm run test:specs:only && npm run test:unit:only",
|
||||
"test:redos": "node test/recheck.ts > vuln.js",
|
||||
"test:specs:only": "node --test --test-only --test-reporter=spec test/run-spec-tests.js",
|
||||
"test:specs": "node --test --test-reporter=spec test/run-spec-tests.js",
|
||||
"test:types": "tsc --project tsconfig-type-test.json && attw -P --entrypoints . --profile esm-only",
|
||||
"test:umd": "node test/umd-test.js",
|
||||
"test:unit:only": "node --test --test-only --test-reporter=spec test/unit/*.test.js",
|
||||
"test:unit": "node --test --test-reporter=spec test/unit/*.test.js",
|
||||
"test:update": "node test/update-specs.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
"node": ">= 20"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue