micromark-util-types
Advanced tools
Comparing version 1.0.0-alpha.2 to 1.0.0-alpha.3
@@ -64,3 +64,3 @@ /** | ||
*/ | ||
export type ContentType = 'flow' | 'content' | 'text' | 'string' | ||
export type ContentType = 'document' | 'flow' | 'content' | 'text' | 'string' | ||
/** | ||
@@ -242,6 +242,2 @@ * A location in the document (`line`/`column`/`offset`) and chunk (`_index`, | ||
/** | ||
* Lazy is used for lines that were not properly preceded by the container. | ||
*/ | ||
lazy: Attempt | ||
/** | ||
* Attempt, then revert. | ||
@@ -364,44 +360,15 @@ */ | ||
* …then `- list?` cannot form if this fenced code construct is concrete. | ||
*/ | ||
concrete?: boolean | undefined | ||
/** | ||
* Similar to `concrete`, interruptible content can *sometimes* be interrupted | ||
* by more containers. | ||
* Normally, only content (paragraphs, definitions) is interruptible. | ||
* | ||
* For example, when parsing the document (containers, such as block quotes | ||
* and lists) and the subcontent is currently on content (which is | ||
* interruptible): | ||
* An example of a construct that is not concrete is a GFM table: | ||
* | ||
* ````markdown | ||
* asd | ||
* 1. list? | ||
* | ||
* asd | ||
* 2. list? | ||
* | a | | ||
* | - | | ||
* > | b | | ||
* ```` | ||
* | ||
* …then `list?` can typically form. | ||
* However, the list construct can check `tokenizer.interrupt` when parsing to | ||
* see allow `1` but disallow `2` as start markers when interrupting. | ||
* …`b` is not part of the table. | ||
*/ | ||
interruptible?: boolean | undefined | ||
concrete?: boolean | undefined | ||
/** | ||
* Lazy constructs can continue even if containers are not explicitly | ||
* continued. | ||
* Normally, only content (paragraphs, definitions) is interruptible. | ||
* | ||
* For example, when parsing the document (containers, such as block quotes | ||
* and lists) and this construct is parsing content: | ||
* | ||
* ````markdown | ||
* > a | ||
* b | ||
* ```` | ||
* | ||
* …then `b` is part of the current content (with `a`), because content has | ||
* `lazy: true`, and thus doesn’t need container markers. | ||
*/ | ||
lazy?: boolean | undefined | ||
/** | ||
* Whether the construct, when in a `ConstructRecord`, precedes over existing | ||
@@ -440,9 +407,13 @@ * constructs for the same character code when merged | ||
* Whether we’re currently interrupting. | ||
* Take for example: | ||
* | ||
* ```markdown | ||
* a | ||
* # b | ||
* ``` | ||
* | ||
* At 2:1, we’re “interrupting”. | ||
*/ | ||
interrupt?: boolean | undefined | ||
/** | ||
* Whether we’re currently lazy. | ||
*/ | ||
lazy?: boolean | undefined | ||
/** | ||
* The current construct. | ||
@@ -571,3 +542,7 @@ * Constructs that are not `partial` are set here. | ||
_NormalizedExtensionFields | ||
export type NormalizedExtension = Partial<FullNormalizedExtension> | ||
export type NormalizedExtension = Record< | ||
string, | ||
Record<string, unknown[] | undefined> | ||
> & | ||
Partial<_NormalizedExtensionFields> | ||
/** | ||
@@ -602,2 +577,15 @@ * Set up a tokenizer for a content type. | ||
defined: string[] | ||
/** | ||
* Map of line numbers to whether they are lazy (as opposed to the line before | ||
* them). | ||
* Take for example: | ||
* | ||
* ```markdown | ||
* > a | ||
* b | ||
* ``` | ||
* | ||
* L1 here is not lazy, L2 is. | ||
*/ | ||
lazy: Record<number, boolean> | ||
} | ||
@@ -604,0 +592,0 @@ /** |
62
index.js
@@ -19,3 +19,3 @@ /** | ||
* | ||
* @typedef {'flow'|'content'|'text'|'string'} ContentType | ||
* @typedef {'document'|'flow'|'content'|'text'|'string'} ContentType | ||
* Enumeration of the content types. | ||
@@ -196,4 +196,2 @@ * | ||
* Interrupt is used for stuff right after a line of content. | ||
* @property {Attempt} lazy | ||
* Lazy is used for lines that were not properly preceded by the container. | ||
* @property {Attempt} check | ||
@@ -293,37 +291,12 @@ * Attempt, then revert. | ||
* …then `- list?` cannot form if this fenced code construct is concrete. | ||
* @property {boolean} [interruptible] | ||
* Similar to `concrete`, interruptible content can *sometimes* be interrupted | ||
* by more containers. | ||
* Normally, only content (paragraphs, definitions) is interruptible. | ||
* | ||
* For example, when parsing the document (containers, such as block quotes | ||
* and lists) and the subcontent is currently on content (which is | ||
* interruptible): | ||
* An example of a construct that is not concrete is a GFM table: | ||
* | ||
* ````markdown | ||
* asd | ||
* 1. list? | ||
* | ||
* asd | ||
* 2. list? | ||
* | a | | ||
* | - | | ||
* > | b | | ||
* ```` | ||
* | ||
* …then `list?` can typically form. | ||
* However, the list construct can check `tokenizer.interrupt` when parsing to | ||
* see allow `1` but disallow `2` as start markers when interrupting. | ||
* @property {boolean} [lazy] | ||
* Lazy constructs can continue even if containers are not explicitly | ||
* continued. | ||
* Normally, only content (paragraphs, definitions) is interruptible. | ||
* | ||
* For example, when parsing the document (containers, such as block quotes | ||
* and lists) and this construct is parsing content: | ||
* | ||
* ````markdown | ||
* > a | ||
* b | ||
* ```` | ||
* | ||
* …then `b` is part of the current content (with `a`), because content has | ||
* `lazy: true`, and thus doesn’t need container markers. | ||
* …`b` is not part of the table. | ||
* @property {'before'|'after'} [add='before'] | ||
@@ -348,4 +321,10 @@ * Whether the construct, when in a `ConstructRecord`, precedes over existing | ||
* Whether we’re currently interrupting. | ||
* @property {boolean} [lazy] | ||
* Whether we’re currently lazy. | ||
* Take for example: | ||
* | ||
* ```markdown | ||
* a | ||
* # b | ||
* ``` | ||
* | ||
* At 2:1, we’re “interrupting”. | ||
* @property {Construct} [currentConstruct] | ||
@@ -426,3 +405,3 @@ * The current construct. | ||
* @typedef {Record<string, Record<string, unknown[]>> & _NormalizedExtensionFields} FullNormalizedExtension | ||
* @typedef {Partial<FullNormalizedExtension>} NormalizedExtension | ||
* @typedef {Record<string, Record<string, unknown[]|undefined>> & Partial<_NormalizedExtensionFields>} NormalizedExtension | ||
* | ||
@@ -447,2 +426,13 @@ * @callback Create | ||
* @property {string[]} defined List of defined identifiers. | ||
* @property {Record<number, boolean>} lazy | ||
* Map of line numbers to whether they are lazy (as opposed to the line before | ||
* them). | ||
* Take for example: | ||
* | ||
* ```markdown | ||
* > a | ||
* b | ||
* ``` | ||
* | ||
* L1 here is not lazy, L2 is. | ||
*/ | ||
@@ -449,0 +439,0 @@ |
{ | ||
"name": "micromark-util-types", | ||
"version": "1.0.0-alpha.2", | ||
"version": "1.0.0-alpha.3", | ||
"description": "micromark utility with a couple of typescript types", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45554
1226