function createParserOptions(mode, languageOptions) {
	/** @type {Extensions} */
	const extensions = [];
	/** @type {MdastExtensions} */
	const mdastExtensions = [];

	// 1. `mode`: Add GFM extensions if mode is "gfm"
	if (mode === "gfm") {
		extensions.push(gfm());
		mdastExtensions.push(gfmFromMarkdown());
	}

	// 2. `languageOptions.frontmatter`: Handle frontmatter options
	const frontmatterOption = languageOptions?.frontmatter;

	// Skip frontmatter entirely if false
	if (frontmatterOption !== false) {
		if (frontmatterOption === "yaml") {
			extensions.push(frontmatter(["yaml"]));
			mdastExtensions.push(frontmatterFromMarkdown(["yaml"]));
		} else if (frontmatterOption === "toml") {
			extensions.push(frontmatter(["toml"]));
			mdastExtensions.push(frontmatterFromMarkdown(["toml"]));
		} else if (frontmatterOption === "json") {
			extensions.push(frontmatter(jsonFrontmatterConfig));
			mdastExtensions.push(
				frontmatterFromMarkdown(jsonFrontmatterConfig),
			);
		}
	}

	return {
		extensions,
		mdastExtensions,
	};
}
Create parser options based on `mode` and `languageOptions`.
@param {ParserMode} mode The markdown parser mode.
@param {MarkdownLanguageOptions} languageOptions Language options.
@returns {{extensions: Extensions, mdastExtensions: MdastExtensions}} Parser options for micromark and mdast