Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/marked

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/marked - npm Package Compare versions

Comparing version 2.0.4 to 3.0.0

251

marked/index.d.ts

@@ -1,2 +0,2 @@

// Type definitions for Marked 2.0
// Type definitions for Marked 3.0
// Project: https://github.com/markedjs/marked, https://marked.js.org

@@ -11,2 +11,3 @@ // Definitions by: William Orr <https://github.com/worr>

// Sarun Intaralawan <https://github.com/sarunint>
// Tony Brix <https://github.com/UziTech>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

@@ -83,3 +84,3 @@

*/
function parser(src: TokensList, options?: MarkedOptions): string;
function parser(src: Token[] | TokensList, options?: MarkedOptions): string;

@@ -114,3 +115,3 @@ /**

function walkTokens(tokens: TokensList, callback: (token: Token) => void): typeof marked;
function walkTokens(tokens: Token[] | TokensList, callback: (token: Token) => void): typeof marked;

@@ -121,3 +122,3 @@ /**

*/
function use(options: MarkedExtension): void;
function use(...extensions: MarkedExtension[]): void;

@@ -127,37 +128,33 @@ class Tokenizer<T = never> {

options: MarkedOptions;
space(src: string): Tokens.Space | T;
code(src: string): Tokens.Code | T;
fences(src: string): Tokens.Code | T;
heading(src: string): Tokens.Heading | T;
nptable(src: string): Tokens.Table | T;
hr(src: string): Tokens.Hr | T;
blockquote(src: string): Tokens.Blockquote | T;
list(src: string): Tokens.List | T;
html(src: string): Tokens.HTML | T;
def(src: string): Tokens.Def | T;
table(src: string): Tokens.Table | T;
lheading(src: string): Tokens.Heading | T;
paragraph(src: string): Tokens.Paragraph | T;
text(src: string): Tokens.Text | T;
escape(src: string): Tokens.Escape | T;
tag(src: string, inLink: boolean, inRawBlock: boolean): Tokens.Tag | T;
link(src: string): Tokens.Image | Tokens.Link | T;
space(this: TokenizerThis, src: string): Tokens.Space | T;
code(this: TokenizerThis, src: string): Tokens.Code | T;
fences(this: TokenizerThis, src: string): Tokens.Code | T;
heading(this: TokenizerThis, src: string): Tokens.Heading | T;
hr(this: TokenizerThis, src: string): Tokens.Hr | T;
blockquote(this: TokenizerThis, src: string): Tokens.Blockquote | T;
list(this: TokenizerThis, src: string): Tokens.List | T;
html(this: TokenizerThis, src: string): Tokens.HTML | T;
def(this: TokenizerThis, src: string): Tokens.Def | T;
table(this: TokenizerThis, src: string): Tokens.Table | T;
lheading(this: TokenizerThis, src: string): Tokens.Heading | T;
paragraph(this: TokenizerThis, src: string): Tokens.Paragraph | T;
text(this: TokenizerThis, src: string): Tokens.Text | T;
escape(this: TokenizerThis, src: string): Tokens.Escape | T;
tag(this: TokenizerThis, src: string): Tokens.Tag | T;
link(this: TokenizerThis, src: string): Tokens.Image | Tokens.Link | T;
reflink(
this: TokenizerThis,
src: string,
links: Tokens.Link[] | Tokens.Image[],
): Tokens.Link | Tokens.Image | Tokens.Text | T;
emStrong(src: string, maskedSrc: string, prevChar: string): Tokens.Em | Tokens.Strong | T;
codespan(src: string): Tokens.Codespan | T;
br(src: string): Tokens.Br | T;
del(src: string): Tokens.Del | T;
autolink(src: string, mangle: (cap: string) => string): Tokens.Link | T;
url(src: string, mangle: (cap: string) => string): Tokens.Link | T;
inlineText(
src: string,
inRawBlock: boolean,
smartypants: (cap: string) => string,
): Tokens.Text | T;
emStrong(this: TokenizerThis, src: string, maskedSrc: string, prevChar: string): Tokens.Em | Tokens.Strong | T;
codespan(this: TokenizerThis, src: string): Tokens.Codespan | T;
br(this: TokenizerThis, src: string): Tokens.Br | T;
del(this: TokenizerThis, src: string): Tokens.Del | T;
autolink(this: TokenizerThis, src: string, mangle: (cap: string) => string): Tokens.Link | T;
url(this: TokenizerThis, src: string, mangle: (cap: string) => string): Tokens.Link | T;
inlineText(this: TokenizerThis, src: string, smartypants: (cap: string) => string): Tokens.Text | T;
}
type TokenizerObject = Partial<Omit<Tokenizer<false>, "constructor" | "options">>;
type TokenizerObject = Partial<Omit<Tokenizer<false>, 'constructor' | 'options'>>;

