-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
CompileData
type to track custom data
- Loading branch information
Showing
6 changed files
with
111 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ node_modules/ | |
*.log | ||
.DS_Store | ||
yarn.lock | ||
!/dev/index.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import type {OnEnterError} from './lib/index.js' | ||
|
||
export type { | ||
CompileContext, | ||
Encoding, | ||
Extension, | ||
Handle, | ||
OnEnterError, | ||
OnExitError, | ||
Options, | ||
Token, | ||
Transform, | ||
Value | ||
} from './lib/index.js' | ||
|
||
/** | ||
* Deprecated: use `OnEnterError`. | ||
*/ | ||
// To do: next major: remove. | ||
export type OnError = OnEnterError | ||
|
||
/** | ||
* Interface of tracked data. | ||
* | ||
* When working on extensions that use more data, extend the corresponding | ||
* interface to register their types: | ||
* | ||
* ```ts | ||
* declare module 'mdast-util-from-markdown' { | ||
* interface CompileData { | ||
* // Register a new field. | ||
* mathFlowInside?: boolean | undefined | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions | ||
export interface CompileData { | ||
/** | ||
* Whether we’re inside a hard break. | ||
*/ | ||
atHardBreak?: boolean | undefined | ||
|
||
/** | ||
* Current character reference type. | ||
*/ | ||
characterReferenceType?: | ||
| 'characterReferenceMarkerHexadecimal' | ||
| 'characterReferenceMarkerNumeric' | ||
| undefined | ||
|
||
/** | ||
* Whether a first list item value (`1` in `1. a`) is expected. | ||
*/ | ||
expectingFirstListItemValue?: boolean | undefined | ||
|
||
/** | ||
* Whether we’re in flow code. | ||
*/ | ||
flowCodeInside?: boolean | undefined | ||
|
||
/** | ||
* Whether we’re in a reference. | ||
*/ | ||
inReference?: boolean | undefined | ||
|
||
/** | ||
* Whether we’re expecting a line ending from a setext heading, which can be slurped. | ||
*/ | ||
setextHeadingSlurpLineEnding?: boolean | undefined | ||
|
||
/** | ||
* Current reference. | ||
*/ | ||
referenceType?: 'collapsed' | 'full' | undefined | ||
} | ||
|
||
export {fromMarkdown} from './lib/index.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,2 @@ | ||
/** | ||
* @typedef {import('./lib/index.js').CompileContext} CompileContext | ||
* @typedef {import('./lib/index.js').Encoding} Encoding | ||
* @typedef {import('./lib/index.js').Extension} Extension | ||
* @typedef {import('./lib/index.js').Handle} Handle | ||
* @typedef {import('./lib/index.js').OnEnterError} OnEnterError | ||
* @typedef {import('./lib/index.js').OnExitError} OnExitError | ||
* @typedef {import('./lib/index.js').Options} Options | ||
* @typedef {import('./lib/index.js').Token} Token | ||
* @typedef {import('./lib/index.js').Transform} Transform | ||
* @typedef {import('./lib/index.js').Value} Value | ||
*/ | ||
|
||
/** | ||
* @typedef {import('./lib/index.js').OnEnterError} OnError | ||
* To do: next major: remove. | ||
*/ | ||
|
||
// Note: types exported from `index.d.ts`. | ||
export {fromMarkdown} from './lib/index.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters