Skip to content

Commit

Permalink
micromark: add definitions on exposed fields
Browse files Browse the repository at this point in the history
Closes GH-121.
Closes GH-122.

Reviewed-by: Titus Wormer <tituswormer@gmail.com>
  • Loading branch information
tripodsan committed Oct 6, 2022
1 parent 86248b9 commit c0602c2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions packages/micromark-util-types/index.js
Expand Up @@ -496,6 +496,10 @@
* @typedef {Partial<NormalizedHtmlExtension>} HtmlExtension
* An HTML extension changes how markdown tokens are serialized.
*
* @typedef Definition
* @property {string} [destination]
* @property {string} [title]
*
* @typedef _CompileDataFields
* @property {boolean} lastWasTag
* @property {boolean} expectFirstItem
Expand All @@ -509,6 +513,7 @@
* @property {boolean} inCodeText
* @property {string} characterReferenceType
* @property {Array<boolean>} tightStack
* @property {Record<string, Definition>} definitions
*
* @typedef {Record<string, unknown> & Partial<_CompileDataFields>} CompileData
*
Expand Down
10 changes: 5 additions & 5 deletions packages/micromark/dev/lib/compile.js
Expand Up @@ -17,6 +17,7 @@
* @typedef {import('micromark-util-types').CompileOptions} CompileOptions
* @typedef {import('micromark-util-types').CompileData} CompileData
* @typedef {import('micromark-util-types').CompileContext} CompileContext
* @typedef {import('micromark-util-types').Definition} Definition
* @typedef {import('micromark-util-types').Compile} Compile
* @typedef {import('micromark-util-types').Handle} Handle
* @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension
Expand All @@ -31,10 +32,6 @@
* @property {string} [referenceId]
* @property {string} [destination]
* @property {string} [title]
*
* @typedef Definition
* @property {string} [destination]
* @property {string} [title]
*/

import {ok as assert} from 'uvu/assert'
Expand Down Expand Up @@ -213,7 +210,10 @@ export function compile(options = {}) {
*
* @type {CompileData}
*/
const data = {tightStack}
const data = {
tightStack,
definitions
}

/**
* The context for handlers references a couple of useful functions.
Expand Down

0 comments on commit c0602c2

Please sign in to comment.