@@ -167,31 +164,38 @@ class Renderer<T = never> {

options: MarkedOptions;
code(code: string, language: string | undefined, isEscaped: boolean): string | T;
blockquote(quote: string): string | T;
html(html: string): string | T;
heading(text: string, level: 1 | 2 | 3 | 4 | 5 | 6, raw: string, slugger: Slugger): string | T;
hr(): string | T;
list(body: string, ordered: boolean, start: number): string | T;
listitem(text: string): string | T;
checkbox(checked: boolean): string | T;
paragraph(text: string): string | T;
table(header: string, body: string): string | T;
tablerow(content: string): string | T;
code(this: RendererThis, code: string, language: string | undefined, isEscaped: boolean): string | T;
blockquote(this: RendererThis, quote: string): string | T;
html(this: RendererThis, html: string): string | T;
heading(
this: RendererThis,
text: string,
level: 1 | 2 | 3 | 4 | 5 | 6,
raw: string,
slugger: Slugger,
): string | T;
hr(this: RendererThis): string | T;
list(this: RendererThis, body: string, ordered: boolean, start: number): string | T;
listitem(this: RendererThis, text: string): string | T;
checkbox(this: RendererThis, checked: boolean): string | T;
paragraph(this: RendererThis, text: string): string | T;
table(this: RendererThis, header: string, body: string): string | T;
tablerow(this: RendererThis, content: string): string | T;
tablecell(
this: RendererThis,
content: string,
flags: {
header: boolean;
align: "center" | "left" | "right" | null;
align: 'center' | 'left' | 'right' | null;
},
): string | T;
strong(text: string): string | T;
em(text: string): string | T;
codespan(code: string): string | T;
br(): string | T;
del(text: string): string | T;
link(href: string | null, title: string | null, text: string): string | T;
image(href: string | null, title: string | null, text: string): string | T;
text(text: string): string | T;
strong(this: RendererThis, text: string): string | T;
em(this: RendererThis, text: string): string | T;
codespan(this: RendererThis, code: string): string | T;
br(this: RendererThis): string | T;
del(this: RendererThis, text: string): string | T;
link(this: RendererThis, href: string | null, title: string | null, text: string): string | T;
image(this: RendererThis, href: string | null, title: string | null, text: string): string | T;
text(this: RendererThis, text: string): string | T;
}
type RendererObject = Partial<Omit<Renderer<false>, "constructor" | "options">>;
type RendererObject = Partial<Omit<Renderer<false>, 'constructor' | 'options'>>;

@@ -212,3 +216,3 @@ class TextRenderer {

constructor(options?: MarkedOptions);
tokens: TokensList;
tokens: Token[] | TokensList;
token: Token | null;

@@ -219,6 +223,6 @@ options: MarkedOptions;

slugger: Slugger;
static parse(src: TokensList, options?: MarkedOptions): string;
static parseInline(src: TokensList, options?: MarkedOptions): string;
parse(src: TokensList): string;
parseInline(src: TokensList, renderer: Renderer): string;
static parse(src: Token[] | TokensList, options?: MarkedOptions): string;
static parseInline(src: Token[], options?: MarkedOptions): string;
parse(src: Token[] | TokensList): string;
parseInline(src: Token[], renderer: Renderer): string;
next(): Token;

@@ -234,7 +238,13 @@ }

