@types/markdown-it
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -5,2 +5,3 @@ // Type definitions for markdown-it | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 2.3 | ||
@@ -26,3 +27,15 @@ interface MarkdownItStatic { | ||
parseInline(src: string, env: any): Token[]; | ||
use(plugin: any, ...params: any[]): MarkdownIt; | ||
/* | ||
// The following only works in 3.0 | ||
// Since it's still not allowed to target 3.0, i'll leave the code commented out | ||
use<T extends Array<any> = any[]>( | ||
plugin: (md: MarkdownIt, ...params: T) => void, | ||
...params: T | ||
): MarkdownIt; | ||
*/ | ||
use(plugin: (md: MarkdownIt, ...params: any[]) => void, ...params: any[]): MarkdownIt; | ||
utils: { | ||
@@ -45,2 +58,3 @@ assign(obj: any): any; | ||
} | ||
disable(rules: string[] | string, ignoreInvalid?: boolean): MarkdownIt; | ||
@@ -80,2 +94,3 @@ enable(rules: string[] | string, ignoreInvalid?: boolean): MarkdownIt; | ||
interface Token { | ||
new (type: string, tag: string, nesting: number): Token; | ||
attrGet: (name: string) => string | null; | ||
@@ -103,20 +118,26 @@ attrIndex: (name: string) => number; | ||
interface Rule { | ||
(state: any, silent?: boolean): void; | ||
interface Rule<S extends State = State> { | ||
(state: S, silent?: boolean): boolean | void; | ||
} | ||
interface Ruler { | ||
after(afterName: string, ruleName: string, rule: Rule, options?: any): void; | ||
at(name: string, rule: Rule, options?: any): void; | ||
before(beforeName: string, ruleName: string, rule: Rule, options?: any): void; | ||
interface RuleInline extends Rule<StateInline> {} | ||
interface RuleBlock extends Rule<StateBlock> {} | ||
interface Ruler<S extends State = State> { | ||
after(afterName: string, ruleName: string, rule: Rule<S>, options?: any): void; | ||
at(name: string, rule: Rule<S>, options?: any): void; | ||
before(beforeName: string, ruleName: string, rule: Rule<S>, options?: any): void; | ||
disable(rules: string | string[], ignoreInvalid?: boolean): string[]; | ||
enable(rules: string | string[], ignoreInvalid?: boolean): string[]; | ||
enableOnly(rule: string, ignoreInvalid?: boolean): void; | ||
getRules(chain: string): Rule[]; | ||
push(ruleName: string, rule: Rule, options?: any): void; | ||
getRules(chain: string): Rule<S>[]; | ||
push(ruleName: string, rule: Rule<S>, options?: any): void; | ||
} | ||
interface RulerInline extends Ruler<StateInline> {} | ||
interface RulerBlock extends Ruler<StateBlock> {} | ||
interface ParserBlock { | ||
parse(src: string, md: MarkdownIt, env: any, outTokens: Token[]): void; | ||
ruler: Ruler; | ||
ruler: RulerBlock; | ||
} | ||
@@ -131,5 +152,93 @@ | ||
parse(src: string, md: MarkdownIt, env: any, outTokens: Token[]): void; | ||
ruler: Ruler; | ||
ruler2: Ruler; | ||
tokenize(state: State): void; | ||
skipToken(state: State): void; | ||
ruler: RulerInline; | ||
ruler2: RulerInline; | ||
} | ||
interface Delimiter { | ||
close: boolean; | ||
end: number; | ||
jump: number; | ||
length: number; | ||
level: number; | ||
marker: number; | ||
open: boolean; | ||
token: number; | ||
} | ||
interface State { | ||
env: any; | ||
level: number; | ||
/** Link to parser instance */ | ||
md: MarkdownIt; | ||
/** The markdown source code that is being parsed. */ | ||
src: string; | ||
tokens: Token[]; | ||
/** Return any for a yet untyped property */ | ||
[undocumented: string]: any; | ||
} | ||
interface StateInline extends State { | ||
/** | ||
* Stores `{ start: end }` pairs. Useful for backtrack | ||
* optimization of pairs parse (emphasis, strikes). | ||
*/ | ||
cache: { [start: number]: number }; | ||
/** Emphasis-like delimiters */ | ||
delimiters: Delimiter[]; | ||
pending: string; | ||
pendingLevel: number; | ||
/** Index of the first character of this token. */ | ||
pos: number; | ||
/** Index of the last character that can be used (for example the one before the end of this line). */ | ||
posMax: number; | ||
/** | ||
* Push new token to "stream". | ||
* If pending text exists, flush it as text token. | ||
*/ | ||
push(type: string, tag: string, nesting: number): Token; | ||
/** Flush pending text */ | ||
pushPending(): Token; | ||
/** | ||
* Scan a sequence of emphasis-like markers and determine whether | ||
* it can start an emphasis sequence or end an emphasis sequence. | ||
* @param start - position to scan from (it should point to a valid marker) | ||
* @param canSplitWord - determine if these markers can be found inside a word | ||
*/ | ||
scanDelims(start: number, canSplitWord: boolean): { | ||
can_open: boolean, | ||
can_close: boolean, | ||
length: number | ||
}; | ||
} | ||
interface StateBlock extends State { | ||
/** Used in lists to determine if they interrupt a paragraph */ | ||
parentType: 'blockquote' | 'list' | 'root' | 'paragraph' | 'reference'; | ||
eMarks: number[]; | ||
bMarks: number[]; | ||
bsCount: number[]; | ||
sCount: number[]; | ||
tShift: number[]; | ||
blkIndent: number; | ||
ddIndent: number; | ||
line: number; | ||
lineMax: number; | ||
tight: boolean; | ||
} | ||
} |
{ | ||
"name": "@types/markdown-it", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "TypeScript definitions for markdown-it", | ||
@@ -24,4 +24,4 @@ "license": "MIT", | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "e36875c65ddb2ee45958eecfdef15127bb48bbe0bd8f7b6970e39cc4e2426e99", | ||
"typeScriptVersion": "2.0" | ||
"typesPublisherContentHash": "fa150382517f62f1adb62273f33bd8128addce3ffdc315c62376d636ff7edfb3", | ||
"typeScriptVersion": "2.3" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
Additional Details | ||
* Last updated: Fri, 03 Aug 2018 01:26:21 GMT | ||
* Last updated: Wed, 10 Oct 2018 22:44:29 GMT | ||
* Dependencies: none | ||
@@ -14,0 +14,0 @@ * Global values: markdownit |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10443
204