mdast-util-to-markdown
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -6,4 +6,4 @@ /** | ||
*/ | ||
export function configure(base: State, extension: Options): State | ||
export type Options = import('./types.js').Options | ||
export type State = import('./types.js').State | ||
export function configure(base: State, extension: Options): State; | ||
export type Options = import('./types.js').Options; | ||
export type State = import('./types.js').State; |
@@ -15,12 +15,7 @@ /** | ||
*/ | ||
export function blockquote( | ||
node: Blockquote, | ||
_: Parents | undefined, | ||
state: State, | ||
info: Info | ||
): string | ||
export type Blockquote = import('mdast').Blockquote | ||
export type Parents = import('mdast').Parents | ||
export type Info = import('../types.js').Info | ||
export type Map = import('../types.js').Map | ||
export type State = import('../types.js').State | ||
export function blockquote(node: Blockquote, _: Parents | undefined, state: State, info: Info): string; | ||
export type Blockquote = import('mdast').Blockquote; | ||
export type Parents = import('mdast').Parents; | ||
export type Info = import('../types.js').Info; | ||
export type Map = import('../types.js').Map; | ||
export type State = import('../types.js').State; |
@@ -8,11 +8,6 @@ /** | ||
*/ | ||
export function hardBreak( | ||
_: Break, | ||
_1: Parents | undefined, | ||
state: State, | ||
info: Info | ||
): string | ||
export type Break = import('mdast').Break | ||
export type Parents = import('mdast').Parents | ||
export type Info = import('../types.js').Info | ||
export type State = import('../types.js').State | ||
export function hardBreak(_: Break, _1: Parents | undefined, state: State, info: Info): string; | ||
export type Break = import('mdast').Break; | ||
export type Parents = import('mdast').Parents; | ||
export type Info = import('../types.js').Info; | ||
export type State = import('../types.js').State; |
@@ -8,12 +8,7 @@ /** | ||
*/ | ||
export function code( | ||
node: Code, | ||
_: Parents | undefined, | ||
state: State, | ||
info: Info | ||
): string | ||
export type Code = import('mdast').Code | ||
export type Parents = import('mdast').Parents | ||
export type Info = import('../types.js').Info | ||
export type Map = import('../types.js').Map | ||
export type State = import('../types.js').State | ||
export function code(node: Code, _: Parents | undefined, state: State, info: Info): string; | ||
export type Code = import('mdast').Code; | ||
export type Parents = import('mdast').Parents; | ||
export type Info = import('../types.js').Info; | ||
export type Map = import('../types.js').Map; | ||
export type State = import('../types.js').State; |
@@ -8,11 +8,6 @@ /** | ||
*/ | ||
export function definition( | ||
node: Definition, | ||
_: Parents | undefined, | ||
state: State, | ||
info: Info | ||
): string | ||
export type Definition = import('mdast').Definition | ||
export type Parents = import('mdast').Parents | ||
export type Info = import('../types.js').Info | ||
export type State = import('../types.js').State | ||
export function definition(node: Definition, _: Parents | undefined, state: State, info: Info): string; | ||
export type Definition = import('mdast').Definition; | ||
export type Parents = import('mdast').Parents; | ||
export type Info = import('../types.js').Info; | ||
export type State = import('../types.js').State; |
@@ -8,15 +8,10 @@ /** | ||
*/ | ||
export function emphasis( | ||
node: Emphasis, | ||
_: Parents | undefined, | ||
state: State, | ||
info: Info | ||
): string | ||
export function emphasis(node: Emphasis, _: Parents | undefined, state: State, info: Info): string; | ||
export namespace emphasis { | ||
export {emphasisPeek as peek} | ||
export { emphasisPeek as peek }; | ||
} | ||
export type Emphasis = import('mdast').Emphasis | ||
export type Parents = import('mdast').Parents | ||
export type Info = import('../types.js').Info | ||
export type State = import('../types.js').State | ||
export type Emphasis = import('mdast').Emphasis; | ||
export type Parents = import('mdast').Parents; | ||
export type Info = import('../types.js').Info; | ||
export type State = import('../types.js').State; | ||
/** | ||
@@ -28,7 +23,3 @@ * @param {Emphasis} _ | ||
*/ | ||
declare function emphasisPeek( | ||
_: Emphasis, | ||
_1: Parents | undefined, | ||
state: State | ||
): string | ||
export {} | ||
declare function emphasisPeek(_: Emphasis, _1: Parents | undefined, state: State): string; | ||
export {}; |
@@ -8,11 +8,6 @@ /** | ||
*/ | ||
export function heading( | ||
node: Heading, | ||
_: Parents | undefined, | ||
state: State, | ||
info: Info | ||
): string | ||
export type Heading = import('mdast').Heading | ||
export type Parents = import('mdast').Parents | ||
export type Info = import('../types.js').Info | ||
export type State = import('../types.js').State | ||
export function heading(node: Heading, _: Parents | undefined, state: State, info: Info): string; | ||
export type Heading = import('mdast').Heading; | ||
export type Parents = import('mdast').Parents; | ||
export type Info = import('../types.js').Info; | ||
export type State = import('../types.js').State; |
@@ -5,11 +5,11 @@ /** | ||
*/ | ||
export function html(node: Html): string | ||
export function html(node: Html): string; | ||
export namespace html { | ||
export {htmlPeek as peek} | ||
export { htmlPeek as peek }; | ||
} | ||
export type Html = import('mdast').Html | ||
export type Html = import('mdast').Html; | ||
/** | ||
* @returns {string} | ||
*/ | ||
declare function htmlPeek(): string | ||
export {} | ||
declare function htmlPeek(): string; | ||
export {}; |
@@ -8,19 +8,14 @@ /** | ||
*/ | ||
export function imageReference( | ||
node: ImageReference, | ||
_: Parents | undefined, | ||
state: State, | ||
info: Info | ||
): string | ||
export function imageReference(node: ImageReference, _: Parents | undefined, state: State, info: Info): string; | ||
export namespace imageReference { | ||
export {imageReferencePeek as peek} | ||
export { imageReferencePeek as peek }; | ||
} | ||
export type ImageReference = import('mdast').ImageReference | ||
export type Parents = import('mdast').Parents | ||
export type Info = import('../types.js').Info | ||
export type State = import('../types.js').State | ||
export type ImageReference = import('mdast').ImageReference; | ||
export type Parents = import('mdast').Parents; | ||
export type Info = import('../types.js').Info; | ||
export type State = import('../types.js').State; | ||
/** | ||
* @returns {string} | ||
*/ | ||
declare function imageReferencePeek(): string | ||
export {} | ||
declare function imageReferencePeek(): string; | ||
export {}; |
@@ -8,19 +8,14 @@ /** | ||
*/ | ||
export function image( | ||
node: Image, | ||
_: Parents | undefined, | ||
state: State, | ||
info: Info | ||
): string | ||
export function image(node: Image, _: Parents | undefined, state: State, info: Info): string; | ||
export namespace image { | ||
export {imagePeek as peek} | ||
export { imagePeek as peek }; | ||
} | ||
export type Image = import('mdast').Image | ||
export type Parents = import('mdast').Parents | ||
export type Info = import('../types.js').Info | ||
export type State = import('../types.js').State | ||
export type Image = import('mdast').Image; | ||
export type Parents = import('mdast').Parents; | ||
export type Info = import('../types.js').Info; | ||
export type State = import('../types.js').State; | ||
/** | ||
* @returns {string} | ||
*/ | ||
declare function imagePeek(): string | ||
export {} | ||
declare function imagePeek(): string; | ||
export {}; |
export namespace handle { | ||
export {blockquote} | ||
export {hardBreak as break} | ||
export {code} | ||
export {definition} | ||
export {emphasis} | ||
export {hardBreak} | ||
export {heading} | ||
export {html} | ||
export {image} | ||
export {imageReference} | ||
export {inlineCode} | ||
export {link} | ||
export {linkReference} | ||
export {list} | ||
export {listItem} | ||
export {paragraph} | ||
export {root} | ||
export {strong} | ||
export {text} | ||
export {thematicBreak} | ||
export { blockquote }; | ||
export { hardBreak as break }; | ||
export { code }; | ||
export { definition }; | ||
export { emphasis }; | ||
export { hardBreak }; | ||
export { heading }; | ||
export { html }; | ||
export { image }; | ||
export { imageReference }; | ||
export { inlineCode }; | ||
export { link }; | ||
export { linkReference }; | ||
export { list }; | ||
export { listItem }; | ||
export { paragraph }; | ||
export { root }; | ||
export { strong }; | ||
export { text }; | ||
export { thematicBreak }; | ||
} | ||
import {blockquote} from './blockquote.js' | ||
import {hardBreak} from './break.js' | ||
import {code} from './code.js' | ||
import {definition} from './definition.js' | ||
import {emphasis} from './emphasis.js' | ||
import {heading} from './heading.js' | ||
import {html} from './html.js' | ||
import {image} from './image.js' | ||
import {imageReference} from './image-reference.js' | ||
import {inlineCode} from './inline-code.js' | ||
import {link} from './link.js' | ||
import {linkReference} from './link-reference.js' | ||
import {list} from './list.js' | ||
import {listItem} from './list-item.js' | ||
import {paragraph} from './paragraph.js' | ||
import {root} from './root.js' | ||
import {strong} from './strong.js' | ||
import {text} from './text.js' | ||
import {thematicBreak} from './thematic-break.js' | ||
import { blockquote } from './blockquote.js'; | ||
import { hardBreak } from './break.js'; | ||
import { code } from './code.js'; | ||
import { definition } from './definition.js'; | ||
import { emphasis } from './emphasis.js'; | ||
import { heading } from './heading.js'; | ||
import { html } from './html.js'; | ||
import { image } from './image.js'; | ||
import { imageReference } from './image-reference.js'; | ||
import { inlineCode } from './inline-code.js'; | ||
import { link } from './link.js'; | ||
import { linkReference } from './link-reference.js'; | ||
import { list } from './list.js'; | ||
import { listItem } from './list-item.js'; | ||
import { paragraph } from './paragraph.js'; | ||
import { root } from './root.js'; | ||
import { strong } from './strong.js'; | ||
import { text } from './text.js'; | ||
import { thematicBreak } from './thematic-break.js'; |
@@ -7,17 +7,13 @@ /** | ||
*/ | ||
export function inlineCode( | ||
node: InlineCode, | ||
_: Parents | undefined, | ||
state: State | ||
): string | ||
export function inlineCode(node: InlineCode, _: Parents | undefined, state: State): string; | ||
export namespace inlineCode { | ||
export {inlineCodePeek as peek} | ||
export { inlineCodePeek as peek }; | ||
} | ||
export type InlineCode = import('mdast').InlineCode | ||
export type Parents = import('mdast').Parents | ||
export type State = import('../types.js').State | ||
export type InlineCode = import('mdast').InlineCode; | ||
export type Parents = import('mdast').Parents; | ||
export type State = import('../types.js').State; | ||
/** | ||
* @returns {string} | ||
*/ | ||
declare function inlineCodePeek(): string | ||
export {} | ||
declare function inlineCodePeek(): string; | ||
export {}; |
@@ -7,4 +7,2 @@ /** | ||
import {patternCompile} from '../util/pattern-compile.js' | ||
inlineCode.peek = inlineCodePeek | ||
@@ -48,3 +46,3 @@ | ||
const pattern = state.unsafe[index] | ||
const expression = patternCompile(pattern) | ||
const expression = state.compilePattern(pattern) | ||
/** @type {RegExpExecArray | null} */ | ||
@@ -51,0 +49,0 @@ let match |
@@ -8,19 +8,14 @@ /** | ||
*/ | ||
export function linkReference( | ||
node: LinkReference, | ||
_: Parents | undefined, | ||
state: State, | ||
info: Info | ||
): string | ||
export function linkReference(node: LinkReference, _: Parents | undefined, state: State, info: Info): string; | ||
export namespace linkReference { | ||
export {linkReferencePeek as peek} | ||
export { linkReferencePeek as peek }; | ||
} | ||
export type LinkReference = import('mdast').LinkReference | ||
export type Parents = import('mdast').Parents | ||
export type Info = import('../types.js').Info | ||
export type State = import('../types.js').State | ||
export type LinkReference = import('mdast').LinkReference; | ||
export type Parents = import('mdast').Parents; | ||
export type Info = import('../types.js').Info; | ||
export type State = import('../types.js').State; | ||
/** | ||
* @returns {string} | ||
*/ | ||
declare function linkReferencePeek(): string | ||
export {} | ||
declare function linkReferencePeek(): string; | ||
export {}; |
@@ -8,16 +8,11 @@ /** | ||
*/ | ||
export function link( | ||
node: Link, | ||
_: Parents | undefined, | ||
state: State, | ||
info: Info | ||
): string | ||
export function link(node: Link, _: Parents | undefined, state: State, info: Info): string; | ||
export namespace link { | ||
export {linkPeek as peek} | ||
export { linkPeek as peek }; | ||
} | ||
export type Link = import('mdast').Link | ||
export type Parents = import('mdast').Parents | ||
export type Exit = import('../types.js').Exit | ||
export type Info = import('../types.js').Info | ||
export type State = import('../types.js').State | ||
export type Link = import('mdast').Link; | ||
export type Parents = import('mdast').Parents; | ||
export type Exit = import('../types.js').Exit; | ||
export type Info = import('../types.js').Info; | ||
export type State = import('../types.js').State; | ||
/** | ||
@@ -29,7 +24,3 @@ * @param {Link} node | ||
*/ | ||
declare function linkPeek( | ||
node: Link, | ||
_: Parents | undefined, | ||
state: State | ||
): string | ||
export {} | ||
declare function linkPeek(node: Link, _: Parents | undefined, state: State): string; | ||
export {}; |
@@ -8,12 +8,7 @@ /** | ||
*/ | ||
export function listItem( | ||
node: ListItem, | ||
parent: Parents | undefined, | ||
state: State, | ||
info: Info | ||
): string | ||
export type ListItem = import('mdast').ListItem | ||
export type Parents = import('mdast').Parents | ||
export type Info = import('../types.js').Info | ||
export type Map = import('../types.js').Map | ||
export type State = import('../types.js').State | ||
export function listItem(node: ListItem, parent: Parents | undefined, state: State, info: Info): string; | ||
export type ListItem = import('mdast').ListItem; | ||
export type Parents = import('mdast').Parents; | ||
export type Info = import('../types.js').Info; | ||
export type Map = import('../types.js').Map; | ||
export type State = import('../types.js').State; |
@@ -8,11 +8,6 @@ /** | ||
*/ | ||
export function list( | ||
node: List, | ||
parent: Parents | undefined, | ||
state: State, | ||
info: Info | ||
): string | ||
export type List = import('mdast').List | ||
export type Parents = import('mdast').Parents | ||
export type Info = import('../types.js').Info | ||
export type State = import('../types.js').State | ||
export function list(node: List, parent: Parents | undefined, state: State, info: Info): string; | ||
export type List = import('mdast').List; | ||
export type Parents = import('mdast').Parents; | ||
export type Info = import('../types.js').Info; | ||
export type State = import('../types.js').State; |
@@ -14,11 +14,6 @@ /** | ||
*/ | ||
export function paragraph( | ||
node: Paragraph, | ||
_: Parents | undefined, | ||
state: State, | ||
info: Info | ||
): string | ||
export type Paragraph = import('mdast').Paragraph | ||
export type Parents = import('mdast').Parents | ||
export type Info = import('../types.js').Info | ||
export type State = import('../types.js').State | ||
export function paragraph(node: Paragraph, _: Parents | undefined, state: State, info: Info): string; | ||
export type Paragraph = import('mdast').Paragraph; | ||
export type Parents = import('mdast').Parents; | ||
export type Info = import('../types.js').Info; | ||
export type State = import('../types.js').State; |
@@ -8,11 +8,6 @@ /** | ||
*/ | ||
export function root( | ||
node: Root, | ||
_: Parents | undefined, | ||
state: State, | ||
info: Info | ||
): string | ||
export type Parents = import('mdast').Parents | ||
export type Root = import('mdast').Root | ||
export type Info = import('../types.js').Info | ||
export type State = import('../types.js').State | ||
export function root(node: Root, _: Parents | undefined, state: State, info: Info): string; | ||
export type Parents = import('mdast').Parents; | ||
export type Root = import('mdast').Root; | ||
export type Info = import('../types.js').Info; | ||
export type State = import('../types.js').State; |
@@ -8,15 +8,10 @@ /** | ||
*/ | ||
export function strong( | ||
node: Strong, | ||
_: Parents | undefined, | ||
state: State, | ||
info: Info | ||
): string | ||
export function strong(node: Strong, _: Parents | undefined, state: State, info: Info): string; | ||
export namespace strong { | ||
export {strongPeek as peek} | ||
export { strongPeek as peek }; | ||
} | ||
export type Parents = import('mdast').Parents | ||
export type Strong = import('mdast').Strong | ||
export type Info = import('../types.js').Info | ||
export type State = import('../types.js').State | ||
export type Parents = import('mdast').Parents; | ||
export type Strong = import('mdast').Strong; | ||
export type Info = import('../types.js').Info; | ||
export type State = import('../types.js').State; | ||
/** | ||
@@ -28,7 +23,3 @@ * @param {Strong} _ | ||
*/ | ||
declare function strongPeek( | ||
_: Strong, | ||
_1: Parents | undefined, | ||
state: State | ||
): string | ||
export {} | ||
declare function strongPeek(_: Strong, _1: Parents | undefined, state: State): string; | ||
export {}; |
@@ -14,11 +14,6 @@ /** | ||
*/ | ||
export function text( | ||
node: Text, | ||
_: Parents | undefined, | ||
state: State, | ||
info: Info | ||
): string | ||
export type Parents = import('mdast').Parents | ||
export type Text = import('mdast').Text | ||
export type Info = import('../types.js').Info | ||
export type State = import('../types.js').State | ||
export function text(node: Text, _: Parents | undefined, state: State, info: Info): string; | ||
export type Parents = import('mdast').Parents; | ||
export type Text = import('mdast').Text; | ||
export type Info = import('../types.js').Info; | ||
export type State = import('../types.js').State; |
@@ -7,9 +7,5 @@ /** | ||
*/ | ||
export function thematicBreak( | ||
_: ThematicBreak, | ||
_1: Parents | undefined, | ||
state: State | ||
): string | ||
export type Parents = import('mdast').Parents | ||
export type ThematicBreak = import('mdast').ThematicBreak | ||
export type State = import('../types.js').State | ||
export function thematicBreak(_: ThematicBreak, _1: Parents | undefined, state: State): string; | ||
export type Parents = import('mdast').Parents; | ||
export type ThematicBreak = import('mdast').ThematicBreak; | ||
export type State = import('../types.js').State; |
@@ -11,15 +11,12 @@ /** | ||
*/ | ||
export function toMarkdown( | ||
tree: Nodes, | ||
options?: import('./types.js').Options | undefined | ||
): string | ||
export type Nodes = import('mdast').Nodes | ||
export type Enter = import('./types.js').Enter | ||
export type Info = import('./types.js').Info | ||
export type Join = import('./types.js').Join | ||
export type FlowParents = import('./types.js').FlowParents | ||
export type Options = import('./types.js').Options | ||
export type PhrasingParents = import('./types.js').PhrasingParents | ||
export type SafeConfig = import('./types.js').SafeConfig | ||
export type State = import('./types.js').State | ||
export type TrackFields = import('./types.js').TrackFields | ||
export function toMarkdown(tree: Nodes, options?: import("./types.js").Options | undefined): string; | ||
export type Nodes = import('mdast').Nodes; | ||
export type Enter = import('./types.js').Enter; | ||
export type Info = import('./types.js').Info; | ||
export type Join = import('./types.js').Join; | ||
export type FlowParents = import('./types.js').FlowParents; | ||
export type Options = import('./types.js').Options; | ||
export type PhrasingParents = import('./types.js').PhrasingParents; | ||
export type SafeConfig = import('./types.js').SafeConfig; | ||
export type State = import('./types.js').State; | ||
export type TrackFields = import('./types.js').TrackFields; |
@@ -20,2 +20,3 @@ /** | ||
import {association} from './util/association.js' | ||
import {compilePattern} from './util/compile-pattern.js' | ||
import {containerPhrasing} from './util/container-phrasing.js' | ||
@@ -46,2 +47,3 @@ import {containerFlow} from './util/container-flow.js' | ||
createTracker: track, | ||
compilePattern, | ||
safe: safeBound, | ||
@@ -48,0 +50,0 @@ stack: [], |
/** @type {Array<Join>} */ | ||
export const join: Array<Join> | ||
export type Join = import('./types.js').Join | ||
export const join: Array<Join>; | ||
export type Join = import('./types.js').Join; |
@@ -1,55 +0,12 @@ | ||
export type Point = import('unist').Point | ||
export type Association = import('mdast').Association | ||
export type Nodes = import('mdast').Nodes | ||
export type Parents = import('mdast').Parents | ||
export type PhrasingContent = import('mdast').PhrasingContent | ||
export type TableCell = import('mdast').TableCell | ||
export type TableRow = import('mdast').TableRow | ||
export type ConstructName = import('../index.js').ConstructName | ||
export type FlowParents = Exclude< | ||
Parents, | ||
PhrasingContent | TableCell | TableRow | ||
> | ||
export type FlowChildren = | ||
| import('mdast').Blockquote | ||
| import('mdast').Code | ||
| import('mdast').Heading | ||
| import('mdast').Html | ||
| import('mdast').List | ||
| import('mdast').Paragraph | ||
| import('mdast').Table | ||
| import('mdast').ThematicBreak | ||
| import('mdast').Definition | ||
| import('mdast').FootnoteDefinition | ||
| import('mdast').Yaml | ||
| import('mdast').ListItem | ||
| import('mdast').Break | ||
| import('mdast').Delete | ||
| import('mdast').Emphasis | ||
| import('mdast').FootnoteReference | ||
| import('mdast').Image | ||
| import('mdast').ImageReference | ||
| import('mdast').InlineCode | ||
| import('mdast').Link | ||
| import('mdast').LinkReference | ||
| import('mdast').Strong | ||
| import('mdast').Text | ||
| import('mdast').TableCell | ||
| import('mdast').TableRow | ||
export type PhrasingParents = | ||
| import('mdast').Blockquote | ||
| import('mdast').Heading | ||
| import('mdast').List | ||
| import('mdast').Paragraph | ||
| import('mdast').Table | ||
| import('mdast').FootnoteDefinition | ||
| import('mdast').ListItem | ||
| import('mdast').Delete | ||
| import('mdast').Emphasis | ||
| import('mdast').Link | ||
| import('mdast').LinkReference | ||
| import('mdast').Strong | ||
| import('mdast').TableCell | ||
| import('mdast').TableRow | ||
| import('mdast').Root | ||
export type Point = import('unist').Point; | ||
export type Association = import('mdast').Association; | ||
export type Nodes = import('mdast').Nodes; | ||
export type Parents = import('mdast').Parents; | ||
export type PhrasingContent = import('mdast').PhrasingContent; | ||
export type TableCell = import('mdast').TableCell; | ||
export type TableRow = import('mdast').TableRow; | ||
export type ConstructName = import('../index.js').ConstructName; | ||
export type FlowParents = Exclude<Parents, PhrasingContent | TableCell | TableRow>; | ||
export type FlowChildren = import("mdast").Blockquote | import("mdast").Code | import("mdast").Heading | import("mdast").Html | import("mdast").List | import("mdast").Paragraph | import("mdast").Table | import("mdast").ThematicBreak | import("mdast").Definition | import("mdast").FootnoteDefinition | import("mdast").Yaml | import("mdast").ListItem | import("mdast").Break | import("mdast").Delete | import("mdast").Emphasis | import("mdast").FootnoteReference | import("mdast").Image | import("mdast").ImageReference | import("mdast").InlineCode | import("mdast").Link | import("mdast").LinkReference | import("mdast").Strong | import("mdast").Text | import("mdast").TableCell | import("mdast").TableRow; | ||
export type PhrasingParents = import("mdast").Blockquote | import("mdast").Heading | import("mdast").List | import("mdast").Paragraph | import("mdast").Table | import("mdast").FootnoteDefinition | import("mdast").ListItem | import("mdast").Delete | import("mdast").Emphasis | import("mdast").Link | import("mdast").LinkReference | import("mdast").Strong | import("mdast").TableCell | import("mdast").TableRow | import("mdast").Root; | ||
/** | ||
@@ -59,11 +16,11 @@ * Info on where we are in the document we are generating. | ||
export type TrackFields = { | ||
/** | ||
* Current point. | ||
*/ | ||
now: Point | ||
/** | ||
* Number of columns each line will be shifted by wrapping nodes. | ||
*/ | ||
lineShift: number | ||
} | ||
/** | ||
* Current point. | ||
*/ | ||
now: Point; | ||
/** | ||
* Number of columns each line will be shifted by wrapping nodes. | ||
*/ | ||
lineShift: number; | ||
}; | ||
/** | ||
@@ -74,27 +31,27 @@ * Info on the characters that are around the current thing we are | ||
export type SafeFields = { | ||
/** | ||
* Characters before this (guaranteed to be one, can be more). | ||
*/ | ||
before: string | ||
/** | ||
* Characters after this (guaranteed to be one, can be more). | ||
*/ | ||
after: string | ||
} | ||
/** | ||
* Characters before this (guaranteed to be one, can be more). | ||
*/ | ||
before: string; | ||
/** | ||
* Characters after this (guaranteed to be one, can be more). | ||
*/ | ||
after: string; | ||
}; | ||
/** | ||
* Info on the surrounding of the node that is serialized. | ||
*/ | ||
export type Info = TrackFields & SafeFields | ||
export type Info = TrackFields & SafeFields; | ||
/** | ||
* Get current tracked info. | ||
*/ | ||
export type TrackCurrent = () => TrackFields | ||
export type TrackCurrent = () => TrackFields; | ||
/** | ||
* Define a relative increased line shift (the typical indent for lines). | ||
*/ | ||
export type TrackShift = (value: number) => undefined | ||
export type TrackShift = (value: number) => undefined; | ||
/** | ||
* Move past some generated markdown. | ||
*/ | ||
export type TrackMove = (value: string | null | undefined) => string | ||
export type TrackMove = (value: string | null | undefined) => string; | ||
/** | ||
@@ -107,15 +64,15 @@ * Track positional info in the output. | ||
export type Tracker = { | ||
/** | ||
* Get the current tracked info. | ||
*/ | ||
current: TrackCurrent | ||
/** | ||
* Define an increased line shift (the typical indent for lines). | ||
*/ | ||
shift: TrackShift | ||
/** | ||
* Move past some generated markdown. | ||
*/ | ||
move: TrackMove | ||
} | ||
/** | ||
* Get the current tracked info. | ||
*/ | ||
current: TrackCurrent; | ||
/** | ||
* Define an increased line shift (the typical indent for lines). | ||
*/ | ||
shift: TrackShift; | ||
/** | ||
* Move past some generated markdown. | ||
*/ | ||
move: TrackMove; | ||
}; | ||
/** | ||
@@ -127,4 +84,8 @@ * Track positional info in the output. | ||
*/ | ||
export type CreateTracker = (info: TrackFields) => Tracker | ||
export type CreateTracker = (info: TrackFields) => Tracker; | ||
/** | ||
* Compile an unsafe pattern to a regex. | ||
*/ | ||
export type CompilePattern = (info: Unsafe) => RegExp; | ||
/** | ||
* Get an identifier from an association to match it to others. | ||
@@ -147,11 +108,11 @@ * | ||
*/ | ||
export type AssociationId = (node: Association) => string | ||
export type AssociationId = (node: Association) => string; | ||
/** | ||
* Map function to pad a single line. | ||
*/ | ||
export type Map = (value: string, line: number, blank: boolean) => string | ||
export type Map = (value: string, line: number, blank: boolean) => string; | ||
/** | ||
* Pad serialized markdown. | ||
*/ | ||
export type IndentLines = (value: string, map: Map) => string | ||
export type IndentLines = (value: string, map: Map) => string; | ||
/** | ||
@@ -162,3 +123,3 @@ * Serialize the children of a parent that contains phrasing children. | ||
*/ | ||
export type ContainerPhrasing = (parent: PhrasingParents, info: Info) => string | ||
export type ContainerPhrasing = (parent: PhrasingParents, info: Info) => string; | ||
/** | ||
@@ -170,3 +131,3 @@ * Serialize the children of a parent that contains flow children. | ||
*/ | ||
export type ContainerFlow = (parent: FlowParents, info: TrackFields) => string | ||
export type ContainerFlow = (parent: FlowParents, info: TrackFields) => string; | ||
/** | ||
@@ -176,12 +137,12 @@ * Extra configuration for `safe` | ||
export type SafeEncodeFields = { | ||
/** | ||
* Extra characters that *must* be encoded (as character references) instead | ||
* of escaped (character escapes) (optional). | ||
* | ||
* Only ASCII punctuation will use character escapes, so you never need to | ||
* pass non-ASCII-punctuation here. | ||
*/ | ||
encode?: Array<string> | null | undefined | ||
} | ||
export type SafeConfig = SafeFields & SafeEncodeFields | ||
/** | ||
* Extra characters that *must* be encoded (as character references) instead | ||
* of escaped (character escapes) (optional). | ||
* | ||
* Only ASCII punctuation will use character escapes, so you never need to | ||
* pass non-ASCII-punctuation here. | ||
*/ | ||
encode?: Array<string> | null | undefined; | ||
}; | ||
export type SafeConfig = SafeFields & SafeEncodeFields; | ||
/** | ||
@@ -203,14 +164,11 @@ * Make a string safe for embedding in markdown constructs. | ||
*/ | ||
export type Safe = ( | ||
input: string | null | undefined, | ||
config: SafeConfig | ||
) => string | ||
export type Safe = (input: string | null | undefined, config: SafeConfig) => string; | ||
/** | ||
* Enter something. | ||
*/ | ||
export type Enter = (name: ConstructName) => Exit | ||
export type Enter = (name: ConstructName) => Exit; | ||
/** | ||
* Exit something. | ||
*/ | ||
export type Exit = () => undefined | ||
export type Exit = () => undefined; | ||
/** | ||
@@ -220,76 +178,75 @@ * Info passed around about the current state. | ||
export type State = { | ||
/** | ||
* Stack of constructs weβre in. | ||
*/ | ||
stack: Array<ConstructName> | ||
/** | ||
* Positions of child nodes in their parents. | ||
*/ | ||
indexStack: Array<number> | ||
/** | ||
* Pad serialized markdown. | ||
*/ | ||
indentLines: IndentLines | ||
/** | ||
* Get an identifier from an association to match it to others. | ||
*/ | ||
associationId: AssociationId | ||
/** | ||
* Serialize the children of a parent that contains phrasing children. | ||
*/ | ||
containerPhrasing: ContainerPhrasing | ||
/** | ||
* Serialize the children of a parent that contains flow children. | ||
*/ | ||
containerFlow: ContainerFlow | ||
/** | ||
* Track positional info in the output. | ||
*/ | ||
createTracker: CreateTracker | ||
/** | ||
* Serialize the children of a parent that contains flow children. | ||
*/ | ||
safe: Safe | ||
/** | ||
* Enter a construct (returns a corresponding exit function). | ||
*/ | ||
enter: Enter | ||
/** | ||
* Applied user configuration. | ||
*/ | ||
options: Options | ||
/** | ||
* Applied unsafe patterns. | ||
*/ | ||
unsafe: Array<Unsafe> | ||
/** | ||
* Applied join handlers. | ||
*/ | ||
join: Array<Join> | ||
/** | ||
* Call the configured handler for the given node. | ||
*/ | ||
handle: Handle | ||
/** | ||
* Applied handlers. | ||
*/ | ||
handlers: Handlers | ||
/** | ||
* List marker currently in use. | ||
*/ | ||
bulletCurrent: string | undefined | ||
/** | ||
* List marker previously in use. | ||
*/ | ||
bulletLastUsed: string | undefined | ||
} | ||
/** | ||
* Stack of constructs weβre in. | ||
*/ | ||
stack: Array<ConstructName>; | ||
/** | ||
* Positions of child nodes in their parents. | ||
*/ | ||
indexStack: Array<number>; | ||
/** | ||
* Pad serialized markdown. | ||
*/ | ||
indentLines: IndentLines; | ||
/** | ||
* Get an identifier from an association to match it to others. | ||
*/ | ||
associationId: AssociationId; | ||
/** | ||
* Compile an unsafe pattern to a regex. | ||
*/ | ||
compilePattern: CompilePattern; | ||
/** | ||
* Serialize the children of a parent that contains phrasing children. | ||
*/ | ||
containerPhrasing: ContainerPhrasing; | ||
/** | ||
* Serialize the children of a parent that contains flow children. | ||
*/ | ||
containerFlow: ContainerFlow; | ||
/** | ||
* Track positional info in the output. | ||
*/ | ||
createTracker: CreateTracker; | ||
/** | ||
* Serialize the children of a parent that contains flow children. | ||
*/ | ||
safe: Safe; | ||
/** | ||
* Enter a construct (returns a corresponding exit function). | ||
*/ | ||
enter: Enter; | ||
/** | ||
* Applied user configuration. | ||
*/ | ||
options: Options; | ||
/** | ||
* Applied unsafe patterns. | ||
*/ | ||
unsafe: Array<Unsafe>; | ||
/** | ||
* Applied join handlers. | ||
*/ | ||
join: Array<Join>; | ||
/** | ||
* Call the configured handler for the given node. | ||
*/ | ||
handle: Handle; | ||
/** | ||
* Applied handlers. | ||
*/ | ||
handlers: Handlers; | ||
/** | ||
* List marker currently in use. | ||
*/ | ||
bulletCurrent: string | undefined; | ||
/** | ||
* List marker previously in use. | ||
*/ | ||
bulletLastUsed: string | undefined; | ||
}; | ||
/** | ||
* Handle a particular node. | ||
*/ | ||
export type Handle = ( | ||
node: any, | ||
parent: Parents | undefined, | ||
state: State, | ||
Info: Info | ||
) => string | ||
export type Handle = (node: any, parent: Parents | undefined, state: State, Info: Info) => string; | ||
/** | ||
@@ -300,3 +257,3 @@ * Handle particular nodes. | ||
*/ | ||
export type Handlers = Record<Nodes['type'], Handle> | ||
export type Handlers = Record<Nodes['type'], Handle>; | ||
/** | ||
@@ -312,8 +269,3 @@ * How to join two blocks. | ||
*/ | ||
export type Join = ( | ||
left: FlowChildren, | ||
right: FlowChildren, | ||
parent: FlowParents, | ||
state: State | ||
) => boolean | number | null | undefined | void | ||
export type Join = (left: FlowChildren, right: FlowChildren, parent: FlowParents, state: State) => boolean | number | null | undefined | void; | ||
/** | ||
@@ -323,34 +275,34 @@ * Schema that defines when a character cannot occur. | ||
export type Unsafe = { | ||
/** | ||
* Single unsafe character. | ||
*/ | ||
character: string | ||
/** | ||
* Constructs where this is bad (optional). | ||
*/ | ||
inConstruct?: Array<ConstructName> | ConstructName | null | undefined | ||
/** | ||
* Constructs where this is fine again (optional). | ||
*/ | ||
notInConstruct?: Array<ConstructName> | ConstructName | null | undefined | ||
/** | ||
* `character` is bad when this is before it (cannot be used together with | ||
* `atBreak`) (optional). | ||
*/ | ||
before?: string | null | undefined | ||
/** | ||
* `character` is bad when this is after it (optional). | ||
*/ | ||
after?: string | null | undefined | ||
/** | ||
* `character` is bad at a break (cannot be used together with `before`) (optional). | ||
*/ | ||
atBreak?: boolean | null | undefined | ||
/** | ||
* The unsafe pattern (this whole object) compiled as a regex (do not use). | ||
* | ||
* This is internal and must not be defined. | ||
*/ | ||
_compiled?: RegExp | null | undefined | ||
} | ||
/** | ||
* Single unsafe character. | ||
*/ | ||
character: string; | ||
/** | ||
* Constructs where this is bad (optional). | ||
*/ | ||
inConstruct?: Array<ConstructName> | ConstructName | null | undefined; | ||
/** | ||
* Constructs where this is fine again (optional). | ||
*/ | ||
notInConstruct?: Array<ConstructName> | ConstructName | null | undefined; | ||
/** | ||
* `character` is bad when this is before it (cannot be used together with | ||
* `atBreak`) (optional). | ||
*/ | ||
before?: string | null | undefined; | ||
/** | ||
* `character` is bad when this is after it (optional). | ||
*/ | ||
after?: string | null | undefined; | ||
/** | ||
* `character` is bad at a break (cannot be used together with `before`) (optional). | ||
*/ | ||
atBreak?: boolean | null | undefined; | ||
/** | ||
* The unsafe pattern (this whole object) compiled as a regex (do not use). | ||
* | ||
* This is internal and must not be defined. | ||
*/ | ||
_compiled?: RegExp | null | undefined; | ||
}; | ||
/** | ||
@@ -360,143 +312,143 @@ * Configuration (optional). | ||
export type Options = { | ||
/** | ||
* Marker to use for bullets of items in unordered lists (default: `'*'`). | ||
* | ||
* There are three cases where the primary bullet cannot be used: | ||
* | ||
* * when three or more list items are on their own, the last one is empty, | ||
* and `bullet` is also a valid `rule`: `* - +`; this would turn into a | ||
* thematic break if serialized with three primary bullets; `bulletOther` | ||
* is used for the last item | ||
* * when a thematic break is the first child of a list item and `bullet` is | ||
* the same character as `rule`: `- ***`; this would turn into a single | ||
* thematic break if serialized with primary bullets; `bulletOther` is used | ||
* for the item | ||
* * when two unordered lists appear next to each other: `* a\n- b`; | ||
* `bulletOther` is used for such lists | ||
*/ | ||
bullet?: '*' | '+' | '-' | null | undefined | ||
/** | ||
* Marker to use in certain cases where the primary bullet doesnβt work | ||
* (default: `'-'` when `bullet` is `'*'`, `'*'` otherwise). | ||
* | ||
* Cannot be equal to `bullet`. | ||
*/ | ||
bulletOther?: '*' | '+' | '-' | null | undefined | ||
/** | ||
* Marker to use for bullets of items in ordered lists (default: `'.'`). | ||
* | ||
* There is one case where the primary bullet for ordered items cannot be | ||
* used: | ||
* | ||
* * when two ordered lists appear next to each other: `1. a\n2) b`; to | ||
* solve | ||
* that, `'.'` will be used when `bulletOrdered` is `')'`, and `'.'` | ||
* otherwise | ||
*/ | ||
bulletOrdered?: '.' | ')' | null | undefined | ||
/** | ||
* Whether to add the same number of number signs (`#`) at the end of an ATX | ||
* heading as the opening sequence (default: `false`). | ||
*/ | ||
closeAtx?: boolean | null | undefined | ||
/** | ||
* Marker to use for emphasis (default: `'*'`). | ||
*/ | ||
emphasis?: '*' | '_' | null | undefined | ||
/** | ||
* Marker to use for fenced code (default: ``'`'``). | ||
*/ | ||
fence?: '`' | '~' | null | undefined | ||
/** | ||
* Whether to use fenced code always (default: `true`). | ||
* | ||
* The default is to use fenced code if there is a language defined, if the | ||
* code is empty, or if it starts or ends in blank lines. | ||
*/ | ||
fences?: boolean | null | undefined | ||
/** | ||
* Whether to increment the counter of ordered lists items (default: `true`). | ||
*/ | ||
incrementListMarker?: boolean | null | undefined | ||
/** | ||
* How to indent the content of list items (default: `'one'`). | ||
* | ||
* Either with the size of the bullet plus one space (when `'one'`), a tab | ||
* stop (`'tab'`), or depending on the item and its parent list (`'mixed'`, | ||
* uses `'one'` if the item and list are tight and `'tab'` otherwise). | ||
*/ | ||
listItemIndent?: 'mixed' | 'one' | 'tab' | null | undefined | ||
/** | ||
* Marker to use for titles (default: `'"'`). | ||
*/ | ||
quote?: '"' | "'" | null | undefined | ||
/** | ||
* Whether to always use resource links (default: `false`). | ||
* | ||
* The default is to use autolinks (`<https://example.com>`) when possible | ||
* and resource links (`[text](url)`) otherwise. | ||
*/ | ||
resourceLink?: boolean | null | undefined | ||
/** | ||
* Marker to use for thematic breaks (default: `'*'`). | ||
*/ | ||
rule?: '*' | '-' | '_' | null | undefined | ||
/** | ||
* Number of markers to use for thematic breaks (default: `3`). | ||
*/ | ||
ruleRepetition?: number | null | undefined | ||
/** | ||
* Whether to add spaces between markers in thematic breaks (default: | ||
* `false`). | ||
*/ | ||
ruleSpaces?: boolean | null | undefined | ||
/** | ||
* Whether to use setext headings when possible (default: `false`). | ||
* | ||
* The default is to always use ATX headings (`# heading`) instead of setext | ||
* headings (`heading\n=======`). | ||
* Setext headings cannot be used for empty headings or headings with a rank | ||
* of three or more. | ||
*/ | ||
setext?: boolean | null | undefined | ||
/** | ||
* Marker to use for strong (default: `'*'`). | ||
*/ | ||
strong?: '*' | '_' | null | undefined | ||
/** | ||
* Whether to join definitions without a blank line (default: `false`). | ||
* | ||
* The default is to add blank lines between any flow (βblockβ) construct. | ||
* Turning this option on is a shortcut for a join function like so: | ||
* | ||
* ```js | ||
* function joinTightDefinitions(left, right) { | ||
* if (left.type === 'definition' && right.type === 'definition') { | ||
* return 0 | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
tightDefinitions?: boolean | null | undefined | ||
/** | ||
* Handle particular nodes (optional). | ||
* | ||
* Each key is a node type, each value its corresponding handler. | ||
*/ | ||
handlers?: Partial<Handlers> | null | undefined | ||
/** | ||
* How to join blocks (optional). | ||
*/ | ||
join?: Array<Join> | null | undefined | ||
/** | ||
* Schemas that define when characters cannot occur (optional). | ||
*/ | ||
unsafe?: Array<Unsafe> | null | undefined | ||
/** | ||
* List of extensions to include (optional). | ||
* | ||
* Each `ToMarkdownExtension` is an object with the same interface as | ||
* `Options` here. | ||
*/ | ||
extensions?: Array<Options> | null | undefined | ||
} | ||
/** | ||
* Marker to use for bullets of items in unordered lists (default: `'*'`). | ||
* | ||
* There are three cases where the primary bullet cannot be used: | ||
* | ||
* * when three or more list items are on their own, the last one is empty, | ||
* and `bullet` is also a valid `rule`: `* - +`; this would turn into a | ||
* thematic break if serialized with three primary bullets; `bulletOther` | ||
* is used for the last item | ||
* * when a thematic break is the first child of a list item and `bullet` is | ||
* the same character as `rule`: `- ***`; this would turn into a single | ||
* thematic break if serialized with primary bullets; `bulletOther` is used | ||
* for the item | ||
* * when two unordered lists appear next to each other: `* a\n- b`; | ||
* `bulletOther` is used for such lists | ||
*/ | ||
bullet?: '*' | '+' | '-' | null | undefined; | ||
/** | ||
* Marker to use in certain cases where the primary bullet doesnβt work | ||
* (default: `'-'` when `bullet` is `'*'`, `'*'` otherwise). | ||
* | ||
* Cannot be equal to `bullet`. | ||
*/ | ||
bulletOther?: '*' | '+' | '-' | null | undefined; | ||
/** | ||
* Marker to use for bullets of items in ordered lists (default: `'.'`). | ||
* | ||
* There is one case where the primary bullet for ordered items cannot be | ||
* used: | ||
* | ||
* * when two ordered lists appear next to each other: `1. a\n2) b`; to | ||
* solve | ||
* that, `'.'` will be used when `bulletOrdered` is `')'`, and `'.'` | ||
* otherwise | ||
*/ | ||
bulletOrdered?: '.' | ')' | null | undefined; | ||
/** | ||
* Whether to add the same number of number signs (`#`) at the end of an ATX | ||
* heading as the opening sequence (default: `false`). | ||
*/ | ||
closeAtx?: boolean | null | undefined; | ||
/** | ||
* Marker to use for emphasis (default: `'*'`). | ||
*/ | ||
emphasis?: '*' | '_' | null | undefined; | ||
/** | ||
* Marker to use for fenced code (default: ``'`'``). | ||
*/ | ||
fence?: '`' | '~' | null | undefined; | ||
/** | ||
* Whether to use fenced code always (default: `true`). | ||
* | ||
* The default is to use fenced code if there is a language defined, if the | ||
* code is empty, or if it starts or ends in blank lines. | ||
*/ | ||
fences?: boolean | null | undefined; | ||
/** | ||
* Whether to increment the counter of ordered lists items (default: `true`). | ||
*/ | ||
incrementListMarker?: boolean | null | undefined; | ||
/** | ||
* How to indent the content of list items (default: `'one'`). | ||
* | ||
* Either with the size of the bullet plus one space (when `'one'`), a tab | ||
* stop (`'tab'`), or depending on the item and its parent list (`'mixed'`, | ||
* uses `'one'` if the item and list are tight and `'tab'` otherwise). | ||
*/ | ||
listItemIndent?: 'mixed' | 'one' | 'tab' | null | undefined; | ||
/** | ||
* Marker to use for titles (default: `'"'`). | ||
*/ | ||
quote?: '"' | "'" | null | undefined; | ||
/** | ||
* Whether to always use resource links (default: `false`). | ||
* | ||
* The default is to use autolinks (`<https://example.com>`) when possible | ||
* and resource links (`[text](url)`) otherwise. | ||
*/ | ||
resourceLink?: boolean | null | undefined; | ||
/** | ||
* Marker to use for thematic breaks (default: `'*'`). | ||
*/ | ||
rule?: '*' | '-' | '_' | null | undefined; | ||
/** | ||
* Number of markers to use for thematic breaks (default: `3`). | ||
*/ | ||
ruleRepetition?: number | null | undefined; | ||
/** | ||
* Whether to add spaces between markers in thematic breaks (default: | ||
* `false`). | ||
*/ | ||
ruleSpaces?: boolean | null | undefined; | ||
/** | ||
* Whether to use setext headings when possible (default: `false`). | ||
* | ||
* The default is to always use ATX headings (`# heading`) instead of setext | ||
* headings (`heading\n=======`). | ||
* Setext headings cannot be used for empty headings or headings with a rank | ||
* of three or more. | ||
*/ | ||
setext?: boolean | null | undefined; | ||
/** | ||
* Marker to use for strong (default: `'*'`). | ||
*/ | ||
strong?: '*' | '_' | null | undefined; | ||
/** | ||
* Whether to join definitions without a blank line (default: `false`). | ||
* | ||
* The default is to add blank lines between any flow (βblockβ) construct. | ||
* Turning this option on is a shortcut for a join function like so: | ||
* | ||
* ```js | ||
* function joinTightDefinitions(left, right) { | ||
* if (left.type === 'definition' && right.type === 'definition') { | ||
* return 0 | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
tightDefinitions?: boolean | null | undefined; | ||
/** | ||
* Handle particular nodes (optional). | ||
* | ||
* Each key is a node type, each value its corresponding handler. | ||
*/ | ||
handlers?: Partial<Handlers> | null | undefined; | ||
/** | ||
* How to join blocks (optional). | ||
*/ | ||
join?: Array<Join> | null | undefined; | ||
/** | ||
* Schemas that define when characters cannot occur (optional). | ||
*/ | ||
unsafe?: Array<Unsafe> | null | undefined; | ||
/** | ||
* List of extensions to include (optional). | ||
* | ||
* Each `ToMarkdownExtension` is an object with the same interface as | ||
* `Options` here. | ||
*/ | ||
extensions?: Array<Options> | null | undefined; | ||
}; |
@@ -78,2 +78,9 @@ /** | ||
* | ||
* @callback CompilePattern | ||
* Compile an unsafe pattern to a regex. | ||
* @param {Unsafe} info | ||
* Pattern. | ||
* @returns {RegExp} | ||
* Regex. | ||
* | ||
* @callback AssociationId | ||
@@ -199,2 +206,4 @@ * Get an identifier from an association to match it to others. | ||
* Get an identifier from an association to match it to others. | ||
* @property {CompilePattern} compilePattern | ||
* Compile an unsafe pattern to a regex. | ||
* @property {ContainerPhrasing} containerPhrasing | ||
@@ -201,0 +210,0 @@ * Serialize the children of a parent that contains phrasing children. |
/** @type {Array<Unsafe>} */ | ||
export const unsafe: Array<Unsafe> | ||
export type ConstructName = import('./types.js').ConstructName | ||
export type Unsafe = import('./types.js').Unsafe | ||
export const unsafe: Array<Unsafe>; | ||
export type ConstructName = import('./types.js').ConstructName; | ||
export type Unsafe = import('./types.js').Unsafe; |
@@ -1,2 +0,2 @@ | ||
export function association(node: import('mdast').Association): string | ||
export type AssociationId = import('../types.js').AssociationId | ||
export function association(node: import("mdast").Association): string; | ||
export type AssociationId = import('../types.js').AssociationId; |
@@ -9,6 +9,4 @@ /** | ||
*/ | ||
export function checkBulletOrdered( | ||
state: State | ||
): Exclude<Options['bulletOrdered'], null | undefined> | ||
export type Options = import('../types.js').Options | ||
export type State = import('../types.js').State | ||
export function checkBulletOrdered(state: State): Exclude<Options['bulletOrdered'], null | undefined>; | ||
export type Options = import('../types.js').Options; | ||
export type State = import('../types.js').State; |
@@ -5,6 +5,4 @@ /** | ||
*/ | ||
export function checkBulletOther( | ||
state: State | ||
): Exclude<Options['bullet'], null | undefined> | ||
export type Options = import('../types.js').Options | ||
export type State = import('../types.js').State | ||
export function checkBulletOther(state: State): Exclude<Options['bullet'], null | undefined>; | ||
export type Options = import('../types.js').Options; | ||
export type State = import('../types.js').State; |
@@ -9,6 +9,4 @@ /** | ||
*/ | ||
export function checkBullet( | ||
state: State | ||
): Exclude<Options['bullet'], null | undefined> | ||
export type Options = import('../types.js').Options | ||
export type State = import('../types.js').State | ||
export function checkBullet(state: State): Exclude<Options['bullet'], null | undefined>; | ||
export type Options = import('../types.js').Options; | ||
export type State = import('../types.js').State; |
@@ -9,6 +9,4 @@ /** | ||
*/ | ||
export function checkEmphasis( | ||
state: State | ||
): Exclude<Options['emphasis'], null | undefined> | ||
export type Options = import('../types.js').Options | ||
export type State = import('../types.js').State | ||
export function checkEmphasis(state: State): Exclude<Options['emphasis'], null | undefined>; | ||
export type Options = import('../types.js').Options; | ||
export type State = import('../types.js').State; |
@@ -9,6 +9,4 @@ /** | ||
*/ | ||
export function checkFence( | ||
state: State | ||
): Exclude<Options['fence'], null | undefined> | ||
export type Options = import('../types.js').Options | ||
export type State = import('../types.js').State | ||
export function checkFence(state: State): Exclude<Options['fence'], null | undefined>; | ||
export type Options = import('../types.js').Options; | ||
export type State = import('../types.js').State; |
@@ -9,6 +9,4 @@ /** | ||
*/ | ||
export function checkListItemIndent( | ||
state: State | ||
): Exclude<Options['listItemIndent'], null | undefined> | ||
export type Options = import('../types.js').Options | ||
export type State = import('../types.js').State | ||
export function checkListItemIndent(state: State): Exclude<Options['listItemIndent'], null | undefined>; | ||
export type Options = import('../types.js').Options; | ||
export type State = import('../types.js').State; |
@@ -9,6 +9,4 @@ /** | ||
*/ | ||
export function checkQuote( | ||
state: State | ||
): Exclude<Options['quote'], null | undefined> | ||
export type Options = import('../types.js').Options | ||
export type State = import('../types.js').State | ||
export function checkQuote(state: State): Exclude<Options['quote'], null | undefined>; | ||
export type Options = import('../types.js').Options; | ||
export type State = import('../types.js').State; |
@@ -9,6 +9,4 @@ /** | ||
*/ | ||
export function checkRuleRepetition( | ||
state: State | ||
): Exclude<Options['ruleRepetition'], null | undefined> | ||
export type Options = import('../types.js').Options | ||
export type State = import('../types.js').State | ||
export function checkRuleRepetition(state: State): Exclude<Options['ruleRepetition'], null | undefined>; | ||
export type Options = import('../types.js').Options; | ||
export type State = import('../types.js').State; |
@@ -9,6 +9,4 @@ /** | ||
*/ | ||
export function checkRule( | ||
state: State | ||
): Exclude<Options['rule'], null | undefined> | ||
export type Options = import('../types.js').Options | ||
export type State = import('../types.js').State | ||
export function checkRule(state: State): Exclude<Options['rule'], null | undefined>; | ||
export type Options = import('../types.js').Options; | ||
export type State = import('../types.js').State; |
@@ -9,6 +9,4 @@ /** | ||
*/ | ||
export function checkStrong( | ||
state: State | ||
): Exclude<Options['strong'], null | undefined> | ||
export type Options = import('../types.js').Options | ||
export type State = import('../types.js').State | ||
export function checkStrong(state: State): Exclude<Options['strong'], null | undefined>; | ||
export type Options = import('../types.js').Options; | ||
export type State = import('../types.js').State; |
@@ -17,10 +17,6 @@ /** | ||
*/ | ||
export function containerFlow( | ||
parent: FlowParents, | ||
state: State, | ||
info: TrackFields | ||
): string | ||
export type FlowParents = import('../types.js').FlowParents | ||
export type FlowChildren = import('../types.js').FlowChildren | ||
export type State = import('../types.js').State | ||
export type TrackFields = import('../types.js').TrackFields | ||
export function containerFlow(parent: FlowParents, state: State, info: TrackFields): string; | ||
export type FlowParents = import('../types.js').FlowParents; | ||
export type FlowChildren = import('../types.js').FlowChildren; | ||
export type State = import('../types.js').State; | ||
export type TrackFields = import('../types.js').TrackFields; |
@@ -21,10 +21,6 @@ /** | ||
*/ | ||
export function containerPhrasing( | ||
parent: PhrasingParents, | ||
state: State, | ||
info: Info | ||
): string | ||
export type Handle = import('../types.js').Handle | ||
export type Info = import('../types.js').Info | ||
export type PhrasingParents = import('../types.js').PhrasingParents | ||
export type State = import('../types.js').State | ||
export function containerPhrasing(parent: PhrasingParents, state: State, info: Info): string; | ||
export type Handle = import('../types.js').Handle; | ||
export type Info = import('../types.js').Info; | ||
export type PhrasingParents = import('../types.js').PhrasingParents; | ||
export type State = import('../types.js').State; |
@@ -10,4 +10,4 @@ /** | ||
*/ | ||
export function formatCodeAsIndented(node: Code, state: State): boolean | ||
export type Code = import('mdast').Code | ||
export type State = import('../types.js').State | ||
export function formatCodeAsIndented(node: Code, state: State): boolean; | ||
export type Code = import('mdast').Code; | ||
export type State = import('../types.js').State; |
@@ -6,4 +6,4 @@ /** | ||
*/ | ||
export function formatHeadingAsSetext(node: Heading, state: State): boolean | ||
export type Heading = import('mdast').Heading | ||
export type State = import('../types.js').State | ||
export function formatHeadingAsSetext(node: Heading, state: State): boolean; | ||
export type Heading = import('mdast').Heading; | ||
export type State = import('../types.js').State; |
@@ -6,4 +6,4 @@ /** | ||
*/ | ||
export function formatLinkAsAutolink(node: Link, state: State): boolean | ||
export type Link = import('mdast').Link | ||
export type State = import('../types.js').State | ||
export function formatLinkAsAutolink(node: Link, state: State): boolean; | ||
export type Link = import('mdast').Link; | ||
export type State = import('../types.js').State; |
@@ -1,5 +0,2 @@ | ||
export function indentLines( | ||
value: string, | ||
map: import('../types.js').Map | ||
): string | ||
export type IndentLines = import('../types.js').IndentLines | ||
export function indentLines(value: string, map: import("../types.js").Map): string; | ||
export type IndentLines = import('../types.js').IndentLines; |
@@ -10,7 +10,4 @@ /** | ||
*/ | ||
export function patternInScope( | ||
stack: Array<ConstructName>, | ||
pattern: Unsafe | ||
): boolean | ||
export type ConstructName = import('../types.js').ConstructName | ||
export type Unsafe = import('../types.js').Unsafe | ||
export function patternInScope(stack: Array<ConstructName>, pattern: Unsafe): boolean; | ||
export type ConstructName = import('../types.js').ConstructName; | ||
export type Unsafe = import('../types.js').Unsafe; |
@@ -26,8 +26,4 @@ /** | ||
*/ | ||
export function safe( | ||
state: State, | ||
input: string | null | undefined, | ||
config: SafeConfig | ||
): string | ||
export type SafeConfig = import('../types.js').SafeConfig | ||
export type State = import('../types.js').State | ||
export function safe(state: State, input: string | null | undefined, config: SafeConfig): string; | ||
export type SafeConfig = import('../types.js').SafeConfig; | ||
export type State = import('../types.js').State; |
@@ -6,3 +6,2 @@ /** | ||
import {patternCompile} from './pattern-compile.js' | ||
import {patternInScope} from './pattern-in-scope.js' | ||
@@ -52,3 +51,3 @@ | ||
const expression = patternCompile(pattern) | ||
const expression = state.compilePattern(pattern) | ||
/** @type {RegExpExecArray | null} */ | ||
@@ -55,0 +54,0 @@ let match |
@@ -1,7 +0,5 @@ | ||
export function track( | ||
info: import('../types.js').TrackFields | ||
): import('../types.js').Tracker | ||
export type CreateTracker = import('../types.js').CreateTracker | ||
export type TrackCurrent = import('../types.js').TrackCurrent | ||
export type TrackMove = import('../types.js').TrackMove | ||
export type TrackShift = import('../types.js').TrackShift | ||
export function track(info: import("../types.js").TrackFields): import("../types.js").Tracker; | ||
export type CreateTracker = import('../types.js').CreateTracker; | ||
export type TrackCurrent = import('../types.js').TrackCurrent; | ||
export type TrackMove = import('../types.js').TrackMove; | ||
export type TrackShift = import('../types.js').TrackShift; |
{ | ||
"name": "mdast-util-to-markdown", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "mdast utility to serialize markdown", | ||
@@ -53,3 +53,3 @@ "license": "MIT", | ||
"mdast-util-from-markdown": "^2.0.0", | ||
"prettier": "^2.0.0", | ||
"prettier": "^3.0.0", | ||
"remark-cli": "^11.0.0", | ||
@@ -60,3 +60,3 @@ "remark-preset-wooorm": "^9.0.0", | ||
"unist-util-remove-position": "^5.0.0", | ||
"xo": "^0.54.0" | ||
"xo": "^0.55.0" | ||
}, | ||
@@ -66,3 +66,3 @@ "scripts": { | ||
"build": "tsc --build --clean && tsc --build && type-coverage", | ||
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", | ||
"format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", | ||
"test-api": "node --conditions development test/index.js", | ||
@@ -108,2 +108,3 @@ "test-coverage": "c8 --100 --reporter lcov npm run test-api", | ||
"complexity": "off", | ||
"unicorn/prefer-at": "off", | ||
"unicorn/prefer-code-point": "off" | ||
@@ -110,0 +111,0 @@ } |
@@ -481,2 +481,4 @@ # mdast-util-to-markdown | ||
β pad serialized markdown (see [`Map`][api-map]) | ||
* `compilePattern` (`(pattern: Unsafe) => RegExp`) | ||
β compile an unsafe pattern to a regex (see [`Unsafe`][api-unsafe]) | ||
* `containerFlow` (`(parent: Node, info: Info) => string`) | ||
@@ -483,0 +485,0 @@ β serialize flow children (see [`Info`][api-info]) |
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
147362
747
3985