/**
 * @enesis/lezer-comark — Lezer extensions for Comark block and inline component syntax.
 *
 * Adds four syntaxes to `@lezer/markdown`:
 *   ::component{key="val"}...::  → BlockComponent node
 *   :component{key="val"}         → InlineComponent node
 *   :component[content]{key="val"}→ InlineComponent node with body
 *   [text]{.class #id key="val"} → Span node
 *
 * Each returns a `MarkdownConfig` that can be merged into the parser:
 *
 *   import { parser } from "@lezer/markdown"
 *   import { GFM } from "@lezer/markdown"
 *   import { createComarkExtensions } from "@enesis/lezer-comark"
 *
 *   const fullParser = parser.configure([GFM, ...createComarkExtensions()])
 */

import { blockComponentConfig } from "./block-component"
import { inlineComponentConfig } from "./inline-component"
import { spanAttrConfig } from "./span-attr"
import { parseAttrs } from "./attributes"
import type { Attrs, InlineComponentData, BlockComponentData } from "./types"

export { parseAttrs }
export type { Attrs, InlineComponentData, BlockComponentData }

/**
 * Combine all comark extensions into a single array for parser.configure().
 * Order matters: block parsers run first, then inline parsers.
 */
export function createComarkExtensions() {
  return [
    blockComponentConfig,
    inlineComponentConfig,
    spanAttrConfig,
  ]
}
