This commit is contained in:
2024-03-22 03:47:51 +05:30
parent 8bcf3d211e
commit 89819f6fe2
28440 changed files with 3211033 additions and 2 deletions

View File

@@ -0,0 +1,50 @@
/**
* @typedef {import('micromark-factory-mdx-expression').Acorn} Acorn
* @typedef {import('micromark-factory-mdx-expression').AcornOptions} AcornOptions
* @typedef {import('micromark-util-types').Construct} Construct
* @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
* @typedef {import('micromark-util-types').Tokenizer} Tokenizer
*/
/**
* @typedef Options
* Configuration.
* @property {AcornOptions | undefined} acornOptions
* Acorn options.
* @property {boolean | undefined} addResult
* Whether to add `estree` fields to tokens with results from acorn.
*/
import { factoryTag } from './factory-tag.js';
/**
* Parse JSX (text).
*
* @param {Acorn | undefined} acorn
* Acorn parser to use (optional).
* @param {Options} options
* Configuration.
* @returns {Construct}
* Construct.
*/
export function jsxText(acorn, options) {
return {
name: 'mdxJsxTextTag',
tokenize: tokenizeJsxText
};
/**
* MDX JSX (text).
*
* ```markdown
* > | a <b />.
* ^^^^^
* ```
*
* @this {TokenizeContext}
* @type {Tokenizer}
*/
function tokenizeJsxText(effects, ok, nok) {
return factoryTag.call(this, effects, ok, nok, acorn, options.acornOptions, options.addResult, true, 'mdxJsxTextTag', 'mdxJsxTextTagMarker', 'mdxJsxTextTagClosingMarker', 'mdxJsxTextTagSelfClosingMarker', 'mdxJsxTextTagName', 'mdxJsxTextTagNamePrimary', 'mdxJsxTextTagNameMemberMarker', 'mdxJsxTextTagNameMember', 'mdxJsxTextTagNamePrefixMarker', 'mdxJsxTextTagNameLocal', 'mdxJsxTextTagExpressionAttribute', 'mdxJsxTextTagExpressionAttributeMarker', 'mdxJsxTextTagExpressionAttributeValue', 'mdxJsxTextTagAttribute', 'mdxJsxTextTagAttributeName', 'mdxJsxTextTagAttributeNamePrimary', 'mdxJsxTextTagAttributeNamePrefixMarker', 'mdxJsxTextTagAttributeNameLocal', 'mdxJsxTextTagAttributeInitializerMarker', 'mdxJsxTextTagAttributeValueLiteral', 'mdxJsxTextTagAttributeValueLiteralMarker', 'mdxJsxTextTagAttributeValueLiteralValue', 'mdxJsxTextTagAttributeValueExpression', 'mdxJsxTextTagAttributeValueExpressionMarker', 'mdxJsxTextTagAttributeValueExpressionValue');
}
}