123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- import type {Info, State} from './lib/types.js'
- /**
- * Interface of registered constructs.
- *
- * When working on extensions that use new constructs, extend the corresponding
- * interface to register its name:
- *
- * ```ts
- * declare module 'mdast-util-to-markdown' {
- * interface ConstructNameMap {
- * // Register a new construct name (value is used, key should match it).
- * gfmStrikethrough: 'gfmStrikethrough'
- * }
- * }
- * ```
- */
- export interface ConstructNameMap {
- /**
- * Whole autolink.
- *
- * ```markdown
- * > | <https://example.com> and <admin@example.com>
- * ^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
- * ```
- */
- autolink: 'autolink'
- /**
- * Whole block quote.
- *
- * ```markdown
- * > | > a
- * ^^^
- * > | b
- * ^
- * ```
- */
- blockquote: 'blockquote'
- /**
- * Whole code (indented).
- *
- * ```markdown
- * ␠␠␠␠console.log(1)
- * ^^^^^^^^^^^^^^^^^^
- * ```
- */
- codeIndented: 'codeIndented'
- /**
- * Whole code (fenced).
- *
- * ````markdown
- * > | ```js
- * ^^^^^
- * > | console.log(1)
- * ^^^^^^^^^^^^^^
- * > | ```
- * ^^^
- * ````
- */
- codeFenced: 'codeFenced'
- /**
- * Code (fenced) language, when fenced with grave accents.
- *
- * ````markdown
- * > | ```js
- * ^^
- * | console.log(1)
- * | ```
- * ````
- */
- codeFencedLangGraveAccent: 'codeFencedLangGraveAccent'
- /**
- * Code (fenced) language, when fenced with tildes.
- *
- * ````markdown
- * > | ~~~js
- * ^^
- * | console.log(1)
- * | ~~~
- * ````
- */
- codeFencedLangTilde: 'codeFencedLangTilde'
- /**
- * Code (fenced) meta string, when fenced with grave accents.
- *
- * ````markdown
- * > | ```js eval
- * ^^^^
- * | console.log(1)
- * | ```
- * ````
- */
- codeFencedMetaGraveAccent: 'codeFencedMetaGraveAccent'
- /**
- * Code (fenced) meta string, when fenced with tildes.
- *
- * ````markdown
- * > | ~~~js eval
- * ^^^^
- * | console.log(1)
- * | ~~~
- * ````
- */
- codeFencedMetaTilde: 'codeFencedMetaTilde'
- /**
- * Whole definition.
- *
- * ```markdown
- * > | [a]: b "c"
- * ^^^^^^^^^^
- * ```
- */
- definition: 'definition'
- /**
- * Destination (literal) (occurs in definition, image, link).
- *
- * ```markdown
- * > | [a]: <b> "c"
- * ^^^
- * > | a ![b](<c> "d") e
- * ^^^
- * ```
- */
- destinationLiteral: 'destinationLiteral'
- /**
- * Destination (raw) (occurs in definition, image, link).
- *
- * ```markdown
- * > | [a]: b "c"
- * ^
- * > | a ![b](c "d") e
- * ^
- * ```
- */
- destinationRaw: 'destinationRaw'
- /**
- * Emphasis.
- *
- * ```markdown
- * > | *a*
- * ^^^
- * ```
- */
- emphasis: 'emphasis'
- /**
- * Whole heading (atx).
- *
- * ```markdown
- * > | # alpha
- * ^^^^^^^
- * ```
- */
- headingAtx: 'headingAtx'
- /**
- * Whole heading (setext).
- *
- * ```markdown
- * > | alpha
- * ^^^^^
- * > | =====
- * ^^^^^
- * ```
- */
- headingSetext: 'headingSetext'
- /**
- * Whole image.
- *
- * ```markdown
- * > | ![a](b)
- * ^^^^^^^
- * > | ![c]
- * ^^^^
- * ```
- */
- image: 'image'
- /**
- * Whole image reference.
- *
- * ```markdown
- * > | ![a]
- * ^^^^
- * ```
- */
- imageReference: 'imageReference'
- /**
- * Label (occurs in definitions, image reference, image, link reference,
- * link).
- *
- * ```markdown
- * > | [a]: b "c"
- * ^^^
- * > | a [b] c
- * ^^^
- * > | a ![b][c] d
- * ^^^^
- * > | a [b](c) d
- * ^^^
- * ```
- */
- label: 'label'
- /**
- * Whole link.
- *
- * ```markdown
- * > | [a](b)
- * ^^^^^^
- * > | [c]
- * ^^^
- * ```
- */
- link: 'link'
- /**
- * Whole link reference.
- *
- * ```markdown
- * > | [a]
- * ^^^
- * ```
- */
- linkReference: 'linkReference'
- /**
- * List.
- *
- * ```markdown
- * > | * a
- * ^^^
- * > | 1. b
- * ^^^^
- * ```
- */
- list: 'list'
- /**
- * List item.
- *
- * ```markdown
- * > | * a
- * ^^^
- * > | 1. b
- * ^^^^
- * ```
- */
- listItem: 'listItem'
- /**
- * Paragraph.
- *
- * ```markdown
- * > | a b
- * ^^^
- * > | c.
- * ^^
- * ```
- */
- paragraph: 'paragraph'
- /**
- * Phrasing (occurs in headings, paragraphs, etc).
- *
- * ```markdown
- * > | a
- * ^
- * ```
- */
- phrasing: 'phrasing'
- /**
- * Reference (occurs in image, link).
- *
- * ```markdown
- * > | [a][]
- * ^^
- * ```
- */
- reference: 'reference'
- /**
- * Strong.
- *
- * ```markdown
- * > | **a**
- * ^^^^^
- * ```
- */
- strong: 'strong'
- /**
- * Title using single quotes (occurs in definition, image, link).
- *
- * ```markdown
- * > | [a](b 'c')
- * ^^^
- * ```
- */
- titleApostrophe: 'titleApostrophe'
- /**
- * Title using double quotes (occurs in definition, image, link).
- *
- * ```markdown
- * > | [a](b "c")
- * ^^^
- * ```
- */
- titleQuote: 'titleQuote'
- }
- /**
- * Construct names for things generated by `mdast-util-to-markdown`.
- *
- * This is an enum of strings, each being a semantic label, useful to know when
- * serializing whether we’re for example in a double (`"`) or single (`'`)
- * quoted title.
- */
- export type ConstructName = ConstructNameMap[keyof ConstructNameMap]
- export {toMarkdown} from './lib/index.js'
- export {handle as defaultHandlers} from './lib/handle/index.js'
- export type {
- Handle,
- Handlers,
- Info,
- Join,
- Map,
- Options,
- SafeConfig,
- State,
- Tracker,
- Unsafe
- } from './lib/types.js'
|