micromark-core-commonmark
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -1,22 +0,23 @@ | ||
export {attention} from './lib/attention.js' | ||
export {autolink} from './lib/autolink.js' | ||
export {blankLine} from './lib/blank-line.js' | ||
export {blockQuote} from './lib/block-quote.js' | ||
export {characterEscape} from './lib/character-escape.js' | ||
export {characterReference} from './lib/character-reference.js' | ||
export {codeFenced} from './lib/code-fenced.js' | ||
export {codeIndented} from './lib/code-indented.js' | ||
export {codeText} from './lib/code-text.js' | ||
export {content} from './lib/content.js' | ||
export {definition} from './lib/definition.js' | ||
export {hardBreakEscape} from './lib/hard-break-escape.js' | ||
export {headingAtx} from './lib/heading-atx.js' | ||
export {htmlFlow} from './lib/html-flow.js' | ||
export {htmlText} from './lib/html-text.js' | ||
export {labelEnd} from './lib/label-end.js' | ||
export {labelStartImage} from './lib/label-start-image.js' | ||
export {labelStartLink} from './lib/label-start-link.js' | ||
export {lineEnding} from './lib/line-ending.js' | ||
export {list} from './lib/list.js' | ||
export {setextUnderline} from './lib/setext-underline.js' | ||
export {thematicBreak} from './lib/thematic-break.js' | ||
export { attention } from "./lib/attention.js"; | ||
export { autolink } from "./lib/autolink.js"; | ||
export { blankLine } from "./lib/blank-line.js"; | ||
export { blockQuote } from "./lib/block-quote.js"; | ||
export { characterEscape } from "./lib/character-escape.js"; | ||
export { characterReference } from "./lib/character-reference.js"; | ||
export { codeFenced } from "./lib/code-fenced.js"; | ||
export { codeIndented } from "./lib/code-indented.js"; | ||
export { codeText } from "./lib/code-text.js"; | ||
export { content } from "./lib/content.js"; | ||
export { definition } from "./lib/definition.js"; | ||
export { hardBreakEscape } from "./lib/hard-break-escape.js"; | ||
export { headingAtx } from "./lib/heading-atx.js"; | ||
export { htmlFlow } from "./lib/html-flow.js"; | ||
export { htmlText } from "./lib/html-text.js"; | ||
export { labelEnd } from "./lib/label-end.js"; | ||
export { labelStartImage } from "./lib/label-start-image.js"; | ||
export { labelStartLink } from "./lib/label-start-link.js"; | ||
export { lineEnding } from "./lib/line-ending.js"; | ||
export { list } from "./lib/list.js"; | ||
export { setextUnderline } from "./lib/setext-underline.js"; | ||
export { thematicBreak } from "./lib/thematic-break.js"; | ||
//# sourceMappingURL=index.d.ts.map |
/** @type {Construct} */ | ||
export const attention: Construct | ||
export type Code = import('micromark-util-types').Code | ||
export type Construct = import('micromark-util-types').Construct | ||
export type Event = import('micromark-util-types').Event | ||
export type Point = import('micromark-util-types').Point | ||
export type Resolver = import('micromark-util-types').Resolver | ||
export type State = import('micromark-util-types').State | ||
export type Token = import('micromark-util-types').Token | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const attention: Construct; | ||
export type Code = import('micromark-util-types').Code; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type Event = import('micromark-util-types').Event; | ||
export type Point = import('micromark-util-types').Point; | ||
export type Resolver = import('micromark-util-types').Resolver; | ||
export type State = import('micromark-util-types').State; | ||
export type Token = import('micromark-util-types').Token; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=attention.d.ts.map |
/** @type {Construct} */ | ||
export const autolink: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const autolink: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=autolink.d.ts.map |
@@ -69,2 +69,6 @@ /** | ||
if (code === codes.atSign) { | ||
return nok(code) | ||
} | ||
return emailAtext(code) | ||
@@ -71,0 +75,0 @@ } |
/** @type {Construct} */ | ||
export const blankLine: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const blankLine: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=blank-line.d.ts.map |
/** @type {Construct} */ | ||
export const blockQuote: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type Exiter = import('micromark-util-types').Exiter | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const blockQuote: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type Exiter = import('micromark-util-types').Exiter; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=block-quote.d.ts.map |
/** @type {Construct} */ | ||
export const characterEscape: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const characterEscape: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=character-escape.d.ts.map |
/** @type {Construct} */ | ||
export const characterReference: Construct | ||
export type Code = import('micromark-util-types').Code | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const characterReference: Construct; | ||
export type Code = import('micromark-util-types').Code; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=character-reference.d.ts.map |
/** @type {Construct} */ | ||
export const codeFenced: Construct | ||
export type Code = import('micromark-util-types').Code | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const codeFenced: Construct; | ||
export type Code = import('micromark-util-types').Code; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=code-fenced.d.ts.map |
/** @type {Construct} */ | ||
export const codeIndented: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const codeIndented: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=code-indented.d.ts.map |
@@ -195,5 +195,5 @@ /** | ||
: markdownLineEnding(code) | ||
? furtherStart(code) | ||
: nok(code) | ||
? furtherStart(code) | ||
: nok(code) | ||
} | ||
} |
/** @type {Construct} */ | ||
export const codeText: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type Previous = import('micromark-util-types').Previous | ||
export type Resolver = import('micromark-util-types').Resolver | ||
export type State = import('micromark-util-types').State | ||
export type Token = import('micromark-util-types').Token | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const codeText: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type Previous = import('micromark-util-types').Previous; | ||
export type Resolver = import('micromark-util-types').Resolver; | ||
export type State = import('micromark-util-types').State; | ||
export type Token = import('micromark-util-types').Token; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=code-text.d.ts.map |
@@ -5,8 +5,9 @@ /** | ||
*/ | ||
export const content: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type Resolver = import('micromark-util-types').Resolver | ||
export type State = import('micromark-util-types').State | ||
export type Token = import('micromark-util-types').Token | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const content: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type Resolver = import('micromark-util-types').Resolver; | ||
export type State = import('micromark-util-types').State; | ||
export type Token = import('micromark-util-types').Token; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=content.d.ts.map |
/** @type {Construct} */ | ||
export const definition: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const definition: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=definition.d.ts.map |
/** @type {Construct} */ | ||
export const hardBreakEscape: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const hardBreakEscape: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=hard-break-escape.d.ts.map |
/** @type {Construct} */ | ||
export const headingAtx: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type Resolver = import('micromark-util-types').Resolver | ||
export type State = import('micromark-util-types').State | ||
export type Token = import('micromark-util-types').Token | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const headingAtx: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type Resolver = import('micromark-util-types').Resolver; | ||
export type State = import('micromark-util-types').State; | ||
export type Token = import('micromark-util-types').Token; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=heading-atx.d.ts.map |
/** @type {Construct} */ | ||
export const htmlFlow: Construct | ||
export type Code = import('micromark-util-types').Code | ||
export type Construct = import('micromark-util-types').Construct | ||
export type Resolver = import('micromark-util-types').Resolver | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const htmlFlow: Construct; | ||
export type Code = import('micromark-util-types').Code; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type Resolver = import('micromark-util-types').Resolver; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=html-flow.d.ts.map |
@@ -319,4 +319,4 @@ /** | ||
: closingTag | ||
? completeClosingTagAfter(code) | ||
: completeAttributeNameBefore(code) | ||
? completeClosingTagAfter(code) | ||
: completeAttributeNameBefore(code) | ||
} | ||
@@ -323,0 +323,0 @@ |
/** @type {Construct} */ | ||
export const htmlText: Construct | ||
export type Code = import('micromark-util-types').Code | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const htmlText: Construct; | ||
export type Code = import('micromark-util-types').Code; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=html-text.d.ts.map |
@@ -210,4 +210,4 @@ /** | ||
: code === codes.dash | ||
? commentClose(code) | ||
: comment(code) | ||
? commentClose(code) | ||
: comment(code) | ||
} | ||
@@ -214,0 +214,0 @@ |
/** @type {Construct} */ | ||
export const labelEnd: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type Event = import('micromark-util-types').Event | ||
export type Resolver = import('micromark-util-types').Resolver | ||
export type State = import('micromark-util-types').State | ||
export type Token = import('micromark-util-types').Token | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const labelEnd: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type Event = import('micromark-util-types').Event; | ||
export type Resolver = import('micromark-util-types').Resolver; | ||
export type State = import('micromark-util-types').State; | ||
export type Token = import('micromark-util-types').Token; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=label-end.d.ts.map |
/** @type {Construct} */ | ||
export const labelStartImage: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const labelStartImage: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=label-start-image.d.ts.map |
/** @type {Construct} */ | ||
export const labelStartLink: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const labelStartLink: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=label-start-link.d.ts.map |
/** @type {Construct} */ | ||
export const lineEnding: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const lineEnding: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=line-ending.d.ts.map |
/** @type {Construct} */ | ||
export const list: Construct | ||
export type Code = import('micromark-util-types').Code | ||
export type Construct = import('micromark-util-types').Construct | ||
export type ContainerState = import('micromark-util-types').ContainerState | ||
export type Exiter = import('micromark-util-types').Exiter | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const list: Construct; | ||
export type Code = import('micromark-util-types').Code; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type ContainerState = import('micromark-util-types').ContainerState; | ||
export type Exiter = import('micromark-util-types').Exiter; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=list.d.ts.map |
/** @type {Construct} */ | ||
export const setextUnderline: Construct | ||
export type Code = import('micromark-util-types').Code | ||
export type Construct = import('micromark-util-types').Construct | ||
export type Resolver = import('micromark-util-types').Resolver | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const setextUnderline: Construct; | ||
export type Code = import('micromark-util-types').Code; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type Resolver = import('micromark-util-types').Resolver; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=setext-underline.d.ts.map |
/** @type {Construct} */ | ||
export const thematicBreak: Construct | ||
export type Code = import('micromark-util-types').Code | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const thematicBreak: Construct; | ||
export type Code = import('micromark-util-types').Code; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=thematic-break.d.ts.map |
@@ -1,22 +0,23 @@ | ||
export {attention} from './lib/attention.js' | ||
export {autolink} from './lib/autolink.js' | ||
export {blankLine} from './lib/blank-line.js' | ||
export {blockQuote} from './lib/block-quote.js' | ||
export {characterEscape} from './lib/character-escape.js' | ||
export {characterReference} from './lib/character-reference.js' | ||
export {codeFenced} from './lib/code-fenced.js' | ||
export {codeIndented} from './lib/code-indented.js' | ||
export {codeText} from './lib/code-text.js' | ||
export {content} from './lib/content.js' | ||
export {definition} from './lib/definition.js' | ||
export {hardBreakEscape} from './lib/hard-break-escape.js' | ||
export {headingAtx} from './lib/heading-atx.js' | ||
export {htmlFlow} from './lib/html-flow.js' | ||
export {htmlText} from './lib/html-text.js' | ||
export {labelEnd} from './lib/label-end.js' | ||
export {labelStartImage} from './lib/label-start-image.js' | ||
export {labelStartLink} from './lib/label-start-link.js' | ||
export {lineEnding} from './lib/line-ending.js' | ||
export {list} from './lib/list.js' | ||
export {setextUnderline} from './lib/setext-underline.js' | ||
export {thematicBreak} from './lib/thematic-break.js' | ||
export { attention } from "./lib/attention.js"; | ||
export { autolink } from "./lib/autolink.js"; | ||
export { blankLine } from "./lib/blank-line.js"; | ||
export { blockQuote } from "./lib/block-quote.js"; | ||
export { characterEscape } from "./lib/character-escape.js"; | ||
export { characterReference } from "./lib/character-reference.js"; | ||
export { codeFenced } from "./lib/code-fenced.js"; | ||
export { codeIndented } from "./lib/code-indented.js"; | ||
export { codeText } from "./lib/code-text.js"; | ||
export { content } from "./lib/content.js"; | ||
export { definition } from "./lib/definition.js"; | ||
export { hardBreakEscape } from "./lib/hard-break-escape.js"; | ||
export { headingAtx } from "./lib/heading-atx.js"; | ||
export { htmlFlow } from "./lib/html-flow.js"; | ||
export { htmlText } from "./lib/html-text.js"; | ||
export { labelEnd } from "./lib/label-end.js"; | ||
export { labelStartImage } from "./lib/label-start-image.js"; | ||
export { labelStartLink } from "./lib/label-start-link.js"; | ||
export { lineEnding } from "./lib/line-ending.js"; | ||
export { list } from "./lib/list.js"; | ||
export { setextUnderline } from "./lib/setext-underline.js"; | ||
export { thematicBreak } from "./lib/thematic-break.js"; | ||
//# sourceMappingURL=index.d.ts.map |
44
index.js
@@ -1,22 +0,22 @@ | ||
export {attention} from './lib/attention.js' | ||
export {autolink} from './lib/autolink.js' | ||
export {blankLine} from './lib/blank-line.js' | ||
export {blockQuote} from './lib/block-quote.js' | ||
export {characterEscape} from './lib/character-escape.js' | ||
export {characterReference} from './lib/character-reference.js' | ||
export {codeFenced} from './lib/code-fenced.js' | ||
export {codeIndented} from './lib/code-indented.js' | ||
export {codeText} from './lib/code-text.js' | ||
export {content} from './lib/content.js' | ||
export {definition} from './lib/definition.js' | ||
export {hardBreakEscape} from './lib/hard-break-escape.js' | ||
export {headingAtx} from './lib/heading-atx.js' | ||
export {htmlFlow} from './lib/html-flow.js' | ||
export {htmlText} from './lib/html-text.js' | ||
export {labelEnd} from './lib/label-end.js' | ||
export {labelStartImage} from './lib/label-start-image.js' | ||
export {labelStartLink} from './lib/label-start-link.js' | ||
export {lineEnding} from './lib/line-ending.js' | ||
export {list} from './lib/list.js' | ||
export {setextUnderline} from './lib/setext-underline.js' | ||
export {thematicBreak} from './lib/thematic-break.js' | ||
export { attention } from './lib/attention.js'; | ||
export { autolink } from './lib/autolink.js'; | ||
export { blankLine } from './lib/blank-line.js'; | ||
export { blockQuote } from './lib/block-quote.js'; | ||
export { characterEscape } from './lib/character-escape.js'; | ||
export { characterReference } from './lib/character-reference.js'; | ||
export { codeFenced } from './lib/code-fenced.js'; | ||
export { codeIndented } from './lib/code-indented.js'; | ||
export { codeText } from './lib/code-text.js'; | ||
export { content } from './lib/content.js'; | ||
export { definition } from './lib/definition.js'; | ||
export { hardBreakEscape } from './lib/hard-break-escape.js'; | ||
export { headingAtx } from './lib/heading-atx.js'; | ||
export { htmlFlow } from './lib/html-flow.js'; | ||
export { htmlText } from './lib/html-text.js'; | ||
export { labelEnd } from './lib/label-end.js'; | ||
export { labelStartImage } from './lib/label-start-image.js'; | ||
export { labelStartLink } from './lib/label-start-link.js'; | ||
export { lineEnding } from './lib/line-ending.js'; | ||
export { list } from './lib/list.js'; | ||
export { setextUnderline } from './lib/setext-underline.js'; | ||
export { thematicBreak } from './lib/thematic-break.js'; |
/** @type {Construct} */ | ||
export const attention: Construct | ||
export type Code = import('micromark-util-types').Code | ||
export type Construct = import('micromark-util-types').Construct | ||
export type Event = import('micromark-util-types').Event | ||
export type Point = import('micromark-util-types').Point | ||
export type Resolver = import('micromark-util-types').Resolver | ||
export type State = import('micromark-util-types').State | ||
export type Token = import('micromark-util-types').Token | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const attention: Construct; | ||
export type Code = import('micromark-util-types').Code; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type Event = import('micromark-util-types').Event; | ||
export type Point = import('micromark-util-types').Point; | ||
export type Resolver = import('micromark-util-types').Resolver; | ||
export type State = import('micromark-util-types').State; | ||
export type Token = import('micromark-util-types').Token; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=attention.d.ts.map |
@@ -13,5 +13,5 @@ /** | ||
import {push, splice} from 'micromark-util-chunked' | ||
import {classifyCharacter} from 'micromark-util-classify-character' | ||
import {resolveAll} from 'micromark-util-resolve-all' | ||
import { push, splice } from 'micromark-util-chunked'; | ||
import { classifyCharacter } from 'micromark-util-classify-character'; | ||
import { resolveAll } from 'micromark-util-resolve-all'; | ||
/** @type {Construct} */ | ||
@@ -22,3 +22,3 @@ export const attention = { | ||
resolveAll: resolveAllAttention | ||
} | ||
}; | ||
@@ -32,19 +32,19 @@ /** | ||
function resolveAllAttention(events, context) { | ||
let index = -1 | ||
let index = -1; | ||
/** @type {number} */ | ||
let open | ||
let open; | ||
/** @type {Token} */ | ||
let group | ||
let group; | ||
/** @type {Token} */ | ||
let text | ||
let text; | ||
/** @type {Token} */ | ||
let openingSequence | ||
let openingSequence; | ||
/** @type {Token} */ | ||
let closingSequence | ||
let closingSequence; | ||
/** @type {number} */ | ||
let use | ||
let use; | ||
/** @type {Array<Event>} */ | ||
let nextEvents | ||
let nextEvents; | ||
/** @type {number} */ | ||
let offset | ||
let offset; | ||
@@ -57,8 +57,4 @@ // Walk through all events. | ||
// Find a token that can close. | ||
if ( | ||
events[index][0] === 'enter' && | ||
events[index][1].type === 'attentionSequence' && | ||
events[index][1]._close | ||
) { | ||
open = index | ||
if (events[index][0] === 'enter' && events[index][1].type === 'attentionSequence' && events[index][1]._close) { | ||
open = index; | ||
@@ -68,10 +64,5 @@ // Now walk back to find an opener. | ||
// Find a token that can open the closer. | ||
if ( | ||
events[open][0] === 'exit' && | ||
events[open][1].type === 'attentionSequence' && | ||
events[open][1]._open && | ||
// If the markers are the same: | ||
context.sliceSerialize(events[open][1]).charCodeAt(0) === | ||
context.sliceSerialize(events[index][1]).charCodeAt(0) | ||
) { | ||
if (events[open][0] === 'exit' && events[open][1].type === 'attentionSequence' && events[open][1]._open && | ||
// If the markers are the same: | ||
context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index][1]).charCodeAt(0)) { | ||
// If the opening can close or the closing can open, | ||
@@ -81,65 +72,43 @@ // and the close size *is not* a multiple of three, | ||
// then don’t match. | ||
if ( | ||
(events[open][1]._close || events[index][1]._open) && | ||
(events[index][1].end.offset - events[index][1].start.offset) % 3 && | ||
!( | ||
(events[open][1].end.offset - | ||
events[open][1].start.offset + | ||
events[index][1].end.offset - | ||
events[index][1].start.offset) % | ||
3 | ||
) | ||
) { | ||
continue | ||
if ((events[open][1]._close || events[index][1]._open) && (events[index][1].end.offset - events[index][1].start.offset) % 3 && !((events[open][1].end.offset - events[open][1].start.offset + events[index][1].end.offset - events[index][1].start.offset) % 3)) { | ||
continue; | ||
} | ||
// Number of markers to use from the sequence. | ||
use = | ||
events[open][1].end.offset - events[open][1].start.offset > 1 && | ||
events[index][1].end.offset - events[index][1].start.offset > 1 | ||
? 2 | ||
: 1 | ||
const start = Object.assign({}, events[open][1].end) | ||
const end = Object.assign({}, events[index][1].start) | ||
movePoint(start, -use) | ||
movePoint(end, use) | ||
use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1; | ||
const start = Object.assign({}, events[open][1].end); | ||
const end = Object.assign({}, events[index][1].start); | ||
movePoint(start, -use); | ||
movePoint(end, use); | ||
openingSequence = { | ||
type: use > 1 ? 'strongSequence' : 'emphasisSequence', | ||
type: use > 1 ? "strongSequence" : "emphasisSequence", | ||
start, | ||
end: Object.assign({}, events[open][1].end) | ||
} | ||
}; | ||
closingSequence = { | ||
type: use > 1 ? 'strongSequence' : 'emphasisSequence', | ||
type: use > 1 ? "strongSequence" : "emphasisSequence", | ||
start: Object.assign({}, events[index][1].start), | ||
end | ||
} | ||
}; | ||
text = { | ||
type: use > 1 ? 'strongText' : 'emphasisText', | ||
type: use > 1 ? "strongText" : "emphasisText", | ||
start: Object.assign({}, events[open][1].end), | ||
end: Object.assign({}, events[index][1].start) | ||
} | ||
}; | ||
group = { | ||
type: use > 1 ? 'strong' : 'emphasis', | ||
type: use > 1 ? "strong" : "emphasis", | ||
start: Object.assign({}, openingSequence.start), | ||
end: Object.assign({}, closingSequence.end) | ||
} | ||
events[open][1].end = Object.assign({}, openingSequence.start) | ||
events[index][1].start = Object.assign({}, closingSequence.end) | ||
nextEvents = [] | ||
}; | ||
events[open][1].end = Object.assign({}, openingSequence.start); | ||
events[index][1].start = Object.assign({}, closingSequence.end); | ||
nextEvents = []; | ||
// If there are more markers in the opening, add them before. | ||
if (events[open][1].end.offset - events[open][1].start.offset) { | ||
nextEvents = push(nextEvents, [ | ||
['enter', events[open][1], context], | ||
['exit', events[open][1], context] | ||
]) | ||
nextEvents = push(nextEvents, [['enter', events[open][1], context], ['exit', events[open][1], context]]); | ||
} | ||
// Opening. | ||
nextEvents = push(nextEvents, [ | ||
['enter', group, context], | ||
['enter', openingSequence, context], | ||
['exit', openingSequence, context], | ||
['enter', text, context] | ||
]) | ||
nextEvents = push(nextEvents, [['enter', group, context], ['enter', openingSequence, context], ['exit', openingSequence, context], ['enter', text, context]]); | ||
@@ -149,32 +118,17 @@ // Always populated by defaults. | ||
// Between. | ||
nextEvents = push( | ||
nextEvents, | ||
resolveAll( | ||
context.parser.constructs.insideSpan.null, | ||
events.slice(open + 1, index), | ||
context | ||
) | ||
) | ||
nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + 1, index), context)); | ||
// Closing. | ||
nextEvents = push(nextEvents, [ | ||
['exit', text, context], | ||
['enter', closingSequence, context], | ||
['exit', closingSequence, context], | ||
['exit', group, context] | ||
]) | ||
nextEvents = push(nextEvents, [['exit', text, context], ['enter', closingSequence, context], ['exit', closingSequence, context], ['exit', group, context]]); | ||
// If there are more markers in the closing, add them after. | ||
if (events[index][1].end.offset - events[index][1].start.offset) { | ||
offset = 2 | ||
nextEvents = push(nextEvents, [ | ||
['enter', events[index][1], context], | ||
['exit', events[index][1], context] | ||
]) | ||
offset = 2; | ||
nextEvents = push(nextEvents, [['enter', events[index][1], context], ['exit', events[index][1], context]]); | ||
} else { | ||
offset = 0 | ||
offset = 0; | ||
} | ||
splice(events, open - 1, index - open + 3, nextEvents) | ||
index = open + nextEvents.length - offset - 2 | ||
break | ||
splice(events, open - 1, index - open + 3, nextEvents); | ||
index = open + nextEvents.length - offset - 2; | ||
break; | ||
} | ||
@@ -186,9 +140,9 @@ } | ||
// Remove remaining sequences. | ||
index = -1 | ||
index = -1; | ||
while (++index < events.length) { | ||
if (events[index][1].type === 'attentionSequence') { | ||
events[index][1].type = 'data' | ||
events[index][1].type = 'data'; | ||
} | ||
} | ||
return events | ||
return events; | ||
} | ||
@@ -201,9 +155,9 @@ | ||
function tokenizeAttention(effects, ok) { | ||
const attentionMarkers = this.parser.constructs.attentionMarkers.null | ||
const previous = this.previous | ||
const before = classifyCharacter(previous) | ||
const attentionMarkers = this.parser.constructs.attentionMarkers.null; | ||
const previous = this.previous; | ||
const before = classifyCharacter(previous); | ||
/** @type {NonNullable<Code>} */ | ||
let marker | ||
return start | ||
let marker; | ||
return start; | ||
@@ -221,5 +175,5 @@ /** | ||
function start(code) { | ||
marker = code | ||
effects.enter('attentionSequence') | ||
return inside(code) | ||
marker = code; | ||
effects.enter('attentionSequence'); | ||
return inside(code); | ||
} | ||
@@ -239,19 +193,17 @@ | ||
if (code === marker) { | ||
effects.consume(code) | ||
return inside | ||
effects.consume(code); | ||
return inside; | ||
} | ||
const token = effects.exit('attentionSequence') | ||
const token = effects.exit('attentionSequence'); | ||
// To do: next major: move this to resolver, just like `markdown-rs`. | ||
const after = classifyCharacter(code) | ||
const after = classifyCharacter(code); | ||
// Always populated by defaults. | ||
const open = | ||
!after || (after === 2 && before) || attentionMarkers.includes(code) | ||
const close = | ||
!before || (before === 2 && after) || attentionMarkers.includes(previous) | ||
token._open = Boolean(marker === 42 ? open : open && (before || !close)) | ||
token._close = Boolean(marker === 42 ? close : close && (after || !open)) | ||
return ok(code) | ||
const open = !after || after === 2 && before || attentionMarkers.includes(code); | ||
const close = !before || before === 2 && after || attentionMarkers.includes(previous); | ||
token._open = Boolean(marker === 42 ? open : open && (before || !close)); | ||
token._close = Boolean(marker === 42 ? close : close && (after || !open)); | ||
return ok(code); | ||
} | ||
@@ -271,5 +223,5 @@ } | ||
function movePoint(point, offset) { | ||
point.column += offset | ||
point.offset += offset | ||
point._bufferIndex += offset | ||
} | ||
point.column += offset; | ||
point.offset += offset; | ||
point._bufferIndex += offset; | ||
} |
/** @type {Construct} */ | ||
export const autolink: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const autolink: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=autolink.d.ts.map |
@@ -8,8 +8,3 @@ /** | ||
import { | ||
asciiAlpha, | ||
asciiAlphanumeric, | ||
asciiAtext, | ||
asciiControl | ||
} from 'micromark-util-character' | ||
import { asciiAlpha, asciiAlphanumeric, asciiAtext, asciiControl } from 'micromark-util-character'; | ||
/** @type {Construct} */ | ||
@@ -19,3 +14,3 @@ export const autolink = { | ||
tokenize: tokenizeAutolink | ||
} | ||
}; | ||
@@ -27,4 +22,4 @@ /** | ||
function tokenizeAutolink(effects, ok, nok) { | ||
let size = 0 | ||
return start | ||
let size = 0; | ||
return start; | ||
@@ -44,8 +39,8 @@ /** | ||
function start(code) { | ||
effects.enter('autolink') | ||
effects.enter('autolinkMarker') | ||
effects.consume(code) | ||
effects.exit('autolinkMarker') | ||
effects.enter('autolinkProtocol') | ||
return open | ||
effects.enter("autolink"); | ||
effects.enter("autolinkMarker"); | ||
effects.consume(code); | ||
effects.exit("autolinkMarker"); | ||
effects.enter("autolinkProtocol"); | ||
return open; | ||
} | ||
@@ -67,6 +62,9 @@ | ||
if (asciiAlpha(code)) { | ||
effects.consume(code) | ||
return schemeOrEmailAtext | ||
effects.consume(code); | ||
return schemeOrEmailAtext; | ||
} | ||
return emailAtext(code) | ||
if (code === 64) { | ||
return nok(code); | ||
} | ||
return emailAtext(code); | ||
} | ||
@@ -90,6 +88,6 @@ | ||
// Count the previous alphabetical from `open` too. | ||
size = 1 | ||
return schemeInsideOrEmailAtext(code) | ||
size = 1; | ||
return schemeInsideOrEmailAtext(code); | ||
} | ||
return emailAtext(code) | ||
return emailAtext(code); | ||
} | ||
@@ -111,17 +109,14 @@ | ||
if (code === 58) { | ||
effects.consume(code) | ||
size = 0 | ||
return urlInside | ||
effects.consume(code); | ||
size = 0; | ||
return urlInside; | ||
} | ||
// ASCII alphanumeric and `+`, `-`, and `.`. | ||
if ( | ||
(code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) && | ||
size++ < 32 | ||
) { | ||
effects.consume(code) | ||
return schemeInsideOrEmailAtext | ||
if ((code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) && size++ < 32) { | ||
effects.consume(code); | ||
return schemeInsideOrEmailAtext; | ||
} | ||
size = 0 | ||
return emailAtext(code) | ||
size = 0; | ||
return emailAtext(code); | ||
} | ||
@@ -141,8 +136,8 @@ | ||
if (code === 62) { | ||
effects.exit('autolinkProtocol') | ||
effects.enter('autolinkMarker') | ||
effects.consume(code) | ||
effects.exit('autolinkMarker') | ||
effects.exit('autolink') | ||
return ok | ||
effects.exit("autolinkProtocol"); | ||
effects.enter("autolinkMarker"); | ||
effects.consume(code); | ||
effects.exit("autolinkMarker"); | ||
effects.exit("autolink"); | ||
return ok; | ||
} | ||
@@ -152,6 +147,6 @@ | ||
if (code === null || code === 32 || code === 60 || asciiControl(code)) { | ||
return nok(code) | ||
return nok(code); | ||
} | ||
effects.consume(code) | ||
return urlInside | ||
effects.consume(code); | ||
return urlInside; | ||
} | ||
@@ -171,10 +166,10 @@ | ||
if (code === 64) { | ||
effects.consume(code) | ||
return emailAtSignOrDot | ||
effects.consume(code); | ||
return emailAtSignOrDot; | ||
} | ||
if (asciiAtext(code)) { | ||
effects.consume(code) | ||
return emailAtext | ||
effects.consume(code); | ||
return emailAtext; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -193,3 +188,3 @@ | ||
function emailAtSignOrDot(code) { | ||
return asciiAlphanumeric(code) ? emailLabel(code) : nok(code) | ||
return asciiAlphanumeric(code) ? emailLabel(code) : nok(code); | ||
} | ||
@@ -209,16 +204,16 @@ | ||
if (code === 46) { | ||
effects.consume(code) | ||
size = 0 | ||
return emailAtSignOrDot | ||
effects.consume(code); | ||
size = 0; | ||
return emailAtSignOrDot; | ||
} | ||
if (code === 62) { | ||
// Exit, then change the token type. | ||
effects.exit('autolinkProtocol').type = 'autolinkEmail' | ||
effects.enter('autolinkMarker') | ||
effects.consume(code) | ||
effects.exit('autolinkMarker') | ||
effects.exit('autolink') | ||
return ok | ||
effects.exit("autolinkProtocol").type = "autolinkEmail"; | ||
effects.enter("autolinkMarker"); | ||
effects.consume(code); | ||
effects.exit("autolinkMarker"); | ||
effects.exit("autolink"); | ||
return ok; | ||
} | ||
return emailValue(code) | ||
return emailValue(code); | ||
} | ||
@@ -241,8 +236,8 @@ | ||
if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) { | ||
const next = code === 45 ? emailValue : emailLabel | ||
effects.consume(code) | ||
return next | ||
const next = code === 45 ? emailValue : emailLabel; | ||
effects.consume(code); | ||
return next; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
} | ||
} |
/** @type {Construct} */ | ||
export const blankLine: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const blankLine: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=blank-line.d.ts.map |
@@ -8,4 +8,4 @@ /** | ||
import {factorySpace} from 'micromark-factory-space' | ||
import {markdownLineEnding, markdownSpace} from 'micromark-util-character' | ||
import { factorySpace } from 'micromark-factory-space'; | ||
import { markdownLineEnding, markdownSpace } from 'micromark-util-character'; | ||
/** @type {Construct} */ | ||
@@ -15,3 +15,3 @@ export const blankLine = { | ||
partial: true | ||
} | ||
}; | ||
@@ -23,3 +23,3 @@ /** | ||
function tokenizeBlankLine(effects, ok, nok) { | ||
return start | ||
return start; | ||
@@ -41,5 +41,3 @@ /** | ||
function start(code) { | ||
return markdownSpace(code) | ||
? factorySpace(effects, after, 'linePrefix')(code) | ||
: after(code) | ||
return markdownSpace(code) ? factorySpace(effects, after, "linePrefix")(code) : after(code); | ||
} | ||
@@ -62,4 +60,4 @@ | ||
function after(code) { | ||
return code === null || markdownLineEnding(code) ? ok(code) : nok(code) | ||
return code === null || markdownLineEnding(code) ? ok(code) : nok(code); | ||
} | ||
} | ||
} |
/** @type {Construct} */ | ||
export const blockQuote: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type Exiter = import('micromark-util-types').Exiter | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const blockQuote: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type Exiter = import('micromark-util-types').Exiter; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=block-quote.d.ts.map |
@@ -9,4 +9,4 @@ /** | ||
import {factorySpace} from 'micromark-factory-space' | ||
import {markdownSpace} from 'micromark-util-character' | ||
import { factorySpace } from 'micromark-factory-space'; | ||
import { markdownSpace } from 'micromark-util-character'; | ||
/** @type {Construct} */ | ||
@@ -20,3 +20,3 @@ export const blockQuote = { | ||
exit | ||
} | ||
}; | ||
@@ -28,4 +28,4 @@ /** | ||
function tokenizeBlockQuoteStart(effects, ok, nok) { | ||
const self = this | ||
return start | ||
const self = this; | ||
return start; | ||
@@ -44,16 +44,16 @@ /** | ||
if (code === 62) { | ||
const state = self.containerState | ||
const state = self.containerState; | ||
if (!state.open) { | ||
effects.enter('blockQuote', { | ||
effects.enter("blockQuote", { | ||
_container: true | ||
}) | ||
state.open = true | ||
}); | ||
state.open = true; | ||
} | ||
effects.enter('blockQuotePrefix') | ||
effects.enter('blockQuoteMarker') | ||
effects.consume(code) | ||
effects.exit('blockQuoteMarker') | ||
return after | ||
effects.enter("blockQuotePrefix"); | ||
effects.enter("blockQuoteMarker"); | ||
effects.consume(code); | ||
effects.exit("blockQuoteMarker"); | ||
return after; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -73,10 +73,10 @@ | ||
if (markdownSpace(code)) { | ||
effects.enter('blockQuotePrefixWhitespace') | ||
effects.consume(code) | ||
effects.exit('blockQuotePrefixWhitespace') | ||
effects.exit('blockQuotePrefix') | ||
return ok | ||
effects.enter("blockQuotePrefixWhitespace"); | ||
effects.consume(code); | ||
effects.exit("blockQuotePrefixWhitespace"); | ||
effects.exit("blockQuotePrefix"); | ||
return ok; | ||
} | ||
effects.exit('blockQuotePrefix') | ||
return ok(code) | ||
effects.exit("blockQuotePrefix"); | ||
return ok(code); | ||
} | ||
@@ -98,4 +98,4 @@ } | ||
function tokenizeBlockQuoteContinuation(effects, ok, nok) { | ||
const self = this | ||
return contStart | ||
const self = this; | ||
return contStart; | ||
@@ -119,12 +119,5 @@ /** | ||
return factorySpace( | ||
effects, | ||
contBefore, | ||
'linePrefix', | ||
self.parser.constructs.disable.null.includes('codeIndented') | ||
? undefined | ||
: 4 | ||
)(code) | ||
return factorySpace(effects, contBefore, "linePrefix", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code); | ||
} | ||
return contBefore(code) | ||
return contBefore(code); | ||
} | ||
@@ -146,3 +139,3 @@ | ||
function contBefore(code) { | ||
return effects.attempt(blockQuote, ok, nok)(code) | ||
return effects.attempt(blockQuote, ok, nok)(code); | ||
} | ||
@@ -153,3 +146,3 @@ } | ||
function exit(effects) { | ||
effects.exit('blockQuote') | ||
} | ||
effects.exit("blockQuote"); | ||
} |
/** @type {Construct} */ | ||
export const characterEscape: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const characterEscape: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=character-escape.d.ts.map |
@@ -8,3 +8,3 @@ /** | ||
import {asciiPunctuation} from 'micromark-util-character' | ||
import { asciiPunctuation } from 'micromark-util-character'; | ||
/** @type {Construct} */ | ||
@@ -14,3 +14,3 @@ export const characterEscape = { | ||
tokenize: tokenizeCharacterEscape | ||
} | ||
}; | ||
@@ -22,3 +22,3 @@ /** | ||
function tokenizeCharacterEscape(effects, ok, nok) { | ||
return start | ||
return start; | ||
@@ -36,7 +36,7 @@ /** | ||
function start(code) { | ||
effects.enter('characterEscape') | ||
effects.enter('escapeMarker') | ||
effects.consume(code) | ||
effects.exit('escapeMarker') | ||
return inside | ||
effects.enter("characterEscape"); | ||
effects.enter("escapeMarker"); | ||
effects.consume(code); | ||
effects.exit("escapeMarker"); | ||
return inside; | ||
} | ||
@@ -57,10 +57,10 @@ | ||
if (asciiPunctuation(code)) { | ||
effects.enter('characterEscapeValue') | ||
effects.consume(code) | ||
effects.exit('characterEscapeValue') | ||
effects.exit('characterEscape') | ||
return ok | ||
effects.enter("characterEscapeValue"); | ||
effects.consume(code); | ||
effects.exit("characterEscapeValue"); | ||
effects.exit("characterEscape"); | ||
return ok; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
} | ||
} |
/** @type {Construct} */ | ||
export const characterReference: Construct | ||
export type Code = import('micromark-util-types').Code | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const characterReference: Construct; | ||
export type Code = import('micromark-util-types').Code; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=character-reference.d.ts.map |
@@ -9,8 +9,4 @@ /** | ||
import {decodeNamedCharacterReference} from 'decode-named-character-reference' | ||
import { | ||
asciiAlphanumeric, | ||
asciiDigit, | ||
asciiHexDigit | ||
} from 'micromark-util-character' | ||
import { decodeNamedCharacterReference } from 'decode-named-character-reference'; | ||
import { asciiAlphanumeric, asciiDigit, asciiHexDigit } from 'micromark-util-character'; | ||
/** @type {Construct} */ | ||
@@ -20,3 +16,3 @@ export const characterReference = { | ||
tokenize: tokenizeCharacterReference | ||
} | ||
}; | ||
@@ -28,9 +24,9 @@ /** | ||
function tokenizeCharacterReference(effects, ok, nok) { | ||
const self = this | ||
let size = 0 | ||
const self = this; | ||
let size = 0; | ||
/** @type {number} */ | ||
let max | ||
let max; | ||
/** @type {(code: Code) => boolean} */ | ||
let test | ||
return start | ||
let test; | ||
return start; | ||
@@ -52,7 +48,7 @@ /** | ||
function start(code) { | ||
effects.enter('characterReference') | ||
effects.enter('characterReferenceMarker') | ||
effects.consume(code) | ||
effects.exit('characterReferenceMarker') | ||
return open | ||
effects.enter("characterReference"); | ||
effects.enter("characterReferenceMarker"); | ||
effects.consume(code); | ||
effects.exit("characterReferenceMarker"); | ||
return open; | ||
} | ||
@@ -77,11 +73,11 @@ | ||
if (code === 35) { | ||
effects.enter('characterReferenceMarkerNumeric') | ||
effects.consume(code) | ||
effects.exit('characterReferenceMarkerNumeric') | ||
return numeric | ||
effects.enter("characterReferenceMarkerNumeric"); | ||
effects.consume(code); | ||
effects.exit("characterReferenceMarkerNumeric"); | ||
return numeric; | ||
} | ||
effects.enter('characterReferenceValue') | ||
max = 31 | ||
test = asciiAlphanumeric | ||
return value(code) | ||
effects.enter("characterReferenceValue"); | ||
max = 31; | ||
test = asciiAlphanumeric; | ||
return value(code); | ||
} | ||
@@ -103,14 +99,14 @@ | ||
if (code === 88 || code === 120) { | ||
effects.enter('characterReferenceMarkerHexadecimal') | ||
effects.consume(code) | ||
effects.exit('characterReferenceMarkerHexadecimal') | ||
effects.enter('characterReferenceValue') | ||
max = 6 | ||
test = asciiHexDigit | ||
return value | ||
effects.enter("characterReferenceMarkerHexadecimal"); | ||
effects.consume(code); | ||
effects.exit("characterReferenceMarkerHexadecimal"); | ||
effects.enter("characterReferenceValue"); | ||
max = 6; | ||
test = asciiHexDigit; | ||
return value; | ||
} | ||
effects.enter('characterReferenceValue') | ||
max = 7 | ||
test = asciiDigit | ||
return value(code) | ||
effects.enter("characterReferenceValue"); | ||
max = 7; | ||
test = asciiDigit; | ||
return value(code); | ||
} | ||
@@ -137,8 +133,5 @@ | ||
if (code === 59 && size) { | ||
const token = effects.exit('characterReferenceValue') | ||
if ( | ||
test === asciiAlphanumeric && | ||
!decodeNamedCharacterReference(self.sliceSerialize(token)) | ||
) { | ||
return nok(code) | ||
const token = effects.exit("characterReferenceValue"); | ||
if (test === asciiAlphanumeric && !decodeNamedCharacterReference(self.sliceSerialize(token))) { | ||
return nok(code); | ||
} | ||
@@ -148,14 +141,14 @@ | ||
// `CharacterReferenceMarkerSemi`. | ||
effects.enter('characterReferenceMarker') | ||
effects.consume(code) | ||
effects.exit('characterReferenceMarker') | ||
effects.exit('characterReference') | ||
return ok | ||
effects.enter("characterReferenceMarker"); | ||
effects.consume(code); | ||
effects.exit("characterReferenceMarker"); | ||
effects.exit("characterReference"); | ||
return ok; | ||
} | ||
if (test(code) && size++ < max) { | ||
effects.consume(code) | ||
return value | ||
effects.consume(code); | ||
return value; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
} | ||
} |
/** @type {Construct} */ | ||
export const codeFenced: Construct | ||
export type Code = import('micromark-util-types').Code | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const codeFenced: Construct; | ||
export type Code = import('micromark-util-types').Code; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=code-fenced.d.ts.map |
@@ -9,4 +9,4 @@ /** | ||
import {factorySpace} from 'micromark-factory-space' | ||
import {markdownLineEnding, markdownSpace} from 'micromark-util-character' | ||
import { factorySpace } from 'micromark-factory-space'; | ||
import { markdownLineEnding, markdownSpace } from 'micromark-util-character'; | ||
/** @type {Construct} */ | ||
@@ -16,3 +16,3 @@ const nonLazyContinuation = { | ||
partial: true | ||
} | ||
}; | ||
@@ -24,3 +24,3 @@ /** @type {Construct} */ | ||
concrete: true | ||
} | ||
}; | ||
@@ -32,3 +32,3 @@ /** | ||
function tokenizeCodeFenced(effects, ok, nok) { | ||
const self = this | ||
const self = this; | ||
/** @type {Construct} */ | ||
@@ -38,8 +38,8 @@ const closeStart = { | ||
partial: true | ||
} | ||
let initialPrefix = 0 | ||
let sizeOpen = 0 | ||
}; | ||
let initialPrefix = 0; | ||
let sizeOpen = 0; | ||
/** @type {NonNullable<Code>} */ | ||
let marker | ||
return start | ||
let marker; | ||
return start; | ||
@@ -60,3 +60,3 @@ /** | ||
// To do: parse whitespace like `markdown-rs`. | ||
return beforeSequenceOpen(code) | ||
return beforeSequenceOpen(code); | ||
} | ||
@@ -77,12 +77,9 @@ | ||
function beforeSequenceOpen(code) { | ||
const tail = self.events[self.events.length - 1] | ||
initialPrefix = | ||
tail && tail[1].type === 'linePrefix' | ||
? tail[2].sliceSerialize(tail[1], true).length | ||
: 0 | ||
marker = code | ||
effects.enter('codeFenced') | ||
effects.enter('codeFencedFence') | ||
effects.enter('codeFencedFenceSequence') | ||
return sequenceOpen(code) | ||
const tail = self.events[self.events.length - 1]; | ||
initialPrefix = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0; | ||
marker = code; | ||
effects.enter("codeFenced"); | ||
effects.enter("codeFencedFence"); | ||
effects.enter("codeFencedFenceSequence"); | ||
return sequenceOpen(code); | ||
} | ||
@@ -104,13 +101,11 @@ | ||
if (code === marker) { | ||
sizeOpen++ | ||
effects.consume(code) | ||
return sequenceOpen | ||
sizeOpen++; | ||
effects.consume(code); | ||
return sequenceOpen; | ||
} | ||
if (sizeOpen < 3) { | ||
return nok(code) | ||
return nok(code); | ||
} | ||
effects.exit('codeFencedFenceSequence') | ||
return markdownSpace(code) | ||
? factorySpace(effects, infoBefore, 'whitespace')(code) | ||
: infoBefore(code) | ||
effects.exit("codeFencedFenceSequence"); | ||
return markdownSpace(code) ? factorySpace(effects, infoBefore, "whitespace")(code) : infoBefore(code); | ||
} | ||
@@ -132,12 +127,10 @@ | ||
if (code === null || markdownLineEnding(code)) { | ||
effects.exit('codeFencedFence') | ||
return self.interrupt | ||
? ok(code) | ||
: effects.check(nonLazyContinuation, atNonLazyBreak, after)(code) | ||
effects.exit("codeFencedFence"); | ||
return self.interrupt ? ok(code) : effects.check(nonLazyContinuation, atNonLazyBreak, after)(code); | ||
} | ||
effects.enter('codeFencedFenceInfo') | ||
effects.enter('chunkString', { | ||
contentType: 'string' | ||
}) | ||
return info(code) | ||
effects.enter("codeFencedFenceInfo"); | ||
effects.enter("chunkString", { | ||
contentType: "string" | ||
}); | ||
return info(code); | ||
} | ||
@@ -159,16 +152,16 @@ | ||
if (code === null || markdownLineEnding(code)) { | ||
effects.exit('chunkString') | ||
effects.exit('codeFencedFenceInfo') | ||
return infoBefore(code) | ||
effects.exit("chunkString"); | ||
effects.exit("codeFencedFenceInfo"); | ||
return infoBefore(code); | ||
} | ||
if (markdownSpace(code)) { | ||
effects.exit('chunkString') | ||
effects.exit('codeFencedFenceInfo') | ||
return factorySpace(effects, metaBefore, 'whitespace')(code) | ||
effects.exit("chunkString"); | ||
effects.exit("codeFencedFenceInfo"); | ||
return factorySpace(effects, metaBefore, "whitespace")(code); | ||
} | ||
if (code === 96 && code === marker) { | ||
return nok(code) | ||
return nok(code); | ||
} | ||
effects.consume(code) | ||
return info | ||
effects.consume(code); | ||
return info; | ||
} | ||
@@ -190,9 +183,9 @@ | ||
if (code === null || markdownLineEnding(code)) { | ||
return infoBefore(code) | ||
return infoBefore(code); | ||
} | ||
effects.enter('codeFencedFenceMeta') | ||
effects.enter('chunkString', { | ||
contentType: 'string' | ||
}) | ||
return meta(code) | ||
effects.enter("codeFencedFenceMeta"); | ||
effects.enter("chunkString", { | ||
contentType: "string" | ||
}); | ||
return meta(code); | ||
} | ||
@@ -214,11 +207,11 @@ | ||
if (code === null || markdownLineEnding(code)) { | ||
effects.exit('chunkString') | ||
effects.exit('codeFencedFenceMeta') | ||
return infoBefore(code) | ||
effects.exit("chunkString"); | ||
effects.exit("codeFencedFenceMeta"); | ||
return infoBefore(code); | ||
} | ||
if (code === 96 && code === marker) { | ||
return nok(code) | ||
return nok(code); | ||
} | ||
effects.consume(code) | ||
return meta | ||
effects.consume(code); | ||
return meta; | ||
} | ||
@@ -240,3 +233,3 @@ | ||
function atNonLazyBreak(code) { | ||
return effects.attempt(closeStart, after, contentBefore)(code) | ||
return effects.attempt(closeStart, after, contentBefore)(code); | ||
} | ||
@@ -257,6 +250,6 @@ | ||
function contentBefore(code) { | ||
effects.enter('lineEnding') | ||
effects.consume(code) | ||
effects.exit('lineEnding') | ||
return contentStart | ||
effects.enter("lineEnding"); | ||
effects.consume(code); | ||
effects.exit("lineEnding"); | ||
return contentStart; | ||
} | ||
@@ -277,10 +270,3 @@ | ||
function contentStart(code) { | ||
return initialPrefix > 0 && markdownSpace(code) | ||
? factorySpace( | ||
effects, | ||
beforeContentChunk, | ||
'linePrefix', | ||
initialPrefix + 1 | ||
)(code) | ||
: beforeContentChunk(code) | ||
return initialPrefix > 0 && markdownSpace(code) ? factorySpace(effects, beforeContentChunk, "linePrefix", initialPrefix + 1)(code) : beforeContentChunk(code); | ||
} | ||
@@ -302,6 +288,6 @@ | ||
if (code === null || markdownLineEnding(code)) { | ||
return effects.check(nonLazyContinuation, atNonLazyBreak, after)(code) | ||
return effects.check(nonLazyContinuation, atNonLazyBreak, after)(code); | ||
} | ||
effects.enter('codeFlowValue') | ||
return contentChunk(code) | ||
effects.enter("codeFlowValue"); | ||
return contentChunk(code); | ||
} | ||
@@ -323,7 +309,7 @@ | ||
if (code === null || markdownLineEnding(code)) { | ||
effects.exit('codeFlowValue') | ||
return beforeContentChunk(code) | ||
effects.exit("codeFlowValue"); | ||
return beforeContentChunk(code); | ||
} | ||
effects.consume(code) | ||
return contentChunk | ||
effects.consume(code); | ||
return contentChunk; | ||
} | ||
@@ -344,4 +330,4 @@ | ||
function after(code) { | ||
effects.exit('codeFenced') | ||
return ok(code) | ||
effects.exit("codeFenced"); | ||
return ok(code); | ||
} | ||
@@ -354,4 +340,4 @@ | ||
function tokenizeCloseStart(effects, ok, nok) { | ||
let size = 0 | ||
return startBefore | ||
let size = 0; | ||
return startBefore; | ||
@@ -364,6 +350,6 @@ /** | ||
function startBefore(code) { | ||
effects.enter('lineEnding') | ||
effects.consume(code) | ||
effects.exit('lineEnding') | ||
return start | ||
effects.enter("lineEnding"); | ||
effects.consume(code); | ||
effects.exit("lineEnding"); | ||
return start; | ||
} | ||
@@ -387,13 +373,4 @@ | ||
// To do: `enter` here or in next state? | ||
effects.enter('codeFencedFence') | ||
return markdownSpace(code) | ||
? factorySpace( | ||
effects, | ||
beforeSequenceClose, | ||
'linePrefix', | ||
self.parser.constructs.disable.null.includes('codeIndented') | ||
? undefined | ||
: 4 | ||
)(code) | ||
: beforeSequenceClose(code) | ||
effects.enter("codeFencedFence"); | ||
return markdownSpace(code) ? factorySpace(effects, beforeSequenceClose, "linePrefix", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code) : beforeSequenceClose(code); | ||
} | ||
@@ -415,6 +392,6 @@ | ||
if (code === marker) { | ||
effects.enter('codeFencedFenceSequence') | ||
return sequenceClose(code) | ||
effects.enter("codeFencedFenceSequence"); | ||
return sequenceClose(code); | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -436,13 +413,11 @@ | ||
if (code === marker) { | ||
size++ | ||
effects.consume(code) | ||
return sequenceClose | ||
size++; | ||
effects.consume(code); | ||
return sequenceClose; | ||
} | ||
if (size >= sizeOpen) { | ||
effects.exit('codeFencedFenceSequence') | ||
return markdownSpace(code) | ||
? factorySpace(effects, sequenceCloseAfter, 'whitespace')(code) | ||
: sequenceCloseAfter(code) | ||
effects.exit("codeFencedFenceSequence"); | ||
return markdownSpace(code) ? factorySpace(effects, sequenceCloseAfter, "whitespace")(code) : sequenceCloseAfter(code); | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -464,6 +439,6 @@ | ||
if (code === null || markdownLineEnding(code)) { | ||
effects.exit('codeFencedFence') | ||
return ok(code) | ||
effects.exit("codeFencedFence"); | ||
return ok(code); | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -478,4 +453,4 @@ } | ||
function tokenizeNonLazyContinuation(effects, ok, nok) { | ||
const self = this | ||
return start | ||
const self = this; | ||
return start; | ||
@@ -489,8 +464,8 @@ /** | ||
if (code === null) { | ||
return nok(code) | ||
return nok(code); | ||
} | ||
effects.enter('lineEnding') | ||
effects.consume(code) | ||
effects.exit('lineEnding') | ||
return lineStart | ||
effects.enter("lineEnding"); | ||
effects.consume(code); | ||
effects.exit("lineEnding"); | ||
return lineStart; | ||
} | ||
@@ -504,4 +479,4 @@ | ||
function lineStart(code) { | ||
return self.parser.lazy[self.now().line] ? nok(code) : ok(code) | ||
return self.parser.lazy[self.now().line] ? nok(code) : ok(code); | ||
} | ||
} | ||
} |
/** @type {Construct} */ | ||
export const codeIndented: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const codeIndented: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=code-indented.d.ts.map |
@@ -8,4 +8,4 @@ /** | ||
import {factorySpace} from 'micromark-factory-space' | ||
import {markdownLineEnding, markdownSpace} from 'micromark-util-character' | ||
import { factorySpace } from 'micromark-factory-space'; | ||
import { markdownLineEnding, markdownSpace } from 'micromark-util-character'; | ||
/** @type {Construct} */ | ||
@@ -15,3 +15,3 @@ export const codeIndented = { | ||
tokenize: tokenizeCodeIndented | ||
} | ||
}; | ||
@@ -22,3 +22,3 @@ /** @type {Construct} */ | ||
partial: true | ||
} | ||
}; | ||
@@ -30,4 +30,4 @@ /** | ||
function tokenizeCodeIndented(effects, ok, nok) { | ||
const self = this | ||
return start | ||
const self = this; | ||
return start; | ||
@@ -51,6 +51,6 @@ /** | ||
effects.enter('codeIndented') | ||
effects.enter("codeIndented"); | ||
// To do: use an improved `space_or_tab` function like `markdown-rs`, | ||
// so that we can drop the next state. | ||
return factorySpace(effects, afterPrefix, 'linePrefix', 4 + 1)(code) | ||
return factorySpace(effects, afterPrefix, "linePrefix", 4 + 1)(code); | ||
} | ||
@@ -69,8 +69,4 @@ | ||
function afterPrefix(code) { | ||
const tail = self.events[self.events.length - 1] | ||
return tail && | ||
tail[1].type === 'linePrefix' && | ||
tail[2].sliceSerialize(tail[1], true).length >= 4 | ||
? atBreak(code) | ||
: nok(code) | ||
const tail = self.events[self.events.length - 1]; | ||
return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? atBreak(code) : nok(code); | ||
} | ||
@@ -90,9 +86,9 @@ | ||
if (code === null) { | ||
return after(code) | ||
return after(code); | ||
} | ||
if (markdownLineEnding(code)) { | ||
return effects.attempt(furtherStart, atBreak, after)(code) | ||
return effects.attempt(furtherStart, atBreak, after)(code); | ||
} | ||
effects.enter('codeFlowValue') | ||
return inside(code) | ||
effects.enter("codeFlowValue"); | ||
return inside(code); | ||
} | ||
@@ -112,7 +108,7 @@ | ||
if (code === null || markdownLineEnding(code)) { | ||
effects.exit('codeFlowValue') | ||
return atBreak(code) | ||
effects.exit("codeFlowValue"); | ||
return atBreak(code); | ||
} | ||
effects.consume(code) | ||
return inside | ||
effects.consume(code); | ||
return inside; | ||
} | ||
@@ -122,7 +118,7 @@ | ||
function after(code) { | ||
effects.exit('codeIndented') | ||
effects.exit("codeIndented"); | ||
// To do: allow interrupting like `markdown-rs`. | ||
// Feel free to interrupt. | ||
// tokenizer.interrupt = false | ||
return ok(code) | ||
return ok(code); | ||
} | ||
@@ -136,4 +132,4 @@ } | ||
function tokenizeFurtherStart(effects, ok, nok) { | ||
const self = this | ||
return furtherStart | ||
const self = this; | ||
return furtherStart; | ||
@@ -155,9 +151,9 @@ /** | ||
if (self.parser.lazy[self.now().line]) { | ||
return nok(code) | ||
return nok(code); | ||
} | ||
if (markdownLineEnding(code)) { | ||
effects.enter('lineEnding') | ||
effects.consume(code) | ||
effects.exit('lineEnding') | ||
return furtherStart | ||
effects.enter("lineEnding"); | ||
effects.consume(code); | ||
effects.exit("lineEnding"); | ||
return furtherStart; | ||
} | ||
@@ -171,3 +167,3 @@ | ||
// so that we can drop the next state. | ||
return factorySpace(effects, afterPrefix, 'linePrefix', 4 + 1)(code) | ||
return factorySpace(effects, afterPrefix, "linePrefix", 4 + 1)(code); | ||
} | ||
@@ -186,11 +182,5 @@ | ||
function afterPrefix(code) { | ||
const tail = self.events[self.events.length - 1] | ||
return tail && | ||
tail[1].type === 'linePrefix' && | ||
tail[2].sliceSerialize(tail[1], true).length >= 4 | ||
? ok(code) | ||
: markdownLineEnding(code) | ||
? furtherStart(code) | ||
: nok(code) | ||
const tail = self.events[self.events.length - 1]; | ||
return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? ok(code) : markdownLineEnding(code) ? furtherStart(code) : nok(code); | ||
} | ||
} | ||
} |
/** @type {Construct} */ | ||
export const codeText: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type Previous = import('micromark-util-types').Previous | ||
export type Resolver = import('micromark-util-types').Resolver | ||
export type State = import('micromark-util-types').State | ||
export type Token = import('micromark-util-types').Token | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const codeText: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type Previous = import('micromark-util-types').Previous; | ||
export type Resolver = import('micromark-util-types').Resolver; | ||
export type State = import('micromark-util-types').State; | ||
export type Token = import('micromark-util-types').Token; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=code-text.d.ts.map |
@@ -11,3 +11,3 @@ /** | ||
import {markdownLineEnding} from 'micromark-util-character' | ||
import { markdownLineEnding } from 'micromark-util-character'; | ||
/** @type {Construct} */ | ||
@@ -19,3 +19,3 @@ export const codeText = { | ||
previous | ||
} | ||
}; | ||
@@ -25,27 +25,22 @@ // To do: next major: don’t resolve, like `markdown-rs`. | ||
function resolveCodeText(events) { | ||
let tailExitIndex = events.length - 4 | ||
let headEnterIndex = 3 | ||
let tailExitIndex = events.length - 4; | ||
let headEnterIndex = 3; | ||
/** @type {number} */ | ||
let index | ||
let index; | ||
/** @type {number | undefined} */ | ||
let enter | ||
let enter; | ||
// If we start and end with an EOL or a space. | ||
if ( | ||
(events[headEnterIndex][1].type === 'lineEnding' || | ||
events[headEnterIndex][1].type === 'space') && | ||
(events[tailExitIndex][1].type === 'lineEnding' || | ||
events[tailExitIndex][1].type === 'space') | ||
) { | ||
index = headEnterIndex | ||
if ((events[headEnterIndex][1].type === "lineEnding" || events[headEnterIndex][1].type === 'space') && (events[tailExitIndex][1].type === "lineEnding" || events[tailExitIndex][1].type === 'space')) { | ||
index = headEnterIndex; | ||
// And we have data. | ||
while (++index < tailExitIndex) { | ||
if (events[index][1].type === 'codeTextData') { | ||
if (events[index][1].type === "codeTextData") { | ||
// Then we have padding. | ||
events[headEnterIndex][1].type = 'codeTextPadding' | ||
events[tailExitIndex][1].type = 'codeTextPadding' | ||
headEnterIndex += 2 | ||
tailExitIndex -= 2 | ||
break | ||
events[headEnterIndex][1].type = "codeTextPadding"; | ||
events[tailExitIndex][1].type = "codeTextPadding"; | ||
headEnterIndex += 2; | ||
tailExitIndex -= 2; | ||
break; | ||
} | ||
@@ -56,24 +51,21 @@ } | ||
// Merge adjacent spaces and data. | ||
index = headEnterIndex - 1 | ||
tailExitIndex++ | ||
index = headEnterIndex - 1; | ||
tailExitIndex++; | ||
while (++index <= tailExitIndex) { | ||
if (enter === undefined) { | ||
if (index !== tailExitIndex && events[index][1].type !== 'lineEnding') { | ||
enter = index | ||
if (index !== tailExitIndex && events[index][1].type !== "lineEnding") { | ||
enter = index; | ||
} | ||
} else if ( | ||
index === tailExitIndex || | ||
events[index][1].type === 'lineEnding' | ||
) { | ||
events[enter][1].type = 'codeTextData' | ||
} else if (index === tailExitIndex || events[index][1].type === "lineEnding") { | ||
events[enter][1].type = "codeTextData"; | ||
if (index !== enter + 2) { | ||
events[enter][1].end = events[index - 1][1].end | ||
events.splice(enter + 2, index - enter - 2) | ||
tailExitIndex -= index - enter - 2 | ||
index = enter + 2 | ||
events[enter][1].end = events[index - 1][1].end; | ||
events.splice(enter + 2, index - enter - 2); | ||
tailExitIndex -= index - enter - 2; | ||
index = enter + 2; | ||
} | ||
enter = undefined | ||
enter = undefined; | ||
} | ||
} | ||
return events | ||
return events; | ||
} | ||
@@ -87,6 +79,3 @@ | ||
// If there is a previous code, there will always be a tail. | ||
return ( | ||
code !== 96 || | ||
this.events[this.events.length - 1][1].type === 'characterEscape' | ||
) | ||
return code !== 96 || this.events[this.events.length - 1][1].type === "characterEscape"; | ||
} | ||
@@ -99,9 +88,9 @@ | ||
function tokenizeCodeText(effects, ok, nok) { | ||
const self = this | ||
let sizeOpen = 0 | ||
const self = this; | ||
let sizeOpen = 0; | ||
/** @type {number} */ | ||
let size | ||
let size; | ||
/** @type {Token} */ | ||
let token | ||
return start | ||
let token; | ||
return start; | ||
@@ -121,5 +110,5 @@ /** | ||
function start(code) { | ||
effects.enter('codeText') | ||
effects.enter('codeTextSequence') | ||
return sequenceOpen(code) | ||
effects.enter("codeText"); | ||
effects.enter("codeTextSequence"); | ||
return sequenceOpen(code); | ||
} | ||
@@ -139,8 +128,8 @@ | ||
if (code === 96) { | ||
effects.consume(code) | ||
sizeOpen++ | ||
return sequenceOpen | ||
effects.consume(code); | ||
sizeOpen++; | ||
return sequenceOpen; | ||
} | ||
effects.exit('codeTextSequence') | ||
return between(code) | ||
effects.exit("codeTextSequence"); | ||
return between(code); | ||
} | ||
@@ -161,3 +150,3 @@ | ||
if (code === null) { | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -169,6 +158,6 @@ | ||
if (code === 32) { | ||
effects.enter('space') | ||
effects.consume(code) | ||
effects.exit('space') | ||
return between | ||
effects.enter('space'); | ||
effects.consume(code); | ||
effects.exit('space'); | ||
return between; | ||
} | ||
@@ -178,16 +167,16 @@ | ||
if (code === 96) { | ||
token = effects.enter('codeTextSequence') | ||
size = 0 | ||
return sequenceClose(code) | ||
token = effects.enter("codeTextSequence"); | ||
size = 0; | ||
return sequenceClose(code); | ||
} | ||
if (markdownLineEnding(code)) { | ||
effects.enter('lineEnding') | ||
effects.consume(code) | ||
effects.exit('lineEnding') | ||
return between | ||
effects.enter("lineEnding"); | ||
effects.consume(code); | ||
effects.exit("lineEnding"); | ||
return between; | ||
} | ||
// Data. | ||
effects.enter('codeTextData') | ||
return data(code) | ||
effects.enter("codeTextData"); | ||
return data(code); | ||
} | ||
@@ -206,13 +195,8 @@ | ||
function data(code) { | ||
if ( | ||
code === null || | ||
code === 32 || | ||
code === 96 || | ||
markdownLineEnding(code) | ||
) { | ||
effects.exit('codeTextData') | ||
return between(code) | ||
if (code === null || code === 32 || code === 96 || markdownLineEnding(code)) { | ||
effects.exit("codeTextData"); | ||
return between(code); | ||
} | ||
effects.consume(code) | ||
return data | ||
effects.consume(code); | ||
return data; | ||
} | ||
@@ -233,5 +217,5 @@ | ||
if (code === 96) { | ||
effects.consume(code) | ||
size++ | ||
return sequenceClose | ||
effects.consume(code); | ||
size++; | ||
return sequenceClose; | ||
} | ||
@@ -241,11 +225,11 @@ | ||
if (size === sizeOpen) { | ||
effects.exit('codeTextSequence') | ||
effects.exit('codeText') | ||
return ok(code) | ||
effects.exit("codeTextSequence"); | ||
effects.exit("codeText"); | ||
return ok(code); | ||
} | ||
// More or less accents: mark as data. | ||
token.type = 'codeTextData' | ||
return data(code) | ||
token.type = "codeTextData"; | ||
return data(code); | ||
} | ||
} | ||
} |
@@ -5,8 +5,9 @@ /** | ||
*/ | ||
export const content: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type Resolver = import('micromark-util-types').Resolver | ||
export type State = import('micromark-util-types').State | ||
export type Token = import('micromark-util-types').Token | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const content: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type Resolver = import('micromark-util-types').Resolver; | ||
export type State = import('micromark-util-types').State; | ||
export type Token = import('micromark-util-types').Token; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=content.d.ts.map |
@@ -10,5 +10,5 @@ /** | ||
import {factorySpace} from 'micromark-factory-space' | ||
import {markdownLineEnding} from 'micromark-util-character' | ||
import {subtokenize} from 'micromark-util-subtokenize' | ||
import { factorySpace } from 'micromark-factory-space'; | ||
import { markdownLineEnding } from 'micromark-util-character'; | ||
import { subtokenize } from 'micromark-util-subtokenize'; | ||
/** | ||
@@ -21,3 +21,3 @@ * No name because it must not be turned off. | ||
resolve: resolveContent | ||
} | ||
}; | ||
@@ -28,3 +28,3 @@ /** @type {Construct} */ | ||
partial: true | ||
} | ||
}; | ||
@@ -38,4 +38,4 @@ /** | ||
function resolveContent(events) { | ||
subtokenize(events) | ||
return events | ||
subtokenize(events); | ||
return events; | ||
} | ||
@@ -49,4 +49,4 @@ | ||
/** @type {Token | undefined} */ | ||
let previous | ||
return chunkStart | ||
let previous; | ||
return chunkStart; | ||
@@ -64,7 +64,7 @@ /** | ||
function chunkStart(code) { | ||
effects.enter('content') | ||
previous = effects.enter('chunkContent', { | ||
contentType: 'content' | ||
}) | ||
return chunkInside(code) | ||
effects.enter("content"); | ||
previous = effects.enter("chunkContent", { | ||
contentType: "content" | ||
}); | ||
return chunkInside(code); | ||
} | ||
@@ -84,3 +84,3 @@ | ||
if (code === null) { | ||
return contentEnd(code) | ||
return contentEnd(code); | ||
} | ||
@@ -91,12 +91,8 @@ | ||
if (markdownLineEnding(code)) { | ||
return effects.check( | ||
continuationConstruct, | ||
contentContinue, | ||
contentEnd | ||
)(code) | ||
return effects.check(continuationConstruct, contentContinue, contentEnd)(code); | ||
} | ||
// Data. | ||
effects.consume(code) | ||
return chunkInside | ||
effects.consume(code); | ||
return chunkInside; | ||
} | ||
@@ -110,5 +106,5 @@ | ||
function contentEnd(code) { | ||
effects.exit('chunkContent') | ||
effects.exit('content') | ||
return ok(code) | ||
effects.exit("chunkContent"); | ||
effects.exit("content"); | ||
return ok(code); | ||
} | ||
@@ -122,10 +118,10 @@ | ||
function contentContinue(code) { | ||
effects.consume(code) | ||
effects.exit('chunkContent') | ||
previous.next = effects.enter('chunkContent', { | ||
contentType: 'content', | ||
effects.consume(code); | ||
effects.exit("chunkContent"); | ||
previous.next = effects.enter("chunkContent", { | ||
contentType: "content", | ||
previous | ||
}) | ||
previous = previous.next | ||
return chunkInside | ||
}); | ||
previous = previous.next; | ||
return chunkInside; | ||
} | ||
@@ -139,4 +135,4 @@ } | ||
function tokenizeContinuation(effects, ok, nok) { | ||
const self = this | ||
return startLookahead | ||
const self = this; | ||
return startLookahead; | ||
@@ -149,7 +145,7 @@ /** | ||
function startLookahead(code) { | ||
effects.exit('chunkContent') | ||
effects.enter('lineEnding') | ||
effects.consume(code) | ||
effects.exit('lineEnding') | ||
return factorySpace(effects, prefixed, 'linePrefix') | ||
effects.exit("chunkContent"); | ||
effects.enter("lineEnding"); | ||
effects.consume(code); | ||
effects.exit("lineEnding"); | ||
return factorySpace(effects, prefixed, "linePrefix"); | ||
} | ||
@@ -164,3 +160,3 @@ | ||
if (code === null || markdownLineEnding(code)) { | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -170,13 +166,8 @@ | ||
const tail = self.events[self.events.length - 1] | ||
if ( | ||
!self.parser.constructs.disable.null.includes('codeIndented') && | ||
tail && | ||
tail[1].type === 'linePrefix' && | ||
tail[2].sliceSerialize(tail[1], true).length >= 4 | ||
) { | ||
return ok(code) | ||
const tail = self.events[self.events.length - 1]; | ||
if (!self.parser.constructs.disable.null.includes('codeIndented') && tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4) { | ||
return ok(code); | ||
} | ||
return effects.interrupt(self.parser.constructs.flow, nok, ok)(code) | ||
return effects.interrupt(self.parser.constructs.flow, nok, ok)(code); | ||
} | ||
} | ||
} |
/** @type {Construct} */ | ||
export const definition: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const definition: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=definition.d.ts.map |
@@ -8,13 +8,9 @@ /** | ||
import {factoryDestination} from 'micromark-factory-destination' | ||
import {factoryLabel} from 'micromark-factory-label' | ||
import {factorySpace} from 'micromark-factory-space' | ||
import {factoryTitle} from 'micromark-factory-title' | ||
import {factoryWhitespace} from 'micromark-factory-whitespace' | ||
import { | ||
markdownLineEnding, | ||
markdownLineEndingOrSpace, | ||
markdownSpace | ||
} from 'micromark-util-character' | ||
import {normalizeIdentifier} from 'micromark-util-normalize-identifier' | ||
import { factoryDestination } from 'micromark-factory-destination'; | ||
import { factoryLabel } from 'micromark-factory-label'; | ||
import { factorySpace } from 'micromark-factory-space'; | ||
import { factoryTitle } from 'micromark-factory-title'; | ||
import { factoryWhitespace } from 'micromark-factory-whitespace'; | ||
import { markdownLineEnding, markdownLineEndingOrSpace, markdownSpace } from 'micromark-util-character'; | ||
import { normalizeIdentifier } from 'micromark-util-normalize-identifier'; | ||
/** @type {Construct} */ | ||
@@ -24,3 +20,3 @@ export const definition = { | ||
tokenize: tokenizeDefinition | ||
} | ||
}; | ||
@@ -31,3 +27,3 @@ /** @type {Construct} */ | ||
partial: true | ||
} | ||
}; | ||
@@ -39,6 +35,6 @@ /** | ||
function tokenizeDefinition(effects, ok, nok) { | ||
const self = this | ||
const self = this; | ||
/** @type {string} */ | ||
let identifier | ||
return start | ||
let identifier; | ||
return start; | ||
@@ -59,4 +55,4 @@ /** | ||
// To do: parse whitespace the way `markdown-rs` does. | ||
effects.enter('definition') | ||
return before(code) | ||
effects.enter("definition"); | ||
return before(code); | ||
} | ||
@@ -77,12 +73,5 @@ | ||
return factoryLabel.call( | ||
self, | ||
effects, | ||
labelAfter, | ||
// Note: we don’t need to reset the way `markdown-rs` does. | ||
nok, | ||
'definitionLabel', | ||
'definitionLabelMarker', | ||
'definitionLabelString' | ||
)(code) | ||
return factoryLabel.call(self, effects, labelAfter, | ||
// Note: we don’t need to reset the way `markdown-rs` does. | ||
nok, "definitionLabel", "definitionLabelMarker", "definitionLabelString")(code); | ||
} | ||
@@ -101,12 +90,10 @@ | ||
function labelAfter(code) { | ||
identifier = normalizeIdentifier( | ||
self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1) | ||
) | ||
identifier = normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1)); | ||
if (code === 58) { | ||
effects.enter('definitionMarker') | ||
effects.consume(code) | ||
effects.exit('definitionMarker') | ||
return markerAfter | ||
effects.enter("definitionMarker"); | ||
effects.consume(code); | ||
effects.exit("definitionMarker"); | ||
return markerAfter; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -126,5 +113,3 @@ | ||
// Note: whitespace is optional. | ||
return markdownLineEndingOrSpace(code) | ||
? factoryWhitespace(effects, destinationBefore)(code) | ||
: destinationBefore(code) | ||
return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, destinationBefore)(code) : destinationBefore(code); | ||
} | ||
@@ -143,13 +128,5 @@ | ||
function destinationBefore(code) { | ||
return factoryDestination( | ||
effects, | ||
destinationAfter, | ||
// Note: we don’t need to reset the way `markdown-rs` does. | ||
nok, | ||
'definitionDestination', | ||
'definitionDestinationLiteral', | ||
'definitionDestinationLiteralMarker', | ||
'definitionDestinationRaw', | ||
'definitionDestinationString' | ||
)(code) | ||
return factoryDestination(effects, destinationAfter, | ||
// Note: we don’t need to reset the way `markdown-rs` does. | ||
nok, "definitionDestination", "definitionDestinationLiteral", "definitionDestinationLiteralMarker", "definitionDestinationRaw", "definitionDestinationString")(code); | ||
} | ||
@@ -168,3 +145,3 @@ | ||
function destinationAfter(code) { | ||
return effects.attempt(titleBefore, after, after)(code) | ||
return effects.attempt(titleBefore, after, after)(code); | ||
} | ||
@@ -185,5 +162,3 @@ | ||
function after(code) { | ||
return markdownSpace(code) | ||
? factorySpace(effects, afterWhitespace, 'whitespace')(code) | ||
: afterWhitespace(code) | ||
return markdownSpace(code) ? factorySpace(effects, afterWhitespace, "whitespace")(code) : afterWhitespace(code); | ||
} | ||
@@ -205,3 +180,3 @@ | ||
if (code === null || markdownLineEnding(code)) { | ||
effects.exit('definition') | ||
effects.exit("definition"); | ||
@@ -211,3 +186,3 @@ // Note: we don’t care about uniqueness. | ||
// It is more likely that it wastes precious time. | ||
self.parser.defined.push(identifier) | ||
self.parser.defined.push(identifier); | ||
@@ -217,5 +192,5 @@ // To do: `markdown-rs` interrupt. | ||
// tokenizer.interrupt = true | ||
return ok(code) | ||
return ok(code); | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -229,3 +204,3 @@ } | ||
function tokenizeTitleBefore(effects, ok, nok) { | ||
return titleBefore | ||
return titleBefore; | ||
@@ -245,5 +220,3 @@ /** | ||
function titleBefore(code) { | ||
return markdownLineEndingOrSpace(code) | ||
? factoryWhitespace(effects, beforeMarker)(code) | ||
: nok(code) | ||
return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, beforeMarker)(code) : nok(code); | ||
} | ||
@@ -263,10 +236,3 @@ | ||
function beforeMarker(code) { | ||
return factoryTitle( | ||
effects, | ||
titleAfter, | ||
nok, | ||
'definitionTitle', | ||
'definitionTitleMarker', | ||
'definitionTitleString' | ||
)(code) | ||
return factoryTitle(effects, titleAfter, nok, "definitionTitle", "definitionTitleMarker", "definitionTitleString")(code); | ||
} | ||
@@ -285,5 +251,3 @@ | ||
function titleAfter(code) { | ||
return markdownSpace(code) | ||
? factorySpace(effects, titleAfterOptionalWhitespace, 'whitespace')(code) | ||
: titleAfterOptionalWhitespace(code) | ||
return markdownSpace(code) ? factorySpace(effects, titleAfterOptionalWhitespace, "whitespace")(code) : titleAfterOptionalWhitespace(code); | ||
} | ||
@@ -302,4 +266,4 @@ | ||
function titleAfterOptionalWhitespace(code) { | ||
return code === null || markdownLineEnding(code) ? ok(code) : nok(code) | ||
return code === null || markdownLineEnding(code) ? ok(code) : nok(code); | ||
} | ||
} | ||
} |
/** @type {Construct} */ | ||
export const hardBreakEscape: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const hardBreakEscape: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=hard-break-escape.d.ts.map |
@@ -8,3 +8,3 @@ /** | ||
import {markdownLineEnding} from 'micromark-util-character' | ||
import { markdownLineEnding } from 'micromark-util-character'; | ||
/** @type {Construct} */ | ||
@@ -14,3 +14,3 @@ export const hardBreakEscape = { | ||
tokenize: tokenizeHardBreakEscape | ||
} | ||
}; | ||
@@ -22,3 +22,3 @@ /** | ||
function tokenizeHardBreakEscape(effects, ok, nok) { | ||
return start | ||
return start; | ||
@@ -37,5 +37,5 @@ /** | ||
function start(code) { | ||
effects.enter('hardBreakEscape') | ||
effects.consume(code) | ||
return after | ||
effects.enter("hardBreakEscape"); | ||
effects.consume(code); | ||
return after; | ||
} | ||
@@ -56,7 +56,7 @@ | ||
if (markdownLineEnding(code)) { | ||
effects.exit('hardBreakEscape') | ||
return ok(code) | ||
effects.exit("hardBreakEscape"); | ||
return ok(code); | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
} | ||
} |
/** @type {Construct} */ | ||
export const headingAtx: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type Resolver = import('micromark-util-types').Resolver | ||
export type State = import('micromark-util-types').State | ||
export type Token = import('micromark-util-types').Token | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const headingAtx: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type Resolver = import('micromark-util-types').Resolver; | ||
export type State = import('micromark-util-types').State; | ||
export type Token = import('micromark-util-types').Token; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=heading-atx.d.ts.map |
@@ -10,9 +10,5 @@ /** | ||
import {factorySpace} from 'micromark-factory-space' | ||
import { | ||
markdownLineEnding, | ||
markdownLineEndingOrSpace, | ||
markdownSpace | ||
} from 'micromark-util-character' | ||
import {splice} from 'micromark-util-chunked' | ||
import { factorySpace } from 'micromark-factory-space'; | ||
import { markdownLineEnding, markdownLineEndingOrSpace, markdownSpace } from 'micromark-util-character'; | ||
import { splice } from 'micromark-util-chunked'; | ||
/** @type {Construct} */ | ||
@@ -23,53 +19,40 @@ export const headingAtx = { | ||
resolve: resolveHeadingAtx | ||
} | ||
}; | ||
/** @type {Resolver} */ | ||
function resolveHeadingAtx(events, context) { | ||
let contentEnd = events.length - 2 | ||
let contentStart = 3 | ||
let contentEnd = events.length - 2; | ||
let contentStart = 3; | ||
/** @type {Token} */ | ||
let content | ||
let content; | ||
/** @type {Token} */ | ||
let text | ||
let text; | ||
// Prefix whitespace, part of the opening. | ||
if (events[contentStart][1].type === 'whitespace') { | ||
contentStart += 2 | ||
if (events[contentStart][1].type === "whitespace") { | ||
contentStart += 2; | ||
} | ||
// Suffix whitespace, part of the closing. | ||
if ( | ||
contentEnd - 2 > contentStart && | ||
events[contentEnd][1].type === 'whitespace' | ||
) { | ||
contentEnd -= 2 | ||
if (contentEnd - 2 > contentStart && events[contentEnd][1].type === "whitespace") { | ||
contentEnd -= 2; | ||
} | ||
if ( | ||
events[contentEnd][1].type === 'atxHeadingSequence' && | ||
(contentStart === contentEnd - 1 || | ||
(contentEnd - 4 > contentStart && | ||
events[contentEnd - 2][1].type === 'whitespace')) | ||
) { | ||
contentEnd -= contentStart + 1 === contentEnd ? 2 : 4 | ||
if (events[contentEnd][1].type === "atxHeadingSequence" && (contentStart === contentEnd - 1 || contentEnd - 4 > contentStart && events[contentEnd - 2][1].type === "whitespace")) { | ||
contentEnd -= contentStart + 1 === contentEnd ? 2 : 4; | ||
} | ||
if (contentEnd > contentStart) { | ||
content = { | ||
type: 'atxHeadingText', | ||
type: "atxHeadingText", | ||
start: events[contentStart][1].start, | ||
end: events[contentEnd][1].end | ||
} | ||
}; | ||
text = { | ||
type: 'chunkText', | ||
type: "chunkText", | ||
start: events[contentStart][1].start, | ||
end: events[contentEnd][1].end, | ||
contentType: 'text' | ||
} | ||
splice(events, contentStart, contentEnd - contentStart + 1, [ | ||
['enter', content, context], | ||
['enter', text, context], | ||
['exit', text, context], | ||
['exit', content, context] | ||
]) | ||
contentType: "text" | ||
}; | ||
splice(events, contentStart, contentEnd - contentStart + 1, [['enter', content, context], ['enter', text, context], ['exit', text, context], ['exit', content, context]]); | ||
} | ||
return events | ||
return events; | ||
} | ||
@@ -82,4 +65,4 @@ | ||
function tokenizeHeadingAtx(effects, ok, nok) { | ||
let size = 0 | ||
return start | ||
let size = 0; | ||
return start; | ||
@@ -98,4 +81,4 @@ /** | ||
// To do: parse indent like `markdown-rs`. | ||
effects.enter('atxHeading') | ||
return before(code) | ||
effects.enter("atxHeading"); | ||
return before(code); | ||
} | ||
@@ -114,4 +97,4 @@ | ||
function before(code) { | ||
effects.enter('atxHeadingSequence') | ||
return sequenceOpen(code) | ||
effects.enter("atxHeadingSequence"); | ||
return sequenceOpen(code); | ||
} | ||
@@ -131,4 +114,4 @@ | ||
if (code === 35 && size++ < 6) { | ||
effects.consume(code) | ||
return sequenceOpen | ||
effects.consume(code); | ||
return sequenceOpen; | ||
} | ||
@@ -138,6 +121,6 @@ | ||
if (code === null || markdownLineEndingOrSpace(code)) { | ||
effects.exit('atxHeadingSequence') | ||
return atBreak(code) | ||
effects.exit("atxHeadingSequence"); | ||
return atBreak(code); | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -157,14 +140,14 @@ | ||
if (code === 35) { | ||
effects.enter('atxHeadingSequence') | ||
return sequenceFurther(code) | ||
effects.enter("atxHeadingSequence"); | ||
return sequenceFurther(code); | ||
} | ||
if (code === null || markdownLineEnding(code)) { | ||
effects.exit('atxHeading') | ||
effects.exit("atxHeading"); | ||
// To do: interrupt like `markdown-rs`. | ||
// // Feel free to interrupt. | ||
// tokenizer.interrupt = false | ||
return ok(code) | ||
return ok(code); | ||
} | ||
if (markdownSpace(code)) { | ||
return factorySpace(effects, atBreak, 'whitespace')(code) | ||
return factorySpace(effects, atBreak, "whitespace")(code); | ||
} | ||
@@ -174,4 +157,4 @@ | ||
// Needs edit map, see: `markdown.rs`. | ||
effects.enter('atxHeadingText') | ||
return data(code) | ||
effects.enter("atxHeadingText"); | ||
return data(code); | ||
} | ||
@@ -193,7 +176,7 @@ | ||
if (code === 35) { | ||
effects.consume(code) | ||
return sequenceFurther | ||
effects.consume(code); | ||
return sequenceFurther; | ||
} | ||
effects.exit('atxHeadingSequence') | ||
return atBreak(code) | ||
effects.exit("atxHeadingSequence"); | ||
return atBreak(code); | ||
} | ||
@@ -213,8 +196,8 @@ | ||
if (code === null || code === 35 || markdownLineEndingOrSpace(code)) { | ||
effects.exit('atxHeadingText') | ||
return atBreak(code) | ||
effects.exit("atxHeadingText"); | ||
return atBreak(code); | ||
} | ||
effects.consume(code) | ||
return data | ||
effects.consume(code); | ||
return data; | ||
} | ||
} | ||
} |
/** @type {Construct} */ | ||
export const htmlFlow: Construct | ||
export type Code = import('micromark-util-types').Code | ||
export type Construct = import('micromark-util-types').Construct | ||
export type Resolver = import('micromark-util-types').Resolver | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const htmlFlow: Construct; | ||
export type Code = import('micromark-util-types').Code; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type Resolver = import('micromark-util-types').Resolver; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=html-flow.d.ts.map |
@@ -10,11 +10,5 @@ /** | ||
import { | ||
asciiAlpha, | ||
asciiAlphanumeric, | ||
markdownLineEnding, | ||
markdownLineEndingOrSpace, | ||
markdownSpace | ||
} from 'micromark-util-character' | ||
import {htmlBlockNames, htmlRawNames} from 'micromark-util-html-tag-name' | ||
import {blankLine} from './blank-line.js' | ||
import { asciiAlpha, asciiAlphanumeric, markdownLineEnding, markdownLineEndingOrSpace, markdownSpace } from 'micromark-util-character'; | ||
import { htmlBlockNames, htmlRawNames } from 'micromark-util-html-tag-name'; | ||
import { blankLine } from './blank-line.js'; | ||
@@ -27,3 +21,3 @@ /** @type {Construct} */ | ||
concrete: true | ||
} | ||
}; | ||
@@ -34,25 +28,25 @@ /** @type {Construct} */ | ||
partial: true | ||
} | ||
}; | ||
const nonLazyContinuationStart = { | ||
tokenize: tokenizeNonLazyContinuationStart, | ||
partial: true | ||
} | ||
}; | ||
/** @type {Resolver} */ | ||
function resolveToHtmlFlow(events) { | ||
let index = events.length | ||
let index = events.length; | ||
while (index--) { | ||
if (events[index][0] === 'enter' && events[index][1].type === 'htmlFlow') { | ||
break | ||
if (events[index][0] === 'enter' && events[index][1].type === "htmlFlow") { | ||
break; | ||
} | ||
} | ||
if (index > 1 && events[index - 2][1].type === 'linePrefix') { | ||
if (index > 1 && events[index - 2][1].type === "linePrefix") { | ||
// Add the prefix start to the HTML token. | ||
events[index][1].start = events[index - 2][1].start | ||
events[index][1].start = events[index - 2][1].start; | ||
// Add the prefix start to the HTML line token. | ||
events[index + 1][1].start = events[index - 2][1].start | ||
events[index + 1][1].start = events[index - 2][1].start; | ||
// Remove the line prefix. | ||
events.splice(index - 2, 2) | ||
events.splice(index - 2, 2); | ||
} | ||
return events | ||
return events; | ||
} | ||
@@ -65,14 +59,14 @@ | ||
function tokenizeHtmlFlow(effects, ok, nok) { | ||
const self = this | ||
const self = this; | ||
/** @type {number} */ | ||
let marker | ||
let marker; | ||
/** @type {boolean} */ | ||
let closingTag | ||
let closingTag; | ||
/** @type {string} */ | ||
let buffer | ||
let buffer; | ||
/** @type {number} */ | ||
let index | ||
let index; | ||
/** @type {Code} */ | ||
let markerB | ||
return start | ||
let markerB; | ||
return start; | ||
@@ -91,3 +85,3 @@ /** | ||
// To do: parse indent like `markdown-rs`. | ||
return before(code) | ||
return before(code); | ||
} | ||
@@ -106,6 +100,6 @@ | ||
function before(code) { | ||
effects.enter('htmlFlow') | ||
effects.enter('htmlFlowData') | ||
effects.consume(code) | ||
return open | ||
effects.enter("htmlFlow"); | ||
effects.enter("htmlFlowData"); | ||
effects.consume(code); | ||
return open; | ||
} | ||
@@ -129,13 +123,13 @@ | ||
if (code === 33) { | ||
effects.consume(code) | ||
return declarationOpen | ||
effects.consume(code); | ||
return declarationOpen; | ||
} | ||
if (code === 47) { | ||
effects.consume(code) | ||
closingTag = true | ||
return tagCloseStart | ||
effects.consume(code); | ||
closingTag = true; | ||
return tagCloseStart; | ||
} | ||
if (code === 63) { | ||
effects.consume(code) | ||
marker = 3 | ||
effects.consume(code); | ||
marker = 3; | ||
// To do: | ||
@@ -146,3 +140,3 @@ // tokenizer.concrete = true | ||
// right now, so we do need to search for `>`, similar to declarations. | ||
return self.interrupt ? ok : continuationDeclarationInside | ||
return self.interrupt ? ok : continuationDeclarationInside; | ||
} | ||
@@ -152,8 +146,8 @@ | ||
if (asciiAlpha(code)) { | ||
effects.consume(code) | ||
effects.consume(code); | ||
// @ts-expect-error: not null. | ||
buffer = String.fromCharCode(code) | ||
return tagName | ||
buffer = String.fromCharCode(code); | ||
return tagName; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -177,11 +171,11 @@ | ||
if (code === 45) { | ||
effects.consume(code) | ||
marker = 2 | ||
return commentOpenInside | ||
effects.consume(code); | ||
marker = 2; | ||
return commentOpenInside; | ||
} | ||
if (code === 91) { | ||
effects.consume(code) | ||
marker = 5 | ||
index = 0 | ||
return cdataOpenInside | ||
effects.consume(code); | ||
marker = 5; | ||
index = 0; | ||
return cdataOpenInside; | ||
} | ||
@@ -191,9 +185,9 @@ | ||
if (asciiAlpha(code)) { | ||
effects.consume(code) | ||
marker = 4 | ||
effects.consume(code); | ||
marker = 4; | ||
// // Do not form containers. | ||
// tokenizer.concrete = true | ||
return self.interrupt ? ok : continuationDeclarationInside | ||
return self.interrupt ? ok : continuationDeclarationInside; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -213,8 +207,8 @@ | ||
if (code === 45) { | ||
effects.consume(code) | ||
effects.consume(code); | ||
// // Do not form containers. | ||
// tokenizer.concrete = true | ||
return self.interrupt ? ok : continuationDeclarationInside | ||
return self.interrupt ? ok : continuationDeclarationInside; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -233,13 +227,13 @@ | ||
function cdataOpenInside(code) { | ||
const value = 'CDATA[' | ||
const value = "CDATA["; | ||
if (code === value.charCodeAt(index++)) { | ||
effects.consume(code) | ||
effects.consume(code); | ||
if (index === value.length) { | ||
// // Do not form containers. | ||
// tokenizer.concrete = true | ||
return self.interrupt ? ok : continuation | ||
return self.interrupt ? ok : continuation; | ||
} | ||
return cdataOpenInside | ||
return cdataOpenInside; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -259,8 +253,8 @@ | ||
if (asciiAlpha(code)) { | ||
effects.consume(code) | ||
effects.consume(code); | ||
// @ts-expect-error: not null. | ||
buffer = String.fromCharCode(code) | ||
return tagName | ||
buffer = String.fromCharCode(code); | ||
return tagName; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -281,21 +275,16 @@ | ||
function tagName(code) { | ||
if ( | ||
code === null || | ||
code === 47 || | ||
code === 62 || | ||
markdownLineEndingOrSpace(code) | ||
) { | ||
const slash = code === 47 | ||
const name = buffer.toLowerCase() | ||
if (code === null || code === 47 || code === 62 || markdownLineEndingOrSpace(code)) { | ||
const slash = code === 47; | ||
const name = buffer.toLowerCase(); | ||
if (!slash && !closingTag && htmlRawNames.includes(name)) { | ||
marker = 1 | ||
marker = 1; | ||
// // Do not form containers. | ||
// tokenizer.concrete = true | ||
return self.interrupt ? ok(code) : continuation(code) | ||
return self.interrupt ? ok(code) : continuation(code); | ||
} | ||
if (htmlBlockNames.includes(buffer.toLowerCase())) { | ||
marker = 6 | ||
marker = 6; | ||
if (slash) { | ||
effects.consume(code) | ||
return basicSelfClosing | ||
effects.consume(code); | ||
return basicSelfClosing; | ||
} | ||
@@ -305,11 +294,7 @@ | ||
// tokenizer.concrete = true | ||
return self.interrupt ? ok(code) : continuation(code) | ||
return self.interrupt ? ok(code) : continuation(code); | ||
} | ||
marker = 7 | ||
marker = 7; | ||
// Do not support complete HTML when interrupting. | ||
return self.interrupt && !self.parser.lazy[self.now().line] | ||
? nok(code) | ||
: closingTag | ||
? completeClosingTagAfter(code) | ||
: completeAttributeNameBefore(code) | ||
return self.interrupt && !self.parser.lazy[self.now().line] ? nok(code) : closingTag ? completeClosingTagAfter(code) : completeAttributeNameBefore(code); | ||
} | ||
@@ -319,7 +304,7 @@ | ||
if (code === 45 || asciiAlphanumeric(code)) { | ||
effects.consume(code) | ||
buffer += String.fromCharCode(code) | ||
return tagName | ||
effects.consume(code); | ||
buffer += String.fromCharCode(code); | ||
return tagName; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -339,8 +324,8 @@ | ||
if (code === 62) { | ||
effects.consume(code) | ||
effects.consume(code); | ||
// // Do not form containers. | ||
// tokenizer.concrete = true | ||
return self.interrupt ? ok : continuation | ||
return self.interrupt ? ok : continuation; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -360,6 +345,6 @@ | ||
if (markdownSpace(code)) { | ||
effects.consume(code) | ||
return completeClosingTagAfter | ||
effects.consume(code); | ||
return completeClosingTagAfter; | ||
} | ||
return completeEnd(code) | ||
return completeEnd(code); | ||
} | ||
@@ -392,4 +377,4 @@ | ||
if (code === 47) { | ||
effects.consume(code) | ||
return completeEnd | ||
effects.consume(code); | ||
return completeEnd; | ||
} | ||
@@ -399,10 +384,10 @@ | ||
if (code === 58 || code === 95 || asciiAlpha(code)) { | ||
effects.consume(code) | ||
return completeAttributeName | ||
effects.consume(code); | ||
return completeAttributeName; | ||
} | ||
if (markdownSpace(code)) { | ||
effects.consume(code) | ||
return completeAttributeNameBefore | ||
effects.consume(code); | ||
return completeAttributeNameBefore; | ||
} | ||
return completeEnd(code) | ||
return completeEnd(code); | ||
} | ||
@@ -426,13 +411,7 @@ | ||
// ASCII alphanumerical and `-`, `.`, `:`, and `_`. | ||
if ( | ||
code === 45 || | ||
code === 46 || | ||
code === 58 || | ||
code === 95 || | ||
asciiAlphanumeric(code) | ||
) { | ||
effects.consume(code) | ||
return completeAttributeName | ||
if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) { | ||
effects.consume(code); | ||
return completeAttributeName; | ||
} | ||
return completeAttributeNameAfter(code) | ||
return completeAttributeNameAfter(code); | ||
} | ||
@@ -455,10 +434,10 @@ | ||
if (code === 61) { | ||
effects.consume(code) | ||
return completeAttributeValueBefore | ||
effects.consume(code); | ||
return completeAttributeValueBefore; | ||
} | ||
if (markdownSpace(code)) { | ||
effects.consume(code) | ||
return completeAttributeNameAfter | ||
effects.consume(code); | ||
return completeAttributeNameAfter; | ||
} | ||
return completeAttributeNameBefore(code) | ||
return completeAttributeNameBefore(code); | ||
} | ||
@@ -480,21 +459,15 @@ | ||
function completeAttributeValueBefore(code) { | ||
if ( | ||
code === null || | ||
code === 60 || | ||
code === 61 || | ||
code === 62 || | ||
code === 96 | ||
) { | ||
return nok(code) | ||
if (code === null || code === 60 || code === 61 || code === 62 || code === 96) { | ||
return nok(code); | ||
} | ||
if (code === 34 || code === 39) { | ||
effects.consume(code) | ||
markerB = code | ||
return completeAttributeValueQuoted | ||
effects.consume(code); | ||
markerB = code; | ||
return completeAttributeValueQuoted; | ||
} | ||
if (markdownSpace(code)) { | ||
effects.consume(code) | ||
return completeAttributeValueBefore | ||
effects.consume(code); | ||
return completeAttributeValueBefore; | ||
} | ||
return completeAttributeValueUnquoted(code) | ||
return completeAttributeValueUnquoted(code); | ||
} | ||
@@ -516,11 +489,11 @@ | ||
if (code === markerB) { | ||
effects.consume(code) | ||
markerB = null | ||
return completeAttributeValueQuotedAfter | ||
effects.consume(code); | ||
markerB = null; | ||
return completeAttributeValueQuotedAfter; | ||
} | ||
if (code === null || markdownLineEnding(code)) { | ||
return nok(code) | ||
return nok(code); | ||
} | ||
effects.consume(code) | ||
return completeAttributeValueQuoted | ||
effects.consume(code); | ||
return completeAttributeValueQuoted; | ||
} | ||
@@ -539,17 +512,7 @@ | ||
function completeAttributeValueUnquoted(code) { | ||
if ( | ||
code === null || | ||
code === 34 || | ||
code === 39 || | ||
code === 47 || | ||
code === 60 || | ||
code === 61 || | ||
code === 62 || | ||
code === 96 || | ||
markdownLineEndingOrSpace(code) | ||
) { | ||
return completeAttributeNameAfter(code) | ||
if (code === null || code === 34 || code === 39 || code === 47 || code === 60 || code === 61 || code === 62 || code === 96 || markdownLineEndingOrSpace(code)) { | ||
return completeAttributeNameAfter(code); | ||
} | ||
effects.consume(code) | ||
return completeAttributeValueUnquoted | ||
effects.consume(code); | ||
return completeAttributeValueUnquoted; | ||
} | ||
@@ -570,5 +533,5 @@ | ||
if (code === 47 || code === 62 || markdownSpace(code)) { | ||
return completeAttributeNameBefore(code) | ||
return completeAttributeNameBefore(code); | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -588,6 +551,6 @@ | ||
if (code === 62) { | ||
effects.consume(code) | ||
return completeAfter | ||
effects.consume(code); | ||
return completeAfter; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -609,9 +572,9 @@ | ||
// tokenizer.concrete = true | ||
return continuation(code) | ||
return continuation(code); | ||
} | ||
if (markdownSpace(code)) { | ||
effects.consume(code) | ||
return completeAfter | ||
effects.consume(code); | ||
return completeAfter; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -631,35 +594,31 @@ | ||
if (code === 45 && marker === 2) { | ||
effects.consume(code) | ||
return continuationCommentInside | ||
effects.consume(code); | ||
return continuationCommentInside; | ||
} | ||
if (code === 60 && marker === 1) { | ||
effects.consume(code) | ||
return continuationRawTagOpen | ||
effects.consume(code); | ||
return continuationRawTagOpen; | ||
} | ||
if (code === 62 && marker === 4) { | ||
effects.consume(code) | ||
return continuationClose | ||
effects.consume(code); | ||
return continuationClose; | ||
} | ||
if (code === 63 && marker === 3) { | ||
effects.consume(code) | ||
return continuationDeclarationInside | ||
effects.consume(code); | ||
return continuationDeclarationInside; | ||
} | ||
if (code === 93 && marker === 5) { | ||
effects.consume(code) | ||
return continuationCdataInside | ||
effects.consume(code); | ||
return continuationCdataInside; | ||
} | ||
if (markdownLineEnding(code) && (marker === 6 || marker === 7)) { | ||
effects.exit('htmlFlowData') | ||
return effects.check( | ||
blankLineBefore, | ||
continuationAfter, | ||
continuationStart | ||
)(code) | ||
effects.exit("htmlFlowData"); | ||
return effects.check(blankLineBefore, continuationAfter, continuationStart)(code); | ||
} | ||
if (code === null || markdownLineEnding(code)) { | ||
effects.exit('htmlFlowData') | ||
return continuationStart(code) | ||
effects.exit("htmlFlowData"); | ||
return continuationStart(code); | ||
} | ||
effects.consume(code) | ||
return continuation | ||
effects.consume(code); | ||
return continuation; | ||
} | ||
@@ -679,7 +638,3 @@ | ||
function continuationStart(code) { | ||
return effects.check( | ||
nonLazyContinuationStart, | ||
continuationStartNonLazy, | ||
continuationAfter | ||
)(code) | ||
return effects.check(nonLazyContinuationStart, continuationStartNonLazy, continuationAfter)(code); | ||
} | ||
@@ -699,6 +654,6 @@ | ||
function continuationStartNonLazy(code) { | ||
effects.enter('lineEnding') | ||
effects.consume(code) | ||
effects.exit('lineEnding') | ||
return continuationBefore | ||
effects.enter("lineEnding"); | ||
effects.consume(code); | ||
effects.exit("lineEnding"); | ||
return continuationBefore; | ||
} | ||
@@ -719,6 +674,6 @@ | ||
if (code === null || markdownLineEnding(code)) { | ||
return continuationStart(code) | ||
return continuationStart(code); | ||
} | ||
effects.enter('htmlFlowData') | ||
return continuation(code) | ||
effects.enter("htmlFlowData"); | ||
return continuation(code); | ||
} | ||
@@ -738,6 +693,6 @@ | ||
if (code === 45) { | ||
effects.consume(code) | ||
return continuationDeclarationInside | ||
effects.consume(code); | ||
return continuationDeclarationInside; | ||
} | ||
return continuation(code) | ||
return continuation(code); | ||
} | ||
@@ -757,7 +712,7 @@ | ||
if (code === 47) { | ||
effects.consume(code) | ||
buffer = '' | ||
return continuationRawEndTag | ||
effects.consume(code); | ||
buffer = ''; | ||
return continuationRawEndTag; | ||
} | ||
return continuation(code) | ||
return continuation(code); | ||
} | ||
@@ -777,16 +732,16 @@ | ||
if (code === 62) { | ||
const name = buffer.toLowerCase() | ||
const name = buffer.toLowerCase(); | ||
if (htmlRawNames.includes(name)) { | ||
effects.consume(code) | ||
return continuationClose | ||
effects.consume(code); | ||
return continuationClose; | ||
} | ||
return continuation(code) | ||
return continuation(code); | ||
} | ||
if (asciiAlpha(code) && buffer.length < 8) { | ||
effects.consume(code) | ||
effects.consume(code); | ||
// @ts-expect-error: not null. | ||
buffer += String.fromCharCode(code) | ||
return continuationRawEndTag | ||
buffer += String.fromCharCode(code); | ||
return continuationRawEndTag; | ||
} | ||
return continuation(code) | ||
return continuation(code); | ||
} | ||
@@ -806,6 +761,6 @@ | ||
if (code === 93) { | ||
effects.consume(code) | ||
return continuationDeclarationInside | ||
effects.consume(code); | ||
return continuationDeclarationInside; | ||
} | ||
return continuation(code) | ||
return continuation(code); | ||
} | ||
@@ -833,4 +788,4 @@ | ||
if (code === 62) { | ||
effects.consume(code) | ||
return continuationClose | ||
effects.consume(code); | ||
return continuationClose; | ||
} | ||
@@ -840,6 +795,6 @@ | ||
if (code === 45 && marker === 2) { | ||
effects.consume(code) | ||
return continuationDeclarationInside | ||
effects.consume(code); | ||
return continuationDeclarationInside; | ||
} | ||
return continuation(code) | ||
return continuation(code); | ||
} | ||
@@ -859,7 +814,7 @@ | ||
if (code === null || markdownLineEnding(code)) { | ||
effects.exit('htmlFlowData') | ||
return continuationAfter(code) | ||
effects.exit("htmlFlowData"); | ||
return continuationAfter(code); | ||
} | ||
effects.consume(code) | ||
return continuationClose | ||
effects.consume(code); | ||
return continuationClose; | ||
} | ||
@@ -878,3 +833,3 @@ | ||
function continuationAfter(code) { | ||
effects.exit('htmlFlow') | ||
effects.exit("htmlFlow"); | ||
// // Feel free to interrupt. | ||
@@ -884,3 +839,3 @@ // tokenizer.interrupt = false | ||
// tokenizer.concrete = false | ||
return ok(code) | ||
return ok(code); | ||
} | ||
@@ -894,4 +849,4 @@ } | ||
function tokenizeNonLazyContinuationStart(effects, ok, nok) { | ||
const self = this | ||
return start | ||
const self = this; | ||
return start; | ||
@@ -911,8 +866,8 @@ /** | ||
if (markdownLineEnding(code)) { | ||
effects.enter('lineEnding') | ||
effects.consume(code) | ||
effects.exit('lineEnding') | ||
return after | ||
effects.enter("lineEnding"); | ||
effects.consume(code); | ||
effects.exit("lineEnding"); | ||
return after; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -932,3 +887,3 @@ | ||
function after(code) { | ||
return self.parser.lazy[self.now().line] ? nok(code) : ok(code) | ||
return self.parser.lazy[self.now().line] ? nok(code) : ok(code); | ||
} | ||
@@ -942,3 +897,3 @@ } | ||
function tokenizeBlankLineBefore(effects, ok, nok) { | ||
return start | ||
return start; | ||
@@ -957,7 +912,7 @@ /** | ||
function start(code) { | ||
effects.enter('lineEnding') | ||
effects.consume(code) | ||
effects.exit('lineEnding') | ||
return effects.attempt(blankLine, ok, nok) | ||
effects.enter("lineEnding"); | ||
effects.consume(code); | ||
effects.exit("lineEnding"); | ||
return effects.attempt(blankLine, ok, nok); | ||
} | ||
} | ||
} |
/** @type {Construct} */ | ||
export const htmlText: Construct | ||
export type Code = import('micromark-util-types').Code | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const htmlText: Construct; | ||
export type Code = import('micromark-util-types').Code; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=html-text.d.ts.map |
@@ -9,10 +9,4 @@ /** | ||
import {factorySpace} from 'micromark-factory-space' | ||
import { | ||
asciiAlpha, | ||
asciiAlphanumeric, | ||
markdownLineEnding, | ||
markdownLineEndingOrSpace, | ||
markdownSpace | ||
} from 'micromark-util-character' | ||
import { factorySpace } from 'micromark-factory-space'; | ||
import { asciiAlpha, asciiAlphanumeric, markdownLineEnding, markdownLineEndingOrSpace, markdownSpace } from 'micromark-util-character'; | ||
/** @type {Construct} */ | ||
@@ -22,3 +16,3 @@ export const htmlText = { | ||
tokenize: tokenizeHtmlText | ||
} | ||
}; | ||
@@ -30,10 +24,10 @@ /** | ||
function tokenizeHtmlText(effects, ok, nok) { | ||
const self = this | ||
const self = this; | ||
/** @type {NonNullable<Code> | undefined} */ | ||
let marker | ||
let marker; | ||
/** @type {number} */ | ||
let index | ||
let index; | ||
/** @type {State} */ | ||
let returnState | ||
return start | ||
let returnState; | ||
return start; | ||
@@ -51,6 +45,6 @@ /** | ||
function start(code) { | ||
effects.enter('htmlText') | ||
effects.enter('htmlTextData') | ||
effects.consume(code) | ||
return open | ||
effects.enter("htmlText"); | ||
effects.enter("htmlTextData"); | ||
effects.consume(code); | ||
return open; | ||
} | ||
@@ -74,12 +68,12 @@ | ||
if (code === 33) { | ||
effects.consume(code) | ||
return declarationOpen | ||
effects.consume(code); | ||
return declarationOpen; | ||
} | ||
if (code === 47) { | ||
effects.consume(code) | ||
return tagCloseStart | ||
effects.consume(code); | ||
return tagCloseStart; | ||
} | ||
if (code === 63) { | ||
effects.consume(code) | ||
return instruction | ||
effects.consume(code); | ||
return instruction; | ||
} | ||
@@ -89,6 +83,6 @@ | ||
if (asciiAlpha(code)) { | ||
effects.consume(code) | ||
return tagOpen | ||
effects.consume(code); | ||
return tagOpen; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -112,15 +106,15 @@ | ||
if (code === 45) { | ||
effects.consume(code) | ||
return commentOpenInside | ||
effects.consume(code); | ||
return commentOpenInside; | ||
} | ||
if (code === 91) { | ||
effects.consume(code) | ||
index = 0 | ||
return cdataOpenInside | ||
effects.consume(code); | ||
index = 0; | ||
return cdataOpenInside; | ||
} | ||
if (asciiAlpha(code)) { | ||
effects.consume(code) | ||
return declaration | ||
effects.consume(code); | ||
return declaration; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -140,6 +134,6 @@ | ||
if (code === 45) { | ||
effects.consume(code) | ||
return commentEnd | ||
effects.consume(code); | ||
return commentEnd; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -159,14 +153,14 @@ | ||
if (code === null) { | ||
return nok(code) | ||
return nok(code); | ||
} | ||
if (code === 45) { | ||
effects.consume(code) | ||
return commentClose | ||
effects.consume(code); | ||
return commentClose; | ||
} | ||
if (markdownLineEnding(code)) { | ||
returnState = comment | ||
return lineEndingBefore(code) | ||
returnState = comment; | ||
return lineEndingBefore(code); | ||
} | ||
effects.consume(code) | ||
return comment | ||
effects.consume(code); | ||
return comment; | ||
} | ||
@@ -186,6 +180,6 @@ | ||
if (code === 45) { | ||
effects.consume(code) | ||
return commentEnd | ||
effects.consume(code); | ||
return commentEnd; | ||
} | ||
return comment(code) | ||
return comment(code); | ||
} | ||
@@ -204,7 +198,3 @@ | ||
function commentEnd(code) { | ||
return code === 62 | ||
? end(code) | ||
: code === 45 | ||
? commentClose(code) | ||
: comment(code) | ||
return code === 62 ? end(code) : code === 45 ? commentClose(code) : comment(code); | ||
} | ||
@@ -223,8 +213,8 @@ | ||
function cdataOpenInside(code) { | ||
const value = 'CDATA[' | ||
const value = "CDATA["; | ||
if (code === value.charCodeAt(index++)) { | ||
effects.consume(code) | ||
return index === value.length ? cdata : cdataOpenInside | ||
effects.consume(code); | ||
return index === value.length ? cdata : cdataOpenInside; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -244,14 +234,14 @@ | ||
if (code === null) { | ||
return nok(code) | ||
return nok(code); | ||
} | ||
if (code === 93) { | ||
effects.consume(code) | ||
return cdataClose | ||
effects.consume(code); | ||
return cdataClose; | ||
} | ||
if (markdownLineEnding(code)) { | ||
returnState = cdata | ||
return lineEndingBefore(code) | ||
returnState = cdata; | ||
return lineEndingBefore(code); | ||
} | ||
effects.consume(code) | ||
return cdata | ||
effects.consume(code); | ||
return cdata; | ||
} | ||
@@ -271,6 +261,6 @@ | ||
if (code === 93) { | ||
effects.consume(code) | ||
return cdataEnd | ||
effects.consume(code); | ||
return cdataEnd; | ||
} | ||
return cdata(code) | ||
return cdata(code); | ||
} | ||
@@ -290,9 +280,9 @@ | ||
if (code === 62) { | ||
return end(code) | ||
return end(code); | ||
} | ||
if (code === 93) { | ||
effects.consume(code) | ||
return cdataEnd | ||
effects.consume(code); | ||
return cdataEnd; | ||
} | ||
return cdata(code) | ||
return cdata(code); | ||
} | ||
@@ -312,10 +302,10 @@ | ||
if (code === null || code === 62) { | ||
return end(code) | ||
return end(code); | ||
} | ||
if (markdownLineEnding(code)) { | ||
returnState = declaration | ||
return lineEndingBefore(code) | ||
returnState = declaration; | ||
return lineEndingBefore(code); | ||
} | ||
effects.consume(code) | ||
return declaration | ||
effects.consume(code); | ||
return declaration; | ||
} | ||
@@ -335,14 +325,14 @@ | ||
if (code === null) { | ||
return nok(code) | ||
return nok(code); | ||
} | ||
if (code === 63) { | ||
effects.consume(code) | ||
return instructionClose | ||
effects.consume(code); | ||
return instructionClose; | ||
} | ||
if (markdownLineEnding(code)) { | ||
returnState = instruction | ||
return lineEndingBefore(code) | ||
returnState = instruction; | ||
return lineEndingBefore(code); | ||
} | ||
effects.consume(code) | ||
return instruction | ||
effects.consume(code); | ||
return instruction; | ||
} | ||
@@ -361,3 +351,3 @@ | ||
function instructionClose(code) { | ||
return code === 62 ? end(code) : instruction(code) | ||
return code === 62 ? end(code) : instruction(code); | ||
} | ||
@@ -378,6 +368,6 @@ | ||
if (asciiAlpha(code)) { | ||
effects.consume(code) | ||
return tagClose | ||
effects.consume(code); | ||
return tagClose; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -398,6 +388,6 @@ | ||
if (code === 45 || asciiAlphanumeric(code)) { | ||
effects.consume(code) | ||
return tagClose | ||
effects.consume(code); | ||
return tagClose; | ||
} | ||
return tagCloseBetween(code) | ||
return tagCloseBetween(code); | ||
} | ||
@@ -417,10 +407,10 @@ | ||
if (markdownLineEnding(code)) { | ||
returnState = tagCloseBetween | ||
return lineEndingBefore(code) | ||
returnState = tagCloseBetween; | ||
return lineEndingBefore(code); | ||
} | ||
if (markdownSpace(code)) { | ||
effects.consume(code) | ||
return tagCloseBetween | ||
effects.consume(code); | ||
return tagCloseBetween; | ||
} | ||
return end(code) | ||
return end(code); | ||
} | ||
@@ -441,9 +431,9 @@ | ||
if (code === 45 || asciiAlphanumeric(code)) { | ||
effects.consume(code) | ||
return tagOpen | ||
effects.consume(code); | ||
return tagOpen; | ||
} | ||
if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) { | ||
return tagOpenBetween(code) | ||
return tagOpenBetween(code); | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -463,4 +453,4 @@ | ||
if (code === 47) { | ||
effects.consume(code) | ||
return end | ||
effects.consume(code); | ||
return end; | ||
} | ||
@@ -470,14 +460,14 @@ | ||
if (code === 58 || code === 95 || asciiAlpha(code)) { | ||
effects.consume(code) | ||
return tagOpenAttributeName | ||
effects.consume(code); | ||
return tagOpenAttributeName; | ||
} | ||
if (markdownLineEnding(code)) { | ||
returnState = tagOpenBetween | ||
return lineEndingBefore(code) | ||
returnState = tagOpenBetween; | ||
return lineEndingBefore(code); | ||
} | ||
if (markdownSpace(code)) { | ||
effects.consume(code) | ||
return tagOpenBetween | ||
effects.consume(code); | ||
return tagOpenBetween; | ||
} | ||
return end(code) | ||
return end(code); | ||
} | ||
@@ -497,13 +487,7 @@ | ||
// ASCII alphabetical and `-`, `.`, `:`, and `_`. | ||
if ( | ||
code === 45 || | ||
code === 46 || | ||
code === 58 || | ||
code === 95 || | ||
asciiAlphanumeric(code) | ||
) { | ||
effects.consume(code) | ||
return tagOpenAttributeName | ||
if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) { | ||
effects.consume(code); | ||
return tagOpenAttributeName; | ||
} | ||
return tagOpenAttributeNameAfter(code) | ||
return tagOpenAttributeNameAfter(code); | ||
} | ||
@@ -524,14 +508,14 @@ | ||
if (code === 61) { | ||
effects.consume(code) | ||
return tagOpenAttributeValueBefore | ||
effects.consume(code); | ||
return tagOpenAttributeValueBefore; | ||
} | ||
if (markdownLineEnding(code)) { | ||
returnState = tagOpenAttributeNameAfter | ||
return lineEndingBefore(code) | ||
returnState = tagOpenAttributeNameAfter; | ||
return lineEndingBefore(code); | ||
} | ||
if (markdownSpace(code)) { | ||
effects.consume(code) | ||
return tagOpenAttributeNameAfter | ||
effects.consume(code); | ||
return tagOpenAttributeNameAfter; | ||
} | ||
return tagOpenBetween(code) | ||
return tagOpenBetween(code); | ||
} | ||
@@ -551,26 +535,20 @@ | ||
function tagOpenAttributeValueBefore(code) { | ||
if ( | ||
code === null || | ||
code === 60 || | ||
code === 61 || | ||
code === 62 || | ||
code === 96 | ||
) { | ||
return nok(code) | ||
if (code === null || code === 60 || code === 61 || code === 62 || code === 96) { | ||
return nok(code); | ||
} | ||
if (code === 34 || code === 39) { | ||
effects.consume(code) | ||
marker = code | ||
return tagOpenAttributeValueQuoted | ||
effects.consume(code); | ||
marker = code; | ||
return tagOpenAttributeValueQuoted; | ||
} | ||
if (markdownLineEnding(code)) { | ||
returnState = tagOpenAttributeValueBefore | ||
return lineEndingBefore(code) | ||
returnState = tagOpenAttributeValueBefore; | ||
return lineEndingBefore(code); | ||
} | ||
if (markdownSpace(code)) { | ||
effects.consume(code) | ||
return tagOpenAttributeValueBefore | ||
effects.consume(code); | ||
return tagOpenAttributeValueBefore; | ||
} | ||
effects.consume(code) | ||
return tagOpenAttributeValueUnquoted | ||
effects.consume(code); | ||
return tagOpenAttributeValueUnquoted; | ||
} | ||
@@ -590,15 +568,15 @@ | ||
if (code === marker) { | ||
effects.consume(code) | ||
marker = undefined | ||
return tagOpenAttributeValueQuotedAfter | ||
effects.consume(code); | ||
marker = undefined; | ||
return tagOpenAttributeValueQuotedAfter; | ||
} | ||
if (code === null) { | ||
return nok(code) | ||
return nok(code); | ||
} | ||
if (markdownLineEnding(code)) { | ||
returnState = tagOpenAttributeValueQuoted | ||
return lineEndingBefore(code) | ||
returnState = tagOpenAttributeValueQuoted; | ||
return lineEndingBefore(code); | ||
} | ||
effects.consume(code) | ||
return tagOpenAttributeValueQuoted | ||
effects.consume(code); | ||
return tagOpenAttributeValueQuoted; | ||
} | ||
@@ -617,17 +595,10 @@ | ||
function tagOpenAttributeValueUnquoted(code) { | ||
if ( | ||
code === null || | ||
code === 34 || | ||
code === 39 || | ||
code === 60 || | ||
code === 61 || | ||
code === 96 | ||
) { | ||
return nok(code) | ||
if (code === null || code === 34 || code === 39 || code === 60 || code === 61 || code === 96) { | ||
return nok(code); | ||
} | ||
if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) { | ||
return tagOpenBetween(code) | ||
return tagOpenBetween(code); | ||
} | ||
effects.consume(code) | ||
return tagOpenAttributeValueUnquoted | ||
effects.consume(code); | ||
return tagOpenAttributeValueUnquoted; | ||
} | ||
@@ -648,5 +619,5 @@ | ||
if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) { | ||
return tagOpenBetween(code) | ||
return tagOpenBetween(code); | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -666,8 +637,8 @@ | ||
if (code === 62) { | ||
effects.consume(code) | ||
effects.exit('htmlTextData') | ||
effects.exit('htmlText') | ||
return ok | ||
effects.consume(code); | ||
effects.exit("htmlTextData"); | ||
effects.exit("htmlText"); | ||
return ok; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -690,7 +661,7 @@ | ||
function lineEndingBefore(code) { | ||
effects.exit('htmlTextData') | ||
effects.enter('lineEnding') | ||
effects.consume(code) | ||
effects.exit('lineEnding') | ||
return lineEndingAfter | ||
effects.exit("htmlTextData"); | ||
effects.enter("lineEnding"); | ||
effects.consume(code); | ||
effects.exit("lineEnding"); | ||
return lineEndingAfter; | ||
} | ||
@@ -715,12 +686,3 @@ | ||
return markdownSpace(code) | ||
? factorySpace( | ||
effects, | ||
lineEndingAfterPrefix, | ||
'linePrefix', | ||
self.parser.constructs.disable.null.includes('codeIndented') | ||
? undefined | ||
: 4 | ||
)(code) | ||
: lineEndingAfterPrefix(code) | ||
return markdownSpace(code) ? factorySpace(effects, lineEndingAfterPrefix, "linePrefix", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code) : lineEndingAfterPrefix(code); | ||
} | ||
@@ -743,5 +705,5 @@ | ||
function lineEndingAfterPrefix(code) { | ||
effects.enter('htmlTextData') | ||
return returnState(code) | ||
effects.enter("htmlTextData"); | ||
return returnState(code); | ||
} | ||
} | ||
} |
/** @type {Construct} */ | ||
export const labelEnd: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type Event = import('micromark-util-types').Event | ||
export type Resolver = import('micromark-util-types').Resolver | ||
export type State = import('micromark-util-types').State | ||
export type Token = import('micromark-util-types').Token | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const labelEnd: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type Event = import('micromark-util-types').Event; | ||
export type Resolver = import('micromark-util-types').Resolver; | ||
export type State = import('micromark-util-types').State; | ||
export type Token = import('micromark-util-types').Token; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=label-end.d.ts.map |
@@ -11,10 +11,10 @@ /** | ||
import {factoryDestination} from 'micromark-factory-destination' | ||
import {factoryLabel} from 'micromark-factory-label' | ||
import {factoryTitle} from 'micromark-factory-title' | ||
import {factoryWhitespace} from 'micromark-factory-whitespace' | ||
import {markdownLineEndingOrSpace} from 'micromark-util-character' | ||
import {push, splice} from 'micromark-util-chunked' | ||
import {normalizeIdentifier} from 'micromark-util-normalize-identifier' | ||
import {resolveAll} from 'micromark-util-resolve-all' | ||
import { factoryDestination } from 'micromark-factory-destination'; | ||
import { factoryLabel } from 'micromark-factory-label'; | ||
import { factoryTitle } from 'micromark-factory-title'; | ||
import { factoryWhitespace } from 'micromark-factory-whitespace'; | ||
import { markdownLineEndingOrSpace } from 'micromark-util-character'; | ||
import { push, splice } from 'micromark-util-chunked'; | ||
import { normalizeIdentifier } from 'micromark-util-normalize-identifier'; | ||
import { resolveAll } from 'micromark-util-resolve-all'; | ||
/** @type {Construct} */ | ||
@@ -26,3 +26,3 @@ export const labelEnd = { | ||
resolveAll: resolveAllLabelEnd | ||
} | ||
}; | ||
@@ -32,29 +32,25 @@ /** @type {Construct} */ | ||
tokenize: tokenizeResource | ||
} | ||
}; | ||
/** @type {Construct} */ | ||
const referenceFullConstruct = { | ||
tokenize: tokenizeReferenceFull | ||
} | ||
}; | ||
/** @type {Construct} */ | ||
const referenceCollapsedConstruct = { | ||
tokenize: tokenizeReferenceCollapsed | ||
} | ||
}; | ||
/** @type {Resolver} */ | ||
function resolveAllLabelEnd(events) { | ||
let index = -1 | ||
let index = -1; | ||
while (++index < events.length) { | ||
const token = events[index][1] | ||
if ( | ||
token.type === 'labelImage' || | ||
token.type === 'labelLink' || | ||
token.type === 'labelEnd' | ||
) { | ||
const token = events[index][1]; | ||
if (token.type === "labelImage" || token.type === "labelLink" || token.type === "labelEnd") { | ||
// Remove the marker. | ||
events.splice(index + 1, token.type === 'labelImage' ? 4 : 2) | ||
token.type = 'data' | ||
index++ | ||
events.splice(index + 1, token.type === "labelImage" ? 4 : 2); | ||
token.type = "data"; | ||
index++; | ||
} | ||
} | ||
return events | ||
return events; | ||
} | ||
@@ -64,23 +60,20 @@ | ||
function resolveToLabelEnd(events, context) { | ||
let index = events.length | ||
let offset = 0 | ||
let index = events.length; | ||
let offset = 0; | ||
/** @type {Token} */ | ||
let token | ||
let token; | ||
/** @type {number | undefined} */ | ||
let open | ||
let open; | ||
/** @type {number | undefined} */ | ||
let close | ||
let close; | ||
/** @type {Array<Event>} */ | ||
let media | ||
let media; | ||
// Find an opening. | ||
while (index--) { | ||
token = events[index][1] | ||
token = events[index][1]; | ||
if (open) { | ||
// If we see another link, or inactive link label, we’ve been here before. | ||
if ( | ||
token.type === 'link' || | ||
(token.type === 'labelLink' && token._inactive) | ||
) { | ||
break | ||
if (token.type === "link" || token.type === "labelLink" && token._inactive) { | ||
break; | ||
} | ||
@@ -90,46 +83,39 @@ | ||
// links. | ||
if (events[index][0] === 'enter' && token.type === 'labelLink') { | ||
token._inactive = true | ||
if (events[index][0] === 'enter' && token.type === "labelLink") { | ||
token._inactive = true; | ||
} | ||
} else if (close) { | ||
if ( | ||
events[index][0] === 'enter' && | ||
(token.type === 'labelImage' || token.type === 'labelLink') && | ||
!token._balanced | ||
) { | ||
open = index | ||
if (token.type !== 'labelLink') { | ||
offset = 2 | ||
break | ||
if (events[index][0] === 'enter' && (token.type === "labelImage" || token.type === "labelLink") && !token._balanced) { | ||
open = index; | ||
if (token.type !== "labelLink") { | ||
offset = 2; | ||
break; | ||
} | ||
} | ||
} else if (token.type === 'labelEnd') { | ||
close = index | ||
} else if (token.type === "labelEnd") { | ||
close = index; | ||
} | ||
} | ||
const group = { | ||
type: events[open][1].type === 'labelLink' ? 'link' : 'image', | ||
type: events[open][1].type === "labelLink" ? "link" : "image", | ||
start: Object.assign({}, events[open][1].start), | ||
end: Object.assign({}, events[events.length - 1][1].end) | ||
} | ||
}; | ||
const label = { | ||
type: 'label', | ||
type: "label", | ||
start: Object.assign({}, events[open][1].start), | ||
end: Object.assign({}, events[close][1].end) | ||
} | ||
}; | ||
const text = { | ||
type: 'labelText', | ||
type: "labelText", | ||
start: Object.assign({}, events[open + offset + 2][1].end), | ||
end: Object.assign({}, events[close - 2][1].start) | ||
} | ||
media = [ | ||
['enter', group, context], | ||
['enter', label, context] | ||
] | ||
}; | ||
media = [['enter', group, context], ['enter', label, context]]; | ||
// Opening marker. | ||
media = push(media, events.slice(open + 1, open + offset + 3)) | ||
media = push(media, events.slice(open + 1, open + offset + 3)); | ||
// Text open. | ||
media = push(media, [['enter', text, context]]) | ||
media = push(media, [['enter', text, context]]); | ||
@@ -139,26 +125,14 @@ // Always populated by defaults. | ||
// Between. | ||
media = push( | ||
media, | ||
resolveAll( | ||
context.parser.constructs.insideSpan.null, | ||
events.slice(open + offset + 4, close - 3), | ||
context | ||
) | ||
) | ||
media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + offset + 4, close - 3), context)); | ||
// Text close, marker close, label close. | ||
media = push(media, [ | ||
['exit', text, context], | ||
events[close - 2], | ||
events[close - 1], | ||
['exit', label, context] | ||
]) | ||
media = push(media, [['exit', text, context], events[close - 2], events[close - 1], ['exit', label, context]]); | ||
// Reference, resource, or so. | ||
media = push(media, events.slice(close + 1)) | ||
media = push(media, events.slice(close + 1)); | ||
// Media close. | ||
media = push(media, [['exit', group, context]]) | ||
splice(events, open, events.length, media) | ||
return events | ||
media = push(media, [['exit', group, context]]); | ||
splice(events, open, events.length, media); | ||
return events; | ||
} | ||
@@ -171,21 +145,17 @@ | ||
function tokenizeLabelEnd(effects, ok, nok) { | ||
const self = this | ||
let index = self.events.length | ||
const self = this; | ||
let index = self.events.length; | ||
/** @type {Token} */ | ||
let labelStart | ||
let labelStart; | ||
/** @type {boolean} */ | ||
let defined | ||
let defined; | ||
// Find an opening. | ||
while (index--) { | ||
if ( | ||
(self.events[index][1].type === 'labelImage' || | ||
self.events[index][1].type === 'labelLink') && | ||
!self.events[index][1]._balanced | ||
) { | ||
labelStart = self.events[index][1] | ||
break | ||
if ((self.events[index][1].type === "labelImage" || self.events[index][1].type === "labelLink") && !self.events[index][1]._balanced) { | ||
labelStart = self.events[index][1]; | ||
break; | ||
} | ||
} | ||
return start | ||
return start; | ||
@@ -210,3 +180,3 @@ /** | ||
if (!labelStart) { | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -224,18 +194,14 @@ | ||
if (labelStart._inactive) { | ||
return labelEndNok(code) | ||
return labelEndNok(code); | ||
} | ||
defined = self.parser.defined.includes( | ||
normalizeIdentifier( | ||
self.sliceSerialize({ | ||
start: labelStart.end, | ||
end: self.now() | ||
}) | ||
) | ||
) | ||
effects.enter('labelEnd') | ||
effects.enter('labelMarker') | ||
effects.consume(code) | ||
effects.exit('labelMarker') | ||
effects.exit('labelEnd') | ||
return after | ||
defined = self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize({ | ||
start: labelStart.end, | ||
end: self.now() | ||
}))); | ||
effects.enter("labelEnd"); | ||
effects.enter("labelMarker"); | ||
effects.consume(code); | ||
effects.exit("labelMarker"); | ||
effects.exit("labelEnd"); | ||
return after; | ||
} | ||
@@ -265,7 +231,3 @@ | ||
if (code === 40) { | ||
return effects.attempt( | ||
resourceConstruct, | ||
labelEndOk, | ||
defined ? labelEndOk : labelEndNok | ||
)(code) | ||
return effects.attempt(resourceConstruct, labelEndOk, defined ? labelEndOk : labelEndNok)(code); | ||
} | ||
@@ -275,11 +237,7 @@ | ||
if (code === 91) { | ||
return effects.attempt( | ||
referenceFullConstruct, | ||
labelEndOk, | ||
defined ? referenceNotFull : labelEndNok | ||
)(code) | ||
return effects.attempt(referenceFullConstruct, labelEndOk, defined ? referenceNotFull : labelEndNok)(code); | ||
} | ||
// Shortcut (`[asd]`) reference? | ||
return defined ? labelEndOk(code) : labelEndNok(code) | ||
return defined ? labelEndOk(code) : labelEndNok(code); | ||
} | ||
@@ -302,7 +260,3 @@ | ||
function referenceNotFull(code) { | ||
return effects.attempt( | ||
referenceCollapsedConstruct, | ||
labelEndOk, | ||
labelEndNok | ||
)(code) | ||
return effects.attempt(referenceCollapsedConstruct, labelEndOk, labelEndNok)(code); | ||
} | ||
@@ -328,3 +282,3 @@ | ||
// Note: `markdown-rs` does a bunch of stuff here. | ||
return ok(code) | ||
return ok(code); | ||
} | ||
@@ -349,4 +303,4 @@ | ||
function labelEndNok(code) { | ||
labelStart._balanced = true | ||
return nok(code) | ||
labelStart._balanced = true; | ||
return nok(code); | ||
} | ||
@@ -360,3 +314,3 @@ } | ||
function tokenizeResource(effects, ok, nok) { | ||
return resourceStart | ||
return resourceStart; | ||
@@ -374,7 +328,7 @@ /** | ||
function resourceStart(code) { | ||
effects.enter('resource') | ||
effects.enter('resourceMarker') | ||
effects.consume(code) | ||
effects.exit('resourceMarker') | ||
return resourceBefore | ||
effects.enter("resource"); | ||
effects.enter("resourceMarker"); | ||
effects.consume(code); | ||
effects.exit("resourceMarker"); | ||
return resourceBefore; | ||
} | ||
@@ -393,5 +347,3 @@ | ||
function resourceBefore(code) { | ||
return markdownLineEndingOrSpace(code) | ||
? factoryWhitespace(effects, resourceOpen)(code) | ||
: resourceOpen(code) | ||
return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceOpen)(code) : resourceOpen(code); | ||
} | ||
@@ -411,15 +363,5 @@ | ||
if (code === 41) { | ||
return resourceEnd(code) | ||
return resourceEnd(code); | ||
} | ||
return factoryDestination( | ||
effects, | ||
resourceDestinationAfter, | ||
resourceDestinationMissing, | ||
'resourceDestination', | ||
'resourceDestinationLiteral', | ||
'resourceDestinationLiteralMarker', | ||
'resourceDestinationRaw', | ||
'resourceDestinationString', | ||
32 | ||
)(code) | ||
return factoryDestination(effects, resourceDestinationAfter, resourceDestinationMissing, "resourceDestination", "resourceDestinationLiteral", "resourceDestinationLiteralMarker", "resourceDestinationRaw", "resourceDestinationString", 32)(code); | ||
} | ||
@@ -438,5 +380,3 @@ | ||
function resourceDestinationAfter(code) { | ||
return markdownLineEndingOrSpace(code) | ||
? factoryWhitespace(effects, resourceBetween)(code) | ||
: resourceEnd(code) | ||
return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceBetween)(code) : resourceEnd(code); | ||
} | ||
@@ -455,3 +395,3 @@ | ||
function resourceDestinationMissing(code) { | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -471,12 +411,5 @@ | ||
if (code === 34 || code === 39 || code === 40) { | ||
return factoryTitle( | ||
effects, | ||
resourceTitleAfter, | ||
nok, | ||
'resourceTitle', | ||
'resourceTitleMarker', | ||
'resourceTitleString' | ||
)(code) | ||
return factoryTitle(effects, resourceTitleAfter, nok, "resourceTitle", "resourceTitleMarker", "resourceTitleString")(code); | ||
} | ||
return resourceEnd(code) | ||
return resourceEnd(code); | ||
} | ||
@@ -495,5 +428,3 @@ | ||
function resourceTitleAfter(code) { | ||
return markdownLineEndingOrSpace(code) | ||
? factoryWhitespace(effects, resourceEnd)(code) | ||
: resourceEnd(code) | ||
return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceEnd)(code) : resourceEnd(code); | ||
} | ||
@@ -513,9 +444,9 @@ | ||
if (code === 41) { | ||
effects.enter('resourceMarker') | ||
effects.consume(code) | ||
effects.exit('resourceMarker') | ||
effects.exit('resource') | ||
return ok | ||
effects.enter("resourceMarker"); | ||
effects.consume(code); | ||
effects.exit("resourceMarker"); | ||
effects.exit("resource"); | ||
return ok; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -529,4 +460,4 @@ } | ||
function tokenizeReferenceFull(effects, ok, nok) { | ||
const self = this | ||
return referenceFull | ||
const self = this; | ||
return referenceFull; | ||
@@ -544,11 +475,3 @@ /** | ||
function referenceFull(code) { | ||
return factoryLabel.call( | ||
self, | ||
effects, | ||
referenceFullAfter, | ||
referenceFullMissing, | ||
'reference', | ||
'referenceMarker', | ||
'referenceString' | ||
)(code) | ||
return factoryLabel.call(self, effects, referenceFullAfter, referenceFullMissing, "reference", "referenceMarker", "referenceString")(code); | ||
} | ||
@@ -567,9 +490,3 @@ | ||
function referenceFullAfter(code) { | ||
return self.parser.defined.includes( | ||
normalizeIdentifier( | ||
self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1) | ||
) | ||
) | ||
? ok(code) | ||
: nok(code) | ||
return self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1))) ? ok(code) : nok(code); | ||
} | ||
@@ -588,3 +505,3 @@ | ||
function referenceFullMissing(code) { | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -598,3 +515,3 @@ } | ||
function tokenizeReferenceCollapsed(effects, ok, nok) { | ||
return referenceCollapsedStart | ||
return referenceCollapsedStart; | ||
@@ -616,7 +533,7 @@ /** | ||
effects.enter('reference') | ||
effects.enter('referenceMarker') | ||
effects.consume(code) | ||
effects.exit('referenceMarker') | ||
return referenceCollapsedOpen | ||
effects.enter("reference"); | ||
effects.enter("referenceMarker"); | ||
effects.consume(code); | ||
effects.exit("referenceMarker"); | ||
return referenceCollapsedOpen; | ||
} | ||
@@ -638,10 +555,10 @@ | ||
if (code === 93) { | ||
effects.enter('referenceMarker') | ||
effects.consume(code) | ||
effects.exit('referenceMarker') | ||
effects.exit('reference') | ||
return ok | ||
effects.enter("referenceMarker"); | ||
effects.consume(code); | ||
effects.exit("referenceMarker"); | ||
effects.exit("reference"); | ||
return ok; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
} | ||
} |
/** @type {Construct} */ | ||
export const labelStartImage: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const labelStartImage: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=label-start-image.d.ts.map |
@@ -8,3 +8,3 @@ /** | ||
import {labelEnd} from './label-end.js' | ||
import { labelEnd } from './label-end.js'; | ||
@@ -16,3 +16,3 @@ /** @type {Construct} */ | ||
resolveAll: labelEnd.resolveAll | ||
} | ||
}; | ||
@@ -24,4 +24,4 @@ /** | ||
function tokenizeLabelStartImage(effects, ok, nok) { | ||
const self = this | ||
return start | ||
const self = this; | ||
return start; | ||
@@ -39,7 +39,7 @@ /** | ||
function start(code) { | ||
effects.enter('labelImage') | ||
effects.enter('labelImageMarker') | ||
effects.consume(code) | ||
effects.exit('labelImageMarker') | ||
return open | ||
effects.enter("labelImage"); | ||
effects.enter("labelImageMarker"); | ||
effects.consume(code); | ||
effects.exit("labelImageMarker"); | ||
return open; | ||
} | ||
@@ -59,9 +59,9 @@ | ||
if (code === 91) { | ||
effects.enter('labelMarker') | ||
effects.consume(code) | ||
effects.exit('labelMarker') | ||
effects.exit('labelImage') | ||
return after | ||
effects.enter("labelMarker"); | ||
effects.consume(code); | ||
effects.exit("labelMarker"); | ||
effects.exit("labelImage"); | ||
return after; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -102,6 +102,4 @@ | ||
/* c8 ignore next 3 */ | ||
return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs | ||
? nok(code) | ||
: ok(code) | ||
return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code); | ||
} | ||
} | ||
} |
/** @type {Construct} */ | ||
export const labelStartLink: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const labelStartLink: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=label-start-link.d.ts.map |
@@ -8,3 +8,3 @@ /** | ||
import {labelEnd} from './label-end.js' | ||
import { labelEnd } from './label-end.js'; | ||
@@ -16,3 +16,3 @@ /** @type {Construct} */ | ||
resolveAll: labelEnd.resolveAll | ||
} | ||
}; | ||
@@ -24,4 +24,4 @@ /** | ||
function tokenizeLabelStartLink(effects, ok, nok) { | ||
const self = this | ||
return start | ||
const self = this; | ||
return start; | ||
@@ -39,8 +39,8 @@ /** | ||
function start(code) { | ||
effects.enter('labelLink') | ||
effects.enter('labelMarker') | ||
effects.consume(code) | ||
effects.exit('labelMarker') | ||
effects.exit('labelLink') | ||
return after | ||
effects.enter("labelLink"); | ||
effects.enter("labelMarker"); | ||
effects.consume(code); | ||
effects.exit("labelMarker"); | ||
effects.exit("labelLink"); | ||
return after; | ||
} | ||
@@ -54,6 +54,4 @@ | ||
/* c8 ignore next 3 */ | ||
return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs | ||
? nok(code) | ||
: ok(code) | ||
return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code); | ||
} | ||
} | ||
} |
/** @type {Construct} */ | ||
export const lineEnding: Construct | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const lineEnding: Construct; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=line-ending.d.ts.map |
@@ -8,4 +8,4 @@ /** | ||
import {factorySpace} from 'micromark-factory-space' | ||
import {markdownLineEnding} from 'micromark-util-character' | ||
import { factorySpace } from 'micromark-factory-space'; | ||
import { markdownLineEnding } from 'micromark-util-character'; | ||
/** @type {Construct} */ | ||
@@ -15,3 +15,3 @@ export const lineEnding = { | ||
tokenize: tokenizeLineEnding | ||
} | ||
}; | ||
@@ -23,11 +23,11 @@ /** | ||
function tokenizeLineEnding(effects, ok) { | ||
return start | ||
return start; | ||
/** @type {State} */ | ||
function start(code) { | ||
effects.enter('lineEnding') | ||
effects.consume(code) | ||
effects.exit('lineEnding') | ||
return factorySpace(effects, ok, 'linePrefix') | ||
effects.enter("lineEnding"); | ||
effects.consume(code); | ||
effects.exit("lineEnding"); | ||
return factorySpace(effects, ok, "linePrefix"); | ||
} | ||
} | ||
} |
/** @type {Construct} */ | ||
export const list: Construct | ||
export type Code = import('micromark-util-types').Code | ||
export type Construct = import('micromark-util-types').Construct | ||
export type ContainerState = import('micromark-util-types').ContainerState | ||
export type Exiter = import('micromark-util-types').Exiter | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const list: Construct; | ||
export type Code = import('micromark-util-types').Code; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type ContainerState = import('micromark-util-types').ContainerState; | ||
export type Exiter = import('micromark-util-types').Exiter; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=list.d.ts.map |
201
lib/list.js
@@ -11,6 +11,6 @@ /** | ||
import {factorySpace} from 'micromark-factory-space' | ||
import {asciiDigit, markdownSpace} from 'micromark-util-character' | ||
import {blankLine} from './blank-line.js' | ||
import {thematicBreak} from './thematic-break.js' | ||
import { factorySpace } from 'micromark-factory-space'; | ||
import { asciiDigit, markdownSpace } from 'micromark-util-character'; | ||
import { blankLine } from './blank-line.js'; | ||
import { thematicBreak } from './thematic-break.js'; | ||
@@ -25,3 +25,3 @@ /** @type {Construct} */ | ||
exit: tokenizeListEnd | ||
} | ||
}; | ||
@@ -32,3 +32,3 @@ /** @type {Construct} */ | ||
partial: true | ||
} | ||
}; | ||
@@ -39,3 +39,3 @@ /** @type {Construct} */ | ||
partial: true | ||
} | ||
}; | ||
@@ -50,42 +50,29 @@ // To do: `markdown-rs` parses list items on their own and later stitches them | ||
function tokenizeListStart(effects, ok, nok) { | ||
const self = this | ||
const tail = self.events[self.events.length - 1] | ||
let initialSize = | ||
tail && tail[1].type === 'linePrefix' | ||
? tail[2].sliceSerialize(tail[1], true).length | ||
: 0 | ||
let size = 0 | ||
return start | ||
const self = this; | ||
const tail = self.events[self.events.length - 1]; | ||
let initialSize = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0; | ||
let size = 0; | ||
return start; | ||
/** @type {State} */ | ||
function start(code) { | ||
const kind = | ||
self.containerState.type || | ||
(code === 42 || code === 43 || code === 45 | ||
? 'listUnordered' | ||
: 'listOrdered') | ||
if ( | ||
kind === 'listUnordered' | ||
? !self.containerState.marker || code === self.containerState.marker | ||
: asciiDigit(code) | ||
) { | ||
const kind = self.containerState.type || (code === 42 || code === 43 || code === 45 ? "listUnordered" : "listOrdered"); | ||
if (kind === "listUnordered" ? !self.containerState.marker || code === self.containerState.marker : asciiDigit(code)) { | ||
if (!self.containerState.type) { | ||
self.containerState.type = kind | ||
self.containerState.type = kind; | ||
effects.enter(kind, { | ||
_container: true | ||
}) | ||
}); | ||
} | ||
if (kind === 'listUnordered') { | ||
effects.enter('listItemPrefix') | ||
return code === 42 || code === 45 | ||
? effects.check(thematicBreak, nok, atMarker)(code) | ||
: atMarker(code) | ||
if (kind === "listUnordered") { | ||
effects.enter("listItemPrefix"); | ||
return code === 42 || code === 45 ? effects.check(thematicBreak, nok, atMarker)(code) : atMarker(code); | ||
} | ||
if (!self.interrupt || code === 49) { | ||
effects.enter('listItemPrefix') | ||
effects.enter('listItemValue') | ||
return inside(code) | ||
effects.enter("listItemPrefix"); | ||
effects.enter("listItemValue"); | ||
return inside(code); | ||
} | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -96,15 +83,10 @@ | ||
if (asciiDigit(code) && ++size < 10) { | ||
effects.consume(code) | ||
return inside | ||
effects.consume(code); | ||
return inside; | ||
} | ||
if ( | ||
(!self.interrupt || size < 2) && | ||
(self.containerState.marker | ||
? code === self.containerState.marker | ||
: code === 41 || code === 46) | ||
) { | ||
effects.exit('listItemValue') | ||
return atMarker(code) | ||
if ((!self.interrupt || size < 2) && (self.containerState.marker ? code === self.containerState.marker : code === 41 || code === 46)) { | ||
effects.exit("listItemValue"); | ||
return atMarker(code); | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -116,16 +98,9 @@ | ||
function atMarker(code) { | ||
effects.enter('listItemMarker') | ||
effects.consume(code) | ||
effects.exit('listItemMarker') | ||
self.containerState.marker = self.containerState.marker || code | ||
return effects.check( | ||
blankLine, | ||
// Can’t be empty when interrupting. | ||
self.interrupt ? nok : onBlank, | ||
effects.attempt( | ||
listItemPrefixWhitespaceConstruct, | ||
endOfPrefix, | ||
otherPrefix | ||
) | ||
) | ||
effects.enter("listItemMarker"); | ||
effects.consume(code); | ||
effects.exit("listItemMarker"); | ||
self.containerState.marker = self.containerState.marker || code; | ||
return effects.check(blankLine, | ||
// Can’t be empty when interrupting. | ||
self.interrupt ? nok : onBlank, effects.attempt(listItemPrefixWhitespaceConstruct, endOfPrefix, otherPrefix)); | ||
} | ||
@@ -135,5 +110,5 @@ | ||
function onBlank(code) { | ||
self.containerState.initialBlankLine = true | ||
initialSize++ | ||
return endOfPrefix(code) | ||
self.containerState.initialBlankLine = true; | ||
initialSize++; | ||
return endOfPrefix(code); | ||
} | ||
@@ -144,8 +119,8 @@ | ||
if (markdownSpace(code)) { | ||
effects.enter('listItemPrefixWhitespace') | ||
effects.consume(code) | ||
effects.exit('listItemPrefixWhitespace') | ||
return endOfPrefix | ||
effects.enter("listItemPrefixWhitespace"); | ||
effects.consume(code); | ||
effects.exit("listItemPrefixWhitespace"); | ||
return endOfPrefix; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -155,6 +130,4 @@ | ||
function endOfPrefix(code) { | ||
self.containerState.size = | ||
initialSize + | ||
self.sliceSerialize(effects.exit('listItemPrefix'), true).length | ||
return ok(code) | ||
self.containerState.size = initialSize + self.sliceSerialize(effects.exit("listItemPrefix"), true).length; | ||
return ok(code); | ||
} | ||
@@ -168,20 +141,13 @@ } | ||
function tokenizeListContinuation(effects, ok, nok) { | ||
const self = this | ||
self.containerState._closeFlow = undefined | ||
return effects.check(blankLine, onBlank, notBlank) | ||
const self = this; | ||
self.containerState._closeFlow = undefined; | ||
return effects.check(blankLine, onBlank, notBlank); | ||
/** @type {State} */ | ||
function onBlank(code) { | ||
self.containerState.furtherBlankLines = | ||
self.containerState.furtherBlankLines || | ||
self.containerState.initialBlankLine | ||
self.containerState.furtherBlankLines = self.containerState.furtherBlankLines || self.containerState.initialBlankLine; | ||
// We have a blank line. | ||
// Still, try to consume at most the items size. | ||
return factorySpace( | ||
effects, | ||
ok, | ||
'listItemIndent', | ||
self.containerState.size + 1 | ||
)(code) | ||
return factorySpace(effects, ok, "listItemIndent", self.containerState.size + 1)(code); | ||
} | ||
@@ -192,9 +158,9 @@ | ||
if (self.containerState.furtherBlankLines || !markdownSpace(code)) { | ||
self.containerState.furtherBlankLines = undefined | ||
self.containerState.initialBlankLine = undefined | ||
return notInCurrentItem(code) | ||
self.containerState.furtherBlankLines = undefined; | ||
self.containerState.initialBlankLine = undefined; | ||
return notInCurrentItem(code); | ||
} | ||
self.containerState.furtherBlankLines = undefined | ||
self.containerState.initialBlankLine = undefined | ||
return effects.attempt(indentConstruct, ok, notInCurrentItem)(code) | ||
self.containerState.furtherBlankLines = undefined; | ||
self.containerState.initialBlankLine = undefined; | ||
return effects.attempt(indentConstruct, ok, notInCurrentItem)(code); | ||
} | ||
@@ -205,15 +171,8 @@ | ||
// While we do continue, we signal that the flow should be closed. | ||
self.containerState._closeFlow = true | ||
self.containerState._closeFlow = true; | ||
// As we’re closing flow, we’re no longer interrupting. | ||
self.interrupt = undefined | ||
self.interrupt = undefined; | ||
// Always populated by defaults. | ||
return factorySpace( | ||
effects, | ||
effects.attempt(list, ok, nok), | ||
'linePrefix', | ||
self.parser.constructs.disable.null.includes('codeIndented') | ||
? undefined | ||
: 4 | ||
)(code) | ||
return factorySpace(effects, effects.attempt(list, ok, nok), "linePrefix", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code); | ||
} | ||
@@ -227,18 +186,9 @@ } | ||
function tokenizeIndent(effects, ok, nok) { | ||
const self = this | ||
return factorySpace( | ||
effects, | ||
afterPrefix, | ||
'listItemIndent', | ||
self.containerState.size + 1 | ||
) | ||
const self = this; | ||
return factorySpace(effects, afterPrefix, "listItemIndent", self.containerState.size + 1); | ||
/** @type {State} */ | ||
function afterPrefix(code) { | ||
const tail = self.events[self.events.length - 1] | ||
return tail && | ||
tail[1].type === 'listItemIndent' && | ||
tail[2].sliceSerialize(tail[1], true).length === self.containerState.size | ||
? ok(code) | ||
: nok(code) | ||
const tail = self.events[self.events.length - 1]; | ||
return tail && tail[1].type === "listItemIndent" && tail[2].sliceSerialize(tail[1], true).length === self.containerState.size ? ok(code) : nok(code); | ||
} | ||
@@ -252,3 +202,3 @@ } | ||
function tokenizeListEnd(effects) { | ||
effects.exit(this.containerState.type) | ||
effects.exit(this.containerState.type); | ||
} | ||
@@ -261,24 +211,13 @@ | ||
function tokenizeListItemPrefixWhitespace(effects, ok, nok) { | ||
const self = this | ||
const self = this; | ||
// Always populated by defaults. | ||
return factorySpace( | ||
effects, | ||
afterPrefix, | ||
'listItemPrefixWhitespace', | ||
self.parser.constructs.disable.null.includes('codeIndented') | ||
? undefined | ||
: 4 + 1 | ||
) | ||
return factorySpace(effects, afterPrefix, "listItemPrefixWhitespace", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 + 1); | ||
/** @type {State} */ | ||
function afterPrefix(code) { | ||
const tail = self.events[self.events.length - 1] | ||
return !markdownSpace(code) && | ||
tail && | ||
tail[1].type === 'listItemPrefixWhitespace' | ||
? ok(code) | ||
: nok(code) | ||
const tail = self.events[self.events.length - 1]; | ||
return !markdownSpace(code) && tail && tail[1].type === "listItemPrefixWhitespace" ? ok(code) : nok(code); | ||
} | ||
} | ||
} |
/** @type {Construct} */ | ||
export const setextUnderline: Construct | ||
export type Code = import('micromark-util-types').Code | ||
export type Construct = import('micromark-util-types').Construct | ||
export type Resolver = import('micromark-util-types').Resolver | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const setextUnderline: Construct; | ||
export type Code = import('micromark-util-types').Code; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type Resolver = import('micromark-util-types').Resolver; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=setext-underline.d.ts.map |
@@ -10,4 +10,4 @@ /** | ||
import {factorySpace} from 'micromark-factory-space' | ||
import {markdownLineEnding, markdownSpace} from 'micromark-util-character' | ||
import { factorySpace } from 'micromark-factory-space'; | ||
import { markdownLineEnding, markdownSpace } from 'micromark-util-character'; | ||
/** @type {Construct} */ | ||
@@ -18,3 +18,3 @@ export const setextUnderline = { | ||
resolveTo: resolveToSetextUnderline | ||
} | ||
}; | ||
@@ -24,9 +24,9 @@ /** @type {Resolver} */ | ||
// To do: resolve like `markdown-rs`. | ||
let index = events.length | ||
let index = events.length; | ||
/** @type {number | undefined} */ | ||
let content | ||
let content; | ||
/** @type {number | undefined} */ | ||
let text | ||
let text; | ||
/** @type {number | undefined} */ | ||
let definition | ||
let definition; | ||
@@ -37,8 +37,8 @@ // Find the opening of the content. | ||
if (events[index][0] === 'enter') { | ||
if (events[index][1].type === 'content') { | ||
content = index | ||
break | ||
if (events[index][1].type === "content") { | ||
content = index; | ||
break; | ||
} | ||
if (events[index][1].type === 'paragraph') { | ||
text = index | ||
if (events[index][1].type === "paragraph") { | ||
text = index; | ||
} | ||
@@ -48,8 +48,8 @@ } | ||
else { | ||
if (events[index][1].type === 'content') { | ||
if (events[index][1].type === "content") { | ||
// Remove the content end (if needed we’ll add it later) | ||
events.splice(index, 1) | ||
events.splice(index, 1); | ||
} | ||
if (!definition && events[index][1].type === 'definition') { | ||
definition = index | ||
if (!definition && events[index][1].type === "definition") { | ||
definition = index; | ||
} | ||
@@ -59,9 +59,9 @@ } | ||
const heading = { | ||
type: 'setextHeading', | ||
type: "setextHeading", | ||
start: Object.assign({}, events[text][1].start), | ||
end: Object.assign({}, events[events.length - 1][1].end) | ||
} | ||
}; | ||
// Change the paragraph to setext heading text. | ||
events[text][1].type = 'setextHeadingText' | ||
events[text][1].type = "setextHeadingText"; | ||
@@ -71,12 +71,12 @@ // If we have definitions in the content, we’ll keep on having content, | ||
if (definition) { | ||
events.splice(text, 0, ['enter', heading, context]) | ||
events.splice(definition + 1, 0, ['exit', events[content][1], context]) | ||
events[content][1].end = Object.assign({}, events[definition][1].end) | ||
events.splice(text, 0, ['enter', heading, context]); | ||
events.splice(definition + 1, 0, ['exit', events[content][1], context]); | ||
events[content][1].end = Object.assign({}, events[definition][1].end); | ||
} else { | ||
events[content][1] = heading | ||
events[content][1] = heading; | ||
} | ||
// Add the heading exit at the end. | ||
events.push(['exit', heading, context]) | ||
return events | ||
events.push(['exit', heading, context]); | ||
return events; | ||
} | ||
@@ -89,6 +89,6 @@ | ||
function tokenizeSetextUnderline(effects, ok, nok) { | ||
const self = this | ||
const self = this; | ||
/** @type {NonNullable<Code>} */ | ||
let marker | ||
return start | ||
let marker; | ||
return start; | ||
@@ -107,5 +107,5 @@ /** | ||
function start(code) { | ||
let index = self.events.length | ||
let index = self.events.length; | ||
/** @type {boolean | undefined} */ | ||
let paragraph | ||
let paragraph; | ||
// Find an opening. | ||
@@ -115,9 +115,5 @@ while (index--) { | ||
// We can now either have a definition or a paragraph. | ||
if ( | ||
self.events[index][1].type !== 'lineEnding' && | ||
self.events[index][1].type !== 'linePrefix' && | ||
self.events[index][1].type !== 'content' | ||
) { | ||
paragraph = self.events[index][1].type === 'paragraph' | ||
break | ||
if (self.events[index][1].type !== "lineEnding" && self.events[index][1].type !== "linePrefix" && self.events[index][1].type !== "content") { | ||
paragraph = self.events[index][1].type === "paragraph"; | ||
break; | ||
} | ||
@@ -129,7 +125,7 @@ } | ||
if (!self.parser.lazy[self.now().line] && (self.interrupt || paragraph)) { | ||
effects.enter('setextHeadingLine') | ||
marker = code | ||
return before(code) | ||
effects.enter("setextHeadingLine"); | ||
marker = code; | ||
return before(code); | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -149,4 +145,4 @@ | ||
function before(code) { | ||
effects.enter('setextHeadingLineSequence') | ||
return inside(code) | ||
effects.enter("setextHeadingLineSequence"); | ||
return inside(code); | ||
} | ||
@@ -167,9 +163,7 @@ | ||
if (code === marker) { | ||
effects.consume(code) | ||
return inside | ||
effects.consume(code); | ||
return inside; | ||
} | ||
effects.exit('setextHeadingLineSequence') | ||
return markdownSpace(code) | ||
? factorySpace(effects, after, 'lineSuffix')(code) | ||
: after(code) | ||
effects.exit("setextHeadingLineSequence"); | ||
return markdownSpace(code) ? factorySpace(effects, after, "lineSuffix")(code) : after(code); | ||
} | ||
@@ -190,7 +184,7 @@ | ||
if (code === null || markdownLineEnding(code)) { | ||
effects.exit('setextHeadingLine') | ||
return ok(code) | ||
effects.exit("setextHeadingLine"); | ||
return ok(code); | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
} | ||
} |
/** @type {Construct} */ | ||
export const thematicBreak: Construct | ||
export type Code = import('micromark-util-types').Code | ||
export type Construct = import('micromark-util-types').Construct | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export const thematicBreak: Construct; | ||
export type Code = import('micromark-util-types').Code; | ||
export type Construct = import('micromark-util-types').Construct; | ||
export type State = import('micromark-util-types').State; | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext; | ||
export type Tokenizer = import('micromark-util-types').Tokenizer; | ||
//# sourceMappingURL=thematic-break.d.ts.map |
@@ -9,4 +9,4 @@ /** | ||
import {factorySpace} from 'micromark-factory-space' | ||
import {markdownLineEnding, markdownSpace} from 'micromark-util-character' | ||
import { factorySpace } from 'micromark-factory-space'; | ||
import { markdownLineEnding, markdownSpace } from 'micromark-util-character'; | ||
/** @type {Construct} */ | ||
@@ -16,3 +16,3 @@ export const thematicBreak = { | ||
tokenize: tokenizeThematicBreak | ||
} | ||
}; | ||
@@ -24,6 +24,6 @@ /** | ||
function tokenizeThematicBreak(effects, ok, nok) { | ||
let size = 0 | ||
let size = 0; | ||
/** @type {NonNullable<Code>} */ | ||
let marker | ||
return start | ||
let marker; | ||
return start; | ||
@@ -41,5 +41,5 @@ /** | ||
function start(code) { | ||
effects.enter('thematicBreak') | ||
effects.enter("thematicBreak"); | ||
// To do: parse indent like `markdown-rs`. | ||
return before(code) | ||
return before(code); | ||
} | ||
@@ -58,4 +58,4 @@ | ||
function before(code) { | ||
marker = code | ||
return atBreak(code) | ||
marker = code; | ||
return atBreak(code); | ||
} | ||
@@ -75,10 +75,10 @@ | ||
if (code === marker) { | ||
effects.enter('thematicBreakSequence') | ||
return sequence(code) | ||
effects.enter("thematicBreakSequence"); | ||
return sequence(code); | ||
} | ||
if (size >= 3 && (code === null || markdownLineEnding(code))) { | ||
effects.exit('thematicBreak') | ||
return ok(code) | ||
effects.exit("thematicBreak"); | ||
return ok(code); | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -98,11 +98,9 @@ | ||
if (code === marker) { | ||
effects.consume(code) | ||
size++ | ||
return sequence | ||
effects.consume(code); | ||
size++; | ||
return sequence; | ||
} | ||
effects.exit('thematicBreakSequence') | ||
return markdownSpace(code) | ||
? factorySpace(effects, atBreak, 'whitespace')(code) | ||
: atBreak(code) | ||
effects.exit("thematicBreakSequence"); | ||
return markdownSpace(code) ? factorySpace(effects, atBreak, "whitespace")(code) : atBreak(code); | ||
} | ||
} | ||
} |
{ | ||
"name": "micromark-core-commonmark", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "The CommonMark markdown constructs", | ||
@@ -32,2 +32,3 @@ "license": "MIT", | ||
"lib/", | ||
"index.d.ts.map", | ||
"index.d.ts", | ||
@@ -61,3 +62,15 @@ "index.js" | ||
}, | ||
"xo": false | ||
"xo": { | ||
"envs": [ | ||
"shared-node-browser" | ||
], | ||
"prettier": true, | ||
"rules": { | ||
"logical-assignment-operators": "off", | ||
"max-depth": "off", | ||
"unicorn/no-this-assignment": "off", | ||
"unicorn/prefer-at": "off", | ||
"unicorn/prefer-code-point": "off" | ||
} | ||
} | ||
} |
@@ -17,12 +17,12 @@ # micromark-core-commonmark | ||
* [What is this?](#what-is-this) | ||
* [When should I use this?](#when-should-i-use-this) | ||
* [Install](#install) | ||
* [Use](#use) | ||
* [API](#api) | ||
* [Types](#types) | ||
* [Compatibility](#compatibility) | ||
* [Security](#security) | ||
* [Contribute](#contribute) | ||
* [License](#license) | ||
* [What is this?](#what-is-this) | ||
* [When should I use this?](#when-should-i-use-this) | ||
* [Install](#install) | ||
* [Use](#use) | ||
* [API](#api) | ||
* [Types](#types) | ||
* [Compatibility](#compatibility) | ||
* [Security](#security) | ||
* [Contribute](#contribute) | ||
* [License](#license) | ||
@@ -29,0 +29,0 @@ ## What is this? |
293093
141
10497