static lex(src: string, options?: MarkedOptions): TokensList;
static lexInline(src: string, options?: MarkedOptions): TokensList;
static lexInline(src: string, options?: MarkedOptions): Token[];
lex(src: string): TokensList;
blockTokens(src: string, tokens: TokensList, top: boolean): TokensList;
inline(tokens: TokensList): TokensList;
inlineTokens(src: string, tokens: TokensList, inLink: boolean, inRawBlock: boolean): TokensList;
blockTokens(src: string, tokens: Token[]): Token[];
blockTokens(src: string, tokens: TokensList): TokensList;
inline(src: string, tokens: Token[]): void;
inlineTokens(src: string, tokens: Token[]): Token[];
state: {
inLink: boolean;
inRawBlock: boolean;
top: boolean;
};
}

@@ -268,4 +278,2 @@

| Tokens.Blockquote
| Tokens.BlockquoteStart
| Tokens.BlockquoteEnd
| Tokens.List

@@ -289,3 +297,3 @@ | Tokens.ListItem

interface Space {
type: "space";
type: 'space';
raw: string;

@@ -295,5 +303,5 @@ }

interface Code {
type: "code";
type: 'code';
raw: string;
codeBlockStyle?: "indented" | undefined;
codeBlockStyle?: 'indented' | undefined;
lang?: string | undefined;

@@ -304,18 +312,24 @@ text: string;

interface Heading {
type: "heading";
type: 'heading';
raw: string;
depth: number;
text: string;
tokens: Token[];
}
interface Table {
type: "table";
type: 'table';
raw: string;
header: string[];
align: Array<"center" | "left" | "right" | null>;
cells: string[][];
align: Array<'center' | 'left' | 'right' | null>;
header: TableCell[];
rows: TableCell[][];
}
interface TableCell {
text: string;
tokens: Token[];
}
interface Hr {
type: "hr";
type: 'hr';
raw: string;

@@ -325,19 +339,10 @@ }

interface Blockquote {
type: "blockquote";
type: 'blockquote';
raw: string;
text: string;
tokens: Token[];
}
interface BlockquoteStart {
type: "blockquote_start";
raw: string;
}
interface BlockquoteEnd {
type: "blockquote_end";
raw: string;
}
interface List {
type: "list";
type: 'list';
raw: string;

@@ -351,3 +356,3 @@ ordered: boolean;

interface ListItem {
type: "list_item";
type: 'list_item';
raw: string;

@@ -358,13 +363,15 @@ task: boolean;

text: string;
tokens: Token[];
}
interface Paragraph {
type: "paragraph";
type: 'paragraph';
raw: string;
pre?: boolean | undefined;
text: string;
tokens: Token[];
}
interface HTML {
type: "html";
type: 'html';
raw: string;

@@ -376,10 +383,12 @@ pre: boolean;

interface Text {
type: "text";
type: 'text';
raw: string;
text: string;
tokens?: Token[] | undefined;
}
interface Def {
type: "def";
type: 'def';
raw: string;
tag: string;
href: string;

@@ -390,3 +399,3 @@ title: string;

interface Escape {
type: "escape";
type: 'escape';
raw: string;

@@ -397,3 +406,3 @@ text: string;

interface Tag {
type: "text" | "html";
type: 'text' | 'html';
raw: string;

@@ -406,3 +415,3 @@ inLink: boolean;

interface Link {
type: "link";
type: 'link';
raw: string;

@@ -412,7 +421,7 @@ href: string;

text: string;
tokens?: Text[] | undefined;
tokens: Token[];
}
interface Image {
type: "image";
type: 'image';
raw: string;

@@ -425,15 +434,17 @@ href: string;

interface Strong {
type: "strong";
type: 'strong';
raw: string;
text: string;
tokens: Token[];
}
interface Em {
type: "em";
type: 'em';
raw: string;
text: string;
tokens: Token[];
}
interface Codespan {
type: "codespan";
type: 'codespan';
raw: string;

@@ -444,3 +455,3 @@ text: string;

interface Br {
type: "br";
type: 'br';
raw: string;

@@ -450,8 +461,37 @@ }

interface Del {
type: "del";
type: 'del';
raw: string;
text: string;
tokens: Token[];
}
interface Generic {
[index: string]: any;
type: string;
raw: string;
tokens?: Token[] | undefined;
}
}
interface TokenizerThis {
lexer: Lexer;
}
interface TokenizerExtension {
name: string;
level: 'block' | 'inline';
start?: ((this: TokenizerThis, src: string) => number) | undefined;
tokenizer: (this: TokenizerThis, src: string, tokens: Token[] | TokensList) => Tokens.Generic | void;
childTokens?: string[] | undefined;
}
interface RendererThis {
parser: Parser;
}
interface RendererExtension {
name: string;
renderer: (this: RendererThis, token: Tokens.Generic) => string | false;
}
interface MarkedExtension {

@@ -469,2 +509,9 @@ /**

/**
* Add tokenizers and renderers to marked
*/
extensions?:
| Array<TokenizerExtension | RendererExtension | (TokenizerExtension & RendererExtension)>
| undefined;
/**
* Enable GitHub flavored markdown.

@@ -561,3 +608,3 @@ */

interface MarkedOptions extends MarkedExtension {
interface MarkedOptions extends Omit<MarkedExtension, 'extensions'> {
/**

@@ -564,0 +611,0 @@ * Type: object Default: new Renderer()

{
"name": "@types/marked",
"version": "2.0.4",
"version": "3.0.0",
"description": "TypeScript definitions for Marked",

@@ -47,2 +47,7 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/marked",

"githubUsername": "sarunint"
},
{
"name": "Tony Brix",
"url": "https://github.com/UziTech",
"githubUsername": "UziTech"
}

@@ -59,4 +64,4 @@ ],

"dependencies": {},
"typesPublisherContentHash": "bd3693ce3dfbe1058fa17babeb65441218273111a18bcaf86b8b8c1c62835bb3",
"typeScriptVersion": "3.6"
"typesPublisherContentHash": "cff04b1b163860735c02b547c7c602547ac7e5b0cce00ff44052f9de5dde08bd",
"typeScriptVersion": "3.7"
}

@@ -11,3 +11,3 @@ # Installation

### Additional Details
* Last updated: Tue, 06 Jul 2021 22:03:01 GMT
* Last updated: Mon, 23 Aug 2021 19:42:08 GMT
* Dependencies: none

@@ -17,2 +17,2 @@ * Global values: `marked`

# Credits
These definitions were written by [William Orr](https://github.com/worr), [BendingBender](https://github.com/BendingBender), [CrossR](https://github.com/CrossR), [Mike Wickett](https://github.com/mwickett), [Hitomi Hatsukaze](https://github.com/htkzhtm), [Ezra Celli](https://github.com/ezracelli), [Romain LE BARO](https://github.com/scandinave), and [Sarun Intaralawan](https://github.com/sarunint).
These definitions were written by [William Orr](https://github.com/worr), [BendingBender](https://github.com/BendingBender), [CrossR](https://github.com/CrossR), [Mike Wickett](https://github.com/mwickett), [Hitomi Hatsukaze](https://github.com/htkzhtm), [Ezra Celli](https://github.com/ezracelli), [Romain LE BARO](https://github.com/scandinave), [Sarun Intaralawan](https://github.com/sarunint), and [Tony Brix](https://github.com/UziTech).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc