{"_id":"@depup/mdast-util-to-markdown","_rev":"3-6691a31704bbf9bd6f938aed626cf312","name":"@depup/mdast-util-to-markdown","dist-tags":{"latest":"2.2.0-depup.0"},"versions":{"2.1.2-depup.53":{"name":"@depup/mdast-util-to-markdown","version":"2.1.2-depup.53","keywords":["mdast-util-to-markdown","depup","updated-dependencies","security","latest","patched","ast","compile","markdown","markup","mdast-util","mdast","serialize","stringify","syntax","tree","unist","utility","util"],"author":{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"},"license":"MIT","_id":"@depup/mdast-util-to-markdown@2.1.2-depup.53","maintainers":[{"name":"chiefmikey","email":"wolfemikl@gmail.com"}],"contributors":[{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"}],"homepage":"https://github.com/syntax-tree/mdast-util-to-markdown#readme","bugs":{"url":"https://github.com/syntax-tree/mdast-util-to-markdown/issues"},"xo":{"rules":{"complexity":"off","unicorn/prefer-at":"off","unicorn/prefer-code-point":"off"},"prettier":true,"overrides":[{"files":["**/*.d.ts"],"rules":{"@typescript-eslint/ban-types":["error",{"extendDefaults":true}],"@typescript-eslint/array-type":["error",{"default":"generic"}],"@typescript-eslint/consistent-type-definitions":["error","interface"]}},{"files":["test/**/*.js"],"rules":{"max-depth":"off","no-await-in-loop":"off"}}]},"dist":{"shasum":"1bfb7ebc21073e271a2e74413968ec51f58c1387","tarball":"https://registry.npmjs.org/@depup/mdast-util-to-markdown/-/mdast-util-to-markdown-2.1.2-depup.53.tgz","fileCount":152,"integrity":"sha512-0pBlpDGWI4P5rllsLfOO9e48QzJioqJy5ga7eicghvseIspl0TRsdfCLmR5aVKulumVsc8zBP5s8azLCaTIXbA==","signatures":[{"sig":"MEQCIGK3Cbb7XeaqQnqRZRJAfEHdOshLf6Rga0e1lpkpIZziAiA8lYt7xjZwngFSMxvWkJK2Vaxq15GeHbKGlBNjC3QeBw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":151812},"type":"module","depup":{"changes":{"zwitch":{"to":"^2.0.4","from":"^2.0.0"},"@types/mdast":{"to":"^4.0.4","from":"^4.0.0"},"@types/unist":{"to":"^3.0.3","from":"^3.0.0"},"longest-streak":{"to":"^3.1.0","from":"^3.0.0"},"unist-util-visit":{"to":"^5.1.0","from":"^5.0.0"},"mdast-util-phrasing":{"to":"^4.1.0","from":"^4.0.0"},"micromark-util-decode-string":{"to":"^2.0.1","from":"^2.0.0"},"micromark-util-classify-character":{"to":"^2.0.1","from":"^2.0.0"}},"smokeTest":"passed","depsUpdated":8,"processedAt":"2026-07-21T17:25:14.845Z","originalPackage":"mdast-util-to-markdown","originalVersion":"2.1.2"},"types":"./index.d.ts","exports":"./index.js","funding":{"url":"https://opencollective.com/unified","type":"opencollective"},"gitHead":"bfea30d03284310a18b8f3e77c16d083b0536576","scripts":{"test":"npm run build && npm run format && npm run test-coverage","build":"tsc --build --clean && tsc --build && type-coverage","format":"remark . -qfo && prettier . -w --log-level warn && xo --fix","test-api":"node --conditions development test/index.js","test-coverage":"c8 --100 --reporter lcov npm run test-api"},"_npmUser":{"name":"chiefmikey","email":"wolfemikl@gmail.com"},"prettier":{"semi":false,"useTabs":false,"tabWidth":2,"singleQuote":true,"trailingComma":"none","bracketSpacing":false},"repository":{"url":"git+https://github.com/syntax-tree/mdast-util-to-markdown.git","type":"git"},"_npmVersion":"11.16.0","description":"mdast utility to serialize markdown (with updated dependencies)","directories":{},"sideEffects":false,"_nodeVersion":"24.18.0","dependencies":{"zwitch":"^2.0.4","@types/mdast":"^4.0.4","@types/unist":"^3.0.3","longest-streak":"^3.1.0","unist-util-visit":"^5.1.0","mdast-util-phrasing":"^4.1.0","mdast-util-to-string":"^4.0.0","micromark-util-decode-string":"^2.0.1","micromark-util-classify-character":"^2.0.1"},"remarkConfig":{"plugins":["remark-preset-wooorm"]},"typeCoverage":{"strict":true,"atLeast":100,"ignoreFiles":["lib/types.d.ts"]},"_hasShrinkwrap":false,"devDependencies":{"c8":"^10.0.0","xo":"^0.59.0","prettier":"^3.0.0","remark-cli":"^12.0.0","typescript":"^5.0.0","@types/node":"^22.0.0","type-coverage":"^2.0.0","remark-preset-wooorm":"^10.0.0","mdast-util-from-markdown":"^2.0.0","unist-util-remove-position":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/mdast-util-to-markdown_2.1.2-depup.53_1784654726275_0.7697854492120357","host":"s3://npm-registry-packages-npm-production"}},"2.1.3-depup.0":{"name":"@depup/mdast-util-to-markdown","version":"2.1.3-depup.0","keywords":["mdast-util-to-markdown","depup","updated-dependencies","security","latest","patched","ast","compile","markdown","markup","mdast-util","mdast","serialize","stringify","syntax","tree","unist","utility","util"],"author":{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"},"license":"MIT","_id":"@depup/mdast-util-to-markdown@2.1.3-depup.0","maintainers":[{"name":"chiefmikey","email":"wolfemikl@gmail.com"}],"contributors":[{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"}],"homepage":"https://github.com/syntax-tree/mdast-util-to-markdown#readme","bugs":{"url":"https://github.com/syntax-tree/mdast-util-to-markdown/issues"},"dist":{"shasum":"31fb89196f845d948f270f080219fad8c1fd9415","tarball":"https://registry.npmjs.org/@depup/mdast-util-to-markdown/-/mdast-util-to-markdown-2.1.3-depup.0.tgz","fileCount":156,"integrity":"sha512-ctVNNAPSmjRQzRc2Akt9Dxfcm5XFIX+y0NbZ6i/vRJTY45vCaPP4wv+mClK6Cy+Ae3JCJLxF2P9Fiqon+jTg8g==","signatures":[{"sig":"MEYCIQChQg4ooUjbRNkUC+JsXU+PaH9xySlz3pQwh/+JnhmCzAIhAO6tckSUiceVw6CHP8RtWmarNAijQ4e2lywUTFg58wIQ","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQC4fxUKAruRPRn9LyM9yjfnUBwhmm3+Qnz1KVspTWfNbAIgep2zOGp34Xe66EN+KmjW2yuT353F1I/cmMlsslxVRwQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":192735},"type":"module","depup":{"changes":{"zwitch":{"to":"^2.0.4","from":"^2.0.0"},"@types/mdast":{"to":"^4.0.4","from":"^4.0.0"},"@types/unist":{"to":"^3.0.3","from":"^3.0.0"},"longest-streak":{"to":"^3.1.0","from":"^3.0.0"},"unist-util-visit":{"to":"^5.1.0","from":"^5.0.0"},"mdast-util-phrasing":{"to":"^4.1.0","from":"^4.0.0"},"micromark-util-character":{"to":"^2.1.1","from":"^2.0.0"},"micromark-util-decode-string":{"to":"^2.0.1","from":"^2.0.0"},"micromark-util-html-tag-name":{"to":"^2.0.1","from":"^2.0.0"},"micromark-util-classify-character":{"to":"^2.0.1","from":"^2.0.0"}},"smokeTest":"passed","depsUpdated":10,"processedAt":"2026-09-27T16:09:40.445Z","originalPackage":"mdast-util-to-markdown","originalVersion":"2.1.3"},"types":"./index.d.ts","exports":"./index.js","funding":{"url":"https://opencollective.com/unified","type":"opencollective"},"gitHead":"435741f8f74140a5b090cdb50ccb4d3e03d41e3e","scripts":{"test":"npm run build && npm run format && npm run test-coverage","build":"tsc --build --clean && tsc --build && type-coverage","format":"remark --frail --output --quiet -- . && prettier --log-level warn --write -- . && xo --fix","test-api":"node --conditions development test/index.js","test-coverage":"c8 --100 --reporter lcov -- npm run test-api"},"_npmUser":{"name":"chiefmikey","email":"wolfemikl@gmail.com"},"prettier":{"semi":false,"useTabs":false,"tabWidth":2,"singleQuote":true,"trailingComma":"none","bracketSpacing":false},"repository":{"url":"git+https://github.com/syntax-tree/mdast-util-to-markdown.git","type":"git"},"_npmVersion":"11.19.0","description":"mdast utility to serialize markdown (with updated dependencies)","directories":{},"sideEffects":false,"_nodeVersion":"24.21.0","dependencies":{"zwitch":"^2.0.4","@types/mdast":"^4.0.4","@types/unist":"^3.0.3","longest-streak":"^3.1.0","unist-util-visit":"^5.1.0","mdast-util-phrasing":"^4.1.0","mdast-util-to-string":"^4.0.0","micromark-util-character":"^2.1.1","micromark-util-decode-string":"^2.0.1","micromark-util-html-tag-name":"^2.0.1","micromark-util-classify-character":"^2.0.1"},"remarkConfig":{"plugins":["remark-preset-wooorm"]},"typeCoverage":{"strict":true,"atLeast":100},"_hasShrinkwrap":false,"devDependencies":{"c8":"^12.0.0","xo":"^5.0.0","prettier":"^3.0.0","remark-cli":"^12.0.0","typescript":"^6.0.0","@types/node":"^26.0.0","type-coverage":"^2.0.0","remark-preset-wooorm":"^11.0.0","mdast-util-from-markdown":"^2.0.0","unist-util-remove-position":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/mdast-util-to-markdown_2.1.3-depup.0_1790525440309_0.22625721568092128","host":"s3://npm-registry-packages-npm-production"}},"2.2.0-depup.0":{"_id":"@depup/mdast-util-to-markdown@2.2.0-depup.0","bugs":{"url":"https://github.com/syntax-tree/mdast-util-to-markdown/issues"},"dist":{"shasum":"6d9991259b2260ed35ef6ce17c6f0fd916ab1438","tarball":"https://registry.npmjs.org/@depup/mdast-util-to-markdown/-/mdast-util-to-markdown-2.2.0-depup.0.tgz","fileCount":156,"integrity":"sha512-RItQqGcBujotzlaek/QsyKXK/b+mvpkIZ4B+IDJsrvG1baI2wAz2lglcCRyLu862KdyP5FK4v2MCKGxw2d9+0Q==","signatures":[{"sig":"MEUCIQDpBForqd15jESye4UEZ3jbnImadPXplabCx0yF2OMaRAIgCPhJ/YS7JdTHq3g3cTBmNtP6+zL8H5+b17doh2x/kJM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDF45WpzFt7ViGkso/peW8mvjQMpHNA8MC4mfmT01SjkwIhAIuAxDX9Jn1782mp3WBjMxZI1swPIjaNutvo3mSMmNHA"}],"unpackedSize":194793},"name":"@depup/mdast-util-to-markdown","type":"module","depup":{"changes":{"zwitch":{"to":"^2.0.4","from":"^2.0.0"},"@types/mdast":{"to":"^4.0.4","from":"^4.0.0"},"@types/unist":{"to":"^3.0.3","from":"^3.0.0"},"longest-streak":{"to":"^3.1.0","from":"^3.0.0"},"unist-util-visit":{"to":"^5.1.0","from":"^5.0.0"},"mdast-util-phrasing":{"to":"^4.1.0","from":"^4.0.0"},"micromark-util-character":{"to":"^2.1.1","from":"^2.0.0"},"micromark-util-decode-string":{"to":"^2.0.1","from":"^2.0.0"},"micromark-util-html-tag-name":{"to":"^2.0.1","from":"^2.0.0"},"micromark-util-classify-character":{"to":"^2.0.1","from":"^2.0.0"}},"smokeTest":"passed","depsUpdated":10,"processedAt":"2026-10-03T17:23:06.158Z","originalPackage":"mdast-util-to-markdown","originalVersion":"2.2.0"},"types":"./index.d.ts","author":{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"},"exports":"./index.js","funding":{"url":"https://opencollective.com/unified","type":"opencollective"},"gitHead":"9b9c028837755709989d8477cb6d466c5087ed2d","license":"MIT","scripts":{"test":"npm run build && npm run format && npm run test-coverage","build":"tsc --build --clean && tsc --build && type-coverage","format":"remark --frail --output --quiet -- . && prettier --log-level warn --write -- . && xo --fix","test-api":"node --conditions development test/index.js","test-coverage":"c8 --100 --reporter lcov -- npm run test-api"},"version":"2.2.0-depup.0","_npmUser":{"name":"chiefmikey","email":"wolfemikl@gmail.com"},"homepage":"https://github.com/syntax-tree/mdast-util-to-markdown#readme","keywords":["mdast-util-to-markdown","depup","updated-dependencies","security","latest","patched","ast","compile","markdown","markup","mdast-util","mdast","serialize","stringify","syntax","tree","unist","utility","util"],"prettier":{"semi":false,"useTabs":false,"tabWidth":2,"singleQuote":true,"trailingComma":"none","bracketSpacing":false},"repository":{"url":"git+https://github.com/syntax-tree/mdast-util-to-markdown.git","type":"git"},"_npmVersion":"11.19.0","description":"mdast utility to serialize markdown (with updated dependencies)","directories":{},"maintainers":[{"name":"chiefmikey","email":"wolfemikl@gmail.com"}],"sideEffects":false,"_nodeVersion":"24.21.0","contributors":[{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"}],"dependencies":{"zwitch":"^2.0.4","@types/mdast":"^4.0.4","@types/unist":"^3.0.3","longest-streak":"^3.1.0","unist-util-visit":"^5.1.0","mdast-util-phrasing":"^4.1.0","mdast-util-to-string":"^4.0.0","micromark-util-character":"^2.1.1","micromark-util-decode-string":"^2.0.1","micromark-util-html-tag-name":"^2.0.1","micromark-util-classify-character":"^2.0.1"},"remarkConfig":{"plugins":["remark-preset-wooorm"]},"typeCoverage":{"strict":true,"atLeast":100},"_hasShrinkwrap":false,"devDependencies":{"c8":"^12.0.0","xo":"^5.0.0","prettier":"^3.0.0","remark-cli":"^12.0.0","typescript":"^6.0.0","@types/node":"^26.0.0","type-coverage":"^2.0.0","remark-preset-wooorm":"^11.0.0","mdast-util-from-markdown":"^2.0.0","unist-util-remove-position":"^5.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mdast-util-to-markdown_2.2.0-depup.0_1791048253254_0.055062131344564946"}}},"time":{"created":"2026-07-21T17:25:26.175Z","modified":"2026-10-03T17:24:13.559Z","2.1.2-depup.53":"2026-07-21T17:25:26.417Z","2.1.3-depup.0":"2026-09-27T16:10:40.411Z","2.2.0-depup.0":"2026-10-03T17:24:13.339Z"},"bugs":{"url":"https://github.com/syntax-tree/mdast-util-to-markdown/issues"},"author":{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"},"license":"MIT","homepage":"https://github.com/syntax-tree/mdast-util-to-markdown#readme","keywords":["mdast-util-to-markdown","depup","updated-dependencies","security","latest","patched","ast","compile","markdown","markup","mdast-util","mdast","serialize","stringify","syntax","tree","unist","utility","util"],"repository":{"url":"git+https://github.com/syntax-tree/mdast-util-to-markdown.git","type":"git"},"description":"mdast utility to serialize markdown (with updated dependencies)","contributors":[{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"}],"maintainers":[{"name":"chiefmikey","email":"wolfemikl@gmail.com"}],"readme":"# mdast-util-to-markdown\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\n**[mdast][github-mdast]** utility that turns a syntax tree into markdown.\n\n## Contents\n\n* [What is this?](#what-is-this)\n* [When should I use this?](#when-should-i-use-this)\n* [Install](#install)\n* [Use](#use)\n* [API](#api)\n  * [`toMarkdown(tree[, options])`](#tomarkdowntree-options)\n  * [`defaultHandlers`](#defaulthandlers)\n  * [`Attention`](#attention)\n  * [`AttentionInfo`](#attentioninfo)\n  * [`ConstructName`](#constructname)\n  * [`ConstructNameMap`](#constructnamemap)\n  * [`Handle`](#handle)\n  * [`Handlers`](#handlers)\n  * [`Info`](#info)\n  * [`Join`](#join)\n  * [`Map`](#map)\n  * [`Options`](#options)\n  * [`SafeConfig`](#safeconfig)\n  * [`State`](#state)\n  * [`Tracker`](#tracker)\n  * [`Unsafe`](#unsafe)\n* [List of extensions](#list-of-extensions)\n* [Syntax](#syntax)\n* [Syntax tree](#syntax-tree)\n* [Types](#types)\n* [Compatibility](#compatibility)\n* [Security](#security)\n* [Related](#related)\n* [Contribute](#contribute)\n* [License](#license)\n\n## What is this?\n\nThis package is a utility that takes an [mdast][github-mdast]\nsyntax tree as input and turns it into serialized markdown.\n\nThis utility is a low level project.\nIt’s used in [`remark-stringify`][github-remark-stringify],\nwhich focusses on making it easier to transform content by abstracting\nthese internals away.\n\n## When should I use this?\n\nIf you want to handle syntax trees manually, use this.\nFor an easier time processing content, use the **[remark][github-remark]**\necosystem instead.\n\nYou can combine this utility with other utilities to add syntax extensions.\nNotable examples that deeply integrate with it are\n[`mdast-util-gfm`][github-mdast-util-gfm],\n[`mdast-util-mdx`][github-mdast-util-mdx],\n[`mdast-util-frontmatter`][github-mdast-util-frontmatter],\n[`mdast-util-math`][github-mdast-util-math], and\n[`mdast-util-directive`][github-mdast-util-directive].\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install mdast-util-to-markdown\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {toMarkdown} from 'https://esm.sh/mdast-util-to-markdown@2'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {toMarkdown} from 'https://esm.sh/mdast-util-to-markdown@2?bundle'\n</script>\n```\n\n## Use\n\nSay our module `example.js` looks as follows:\n\n```js\n/**\n * @import {Root} from 'mdast'\n */\n\nimport {toMarkdown} from 'mdast-util-to-markdown'\n\n/** @type {Root} */\nconst tree = {\n  type: 'root',\n  children: [\n    {\n      type: 'blockquote',\n      children: [\n        {type: 'thematicBreak'},\n        {\n          type: 'paragraph',\n          children: [\n            {type: 'text', value: '- a\\nb !'},\n            {\n              type: 'link',\n              url: 'example.com',\n              children: [{type: 'text', value: 'd'}]\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}\n\nconsole.log(toMarkdown(tree))\n```\n\n…now running `node example.js` yields:\n\n```markdown\n> ***\n>\n> \\- a\n> b \\![d](example.com)\n```\n\n> 👉 **Note**: observe the properly escaped characters which would otherwise\n> turn into a list and image respectively.\n\n## API\n\nThis package exports the identifiers [`defaultHandlers`][api-default-handlers]\nand [`toMarkdown`][api-to-markdown].\nThere is no default export.\n\n### `toMarkdown(tree[, options])`\n\nTurn an **[mdast][github-mdast]** syntax tree into markdown.\n\n###### Parameters\n\n* `tree` ([`Node`][github-mdast-nodes])\n  — tree to serialize\n* `options` ([`Options`][api-options], optional)\n  — configuration\n\n###### Returns\n\nSerialized markdown representing `tree` (`string`).\n\n### `defaultHandlers`\n\nDefault (CommonMark) handlers ([`Handlers`][api-handlers]).\n\n### `Attention`\n\nSerialize a node as attention (emphasis, strong, strikethrough) (TypeScript\ntype).\n\nSet as the `attention` field of a [`Handle`][api-handle]\n(`handle.attention = x`).\nThis switches to a different algorithm,\nwhere attention is properly handled by `containerPhrasing`.\n\n###### Parameters\n\n* `node` (`any`)\n  — expected mdast node\n* `state` ([`State`][api-state])\n  — info passed around about the current state\n\n###### Returns\n\nInfo on how to serialize `node` ([`AttentionInfo`][api-attention-info]).\n\n### `AttentionInfo`\n\nInfo on how to serialize attention (TypeScript type).\n\n###### Fields\n\n* `construct` ([`ConstructName`][api-construct-name])\n  — construct to enter (such as `'emphasis'`)\n* `markers` (`Array<string>`)\n  — markers that can be used in order of preference (such as `['*', '_']`);\n  one or more strings, each just one ASCII punctuation character\n* `sizes` (`Array<number>`)\n  — sizes of sequences that can be used in order of preference (such as `[2]`\n  for strong or `[2, 1]` for GFM strikethrough);\n  one or more numbers, each a positive integer\n\n### `ConstructName`\n\nConstruct names for things generated by `mdast-util-to-markdown` (TypeScript\ntype).\n\nThis is an enum of strings, each being a semantic label, useful to know when\nserializing whether we’re for example in a double (`\"`) or single (`'`) quoted\ntitle.\n\n###### Type\n\n```ts\ntype ConstructName = ConstructNameMap[keyof ConstructNameMap]\n```\n\n### `ConstructNameMap`\n\nInterface of registered constructs (TypeScript type).\n\n###### Type\n\n```ts\ninterface ConstructNameMap { /* see code */ }\n```\n\nWhen working on extensions that use new constructs, extend the corresponding\ninterface to register its name:\n\n```ts\ndeclare module 'mdast-util-to-markdown' {\n  interface ConstructNameMap {\n    // Register a new construct name (value is used, key should match it).\n    gfmStrikethrough: 'gfmStrikethrough'\n  }\n}\n```\n\n### `Handle`\n\nHandle a particular node (TypeScript type).\n\n###### Parameters\n\n* `node` (`any`)\n  — expected mdast node\n* `parent` ([`Node`][github-mdast-nodes], optional)\n  — parent of `node`\n* `state` ([`State`][api-state])\n  — info passed around about the current state\n* `info` ([`Info`][api-info])\n  — info on the surrounding of the node that is serialized\n\n###### Returns\n\nSerialized markdown representing `node` (`string`).\n\n### `Handlers`\n\nHandle particular nodes (TypeScript type).\n\nEach key is a node type (`Node['type']`), each value its corresponding handler\n([`Handle`][api-handle]).\n\n###### Type\n\n```ts\ntype Handlers = Record<Node['type'], Handle>\n```\n\n### `Info`\n\nInfo on the surrounding of the node that is serialized (TypeScript type).\n\n###### Fields\n\n* `now` ([`Point`][github-unist-point])\n  — current point\n* `lineShift` (`number`)\n  — number of columns each line will be shifted by wrapping nodes\n* `before` (`string`)\n  — characters before this (guaranteed to be one, can be more)\n* `after` (`string`)\n  — characters after this (guaranteed to be one, can be more)\n\n### `Join`\n\nHow to join two blocks (TypeScript type).\n\n“Blocks” are typically joined by one blank line.\nSometimes it’s nicer to have them flush next to each other, yet other times\nthey cannot occur together at all.\n\nJoin functions receive two adjacent siblings and their parent and what they\nreturn defines how many blank lines to use between them.\n\n###### Parameters\n\n* `left` ([`Node`][github-mdast-nodes])\n  — first of two adjacent siblings\n* `right` ([`Node`][github-mdast-nodes])\n  — second of two adjacent siblings\n* `parent` ([`Node`][github-mdast-nodes])\n  — parent of the two siblings\n* `state` ([`State`][api-state])\n  — info passed around about the current state\n\n###### Returns\n\nHow many blank lines to use between the siblings (`boolean`, `number`,\noptional).\n\nWhere `true` is as passing `1` and `false` means the nodes cannot be\njoined by a blank line, such as two adjacent block quotes or indented code\nafter a list, in which case a comment will be injected to break them up:\n\n```markdown\n> Quote 1\n\n<!---->\n\n> Quote 2\n```\n\n> 👉 **Note**: abusing this feature will break markdown.\n> One such example is when returning `0` for two paragraphs, which will result\n> in the text running together, and in the future to be seen as one paragraph.\n\n### `Map`\n\nMap function to pad a single line (TypeScript type).\n\n###### Parameters\n\n* `value` (`string`)\n  — a single line of serialized markdown\n* `line` (`number`)\n  — line number relative to the fragment\n* `blank` (`boolean`)\n  — whether the line is considered blank in markdown\n\n###### Returns\n\nPadded line (`string`).\n\n### `Options`\n\nConfiguration (TypeScript type).\n\n##### Fields\n\nThe following fields influence how markdown is serialized.\n\n###### `options.bullet`\n\nMarker to use for bullets of items in unordered lists (`'*'`, `'+'`, or `'-'`,\ndefault: `'*'`).\n\nThere are three cases where the primary bullet cannot be used:\n\n* when three or more list items are on their own, the last one is empty, and\n  `bullet` is also a valid `rule`: `* - +`; this would turn into a thematic\n  break if serialized with three primary bullets; `bulletOther` is used for\n  the last item\n* when a thematic break is the first child of a list item and `bullet` is the\n  same character as `rule`: `- ***`; this would turn into a single thematic\n  break if serialized with primary bullets; `bulletOther` is used for the\n  item\n* when two unordered lists appear next to each other: `* a\\n- b`;\n  `bulletOther` is used for such lists\n\n###### `options.bulletOther`\n\nMarker to use in certain cases where the primary bullet doesn’t work (`'*'`,\n`'+'`, or `'-'`, default: `'-'` when `bullet` is `'*'`, `'*'` otherwise).\n\nCannot be equal to `bullet`.\n\n###### `options.bulletOrdered`\n\nMarker to use for bullets of items in ordered lists (`'.'` or `')'`, default:\n`'.'`).\n\nThere is one case where the primary bullet for ordered items cannot be used:\n\n* when two ordered lists appear next to each other: `1. a\\n2) b`; to solve\n  that, `'.'` will be used when `bulletOrdered` is `')'`, and `'.'` otherwise\n\n###### `options.closeAtx`\n\nWhether to add the same number of number signs (`#`) at the end of an ATX\nheading as the opening sequence (`boolean`, default: `false`).\n\n###### `options.emphasis`\n\nPreferred marker to use for emphasis (`'*'` or `'_'`, default: `'*'`).\n\nThe other marker is sometimes used, to form for example emphasis next to or\ninside of other emphasis (`*a*_b_`).\n\n###### `options.fence`\n\nMarker to use for fenced code (``'`'`` or `'~'`, default: ``'`'``).\n\n###### `options.fences`\n\nWhether to use fenced code always (`boolean`, default: `true`).\nThe default is to use fenced code if there is a language defined, if the code is\nempty, or if it starts or ends in blank lines.\n\n###### `options.incrementListMarker`\n\nWhether to increment the counter of ordered lists items (`boolean`, default:\n`true`).\n\n###### `options.listItemIndent`\n\nHow to indent the content of list items (`'mixed'`, `'one'`, or `'tab'`,\ndefault: `'one'`).\nEither with the size of the bullet plus one space (when `'one'`), a tab stop\n(`'tab'`), or depending on the item and its parent list (`'mixed'`, uses `'one'`\nif the item and list are tight and `'tab'` otherwise).\n\n###### `options.quote`\n\nMarker to use for titles (`'\"'` or `\"'\"`, default: `'\"'`).\n\n###### `options.resourceLink`\n\nWhether to always use resource links (`boolean`, default: `false`).\nThe default is to use autolinks (`<https://example.com>`) when possible\nand resource links (`[text](url)`) otherwise.\n\n###### `options.rule`\n\nMarker to use for thematic breaks (`'*'`, `'-'`, or `'_'`, default: `'*'`).\n\n###### `options.ruleRepetition`\n\nNumber of markers to use for thematic breaks (`number`, default: `3`, min: `3`).\n\n###### `options.ruleSpaces`\n\nWhether to add spaces between markers in thematic breaks (`boolean`, default:\n`false`).\n\n###### `options.setext`\n\nWhether to use setext headings when possible (`boolean`, default: `false`).\nThe default is to always use ATX headings (`# heading`) instead of setext\nheadings (`heading\\n=======`).\nSetext headings cannot be used for empty headings or headings with a rank of\nthree or more.\n\n###### `options.strong`\n\nPreferred marker to use for strong (`'*'` or `'_'`, default: `'*'`).\n\nThe other marker is sometimes used, to form for example strong next to or\ninside of other strong (`**a**__b__`).\n\n###### `options.tightDefinitions`\n\nWhether to join definitions without a blank line (`boolean`, default: `false`).\n\nThe default is to add blank lines between any flow (“block”) construct.\nTurning this option on is a shortcut for a [`Join`][api-join] function like so:\n\n```js\nfunction joinTightDefinitions(left, right) {\n  if (left.type === 'definition' && right.type === 'definition') {\n    return 0\n  }\n}\n```\n\n###### `options.handlers`\n\nHandle particular nodes ([`Handlers`][api-handlers], optional).\n\n###### `options.join`\n\nHow to join blocks ([`Array<Join>`][api-join], optional).\n\n###### `options.unsafe`\n\nSchemas that define when characters cannot occur\n([`Array<Unsafe>`][api-unsafe], optional).\n\n###### `options.extensions`\n\nList of extensions (`Array<Options>`, default: `[]`).\nEach extension is an object with the same interface as `Options` itself.\n\n### `SafeConfig`\n\nConfiguration passed to `state.safe` (TypeScript type).\n\n###### Fields\n\n* `before` (`string`)\n  — characters before this (guaranteed to be one, can be more)\n* `beforeNode` ([`Node`][github-mdast-nodes], optional)\n  — node directly before the value\n* `after` (`string`)\n  — characters after this (guaranteed to be one, can be more)\n* `afterNode` ([`Node`][github-mdast-nodes], optional)\n  — node directly after the value\n* `encode` (`Array<string>`, optional)\n  — extra characters that *must* be encoded (as character references) instead\n  of escaped (character escapes).\n  Only ASCII punctuation will use character escapes, so you never need to\n  pass non-ASCII-punctuation here\n\n### `State`\n\nInfo passed around about the current state (TypeScript type).\n\n###### Fields\n\n* `stack` ([`Array<ConstructName>`][api-construct-name])\n  — stack of constructs we’re in\n* `indexStack` (`Array<number>`)\n  — positions of child nodes in their parents\n* `associationId` (`(node: Association) => string`)\n  — get an identifier from an association to match it to others (see\n  [`Association`][github-mdast-association])\n* `enter` (`(construct: ConstructName) => () => undefined`)\n  — enter a construct (returns a corresponding exit function)\n  (see [`ConstructName`][api-construct-name])\n* `indentLines` (`(value: string, map: Map) => string`)\n  — pad serialized markdown (see [`Map`][api-map])\n* `compilePattern` (`(pattern: Unsafe) => RegExp`)\n  — compile an unsafe pattern to a regex (see [`Unsafe`][api-unsafe])\n* `containerFlow` (`(parent: Node, info: Info) => string`)\n  — serialize flow children (see [`Info`][api-info])\n* `containerPhrasing` (`(parent: Node, info: Info) => string`)\n  — serialize phrasing children (see [`Info`][api-info])\n* `createTracker` (`(info: Info) => Tracker`)\n  — track positional info in the output (see [`Info`][api-info],\n  [`Tracker`][api-tracker])\n* `safe` (`(value: string, config: SafeConfig) => string`)\n  — make a string safe for embedding (see [`SafeConfig`][api-safe-config])\n* `options` ([`Options`][api-options])\n  — applied user configuration\n* `unsafe` ([`Array<Unsafe>`][api-unsafe])\n  — applied unsafe patterns\n* `join` ([`Array<Join>`][api-join])\n  — applied join handlers\n* `handle` ([`Handle`][api-handle])\n  — call the configured handler for the given node\n* `handlers` ([`Handlers`][api-handlers])\n  — applied handlers\n* `bulletCurrent` (`string` or `undefined`)\n  — list marker currently in use\n* `bulletLastUsed` (`string` or `undefined`)\n  — list marker previously in use\n\n### `Tracker`\n\nTrack positional info in the output (TypeScript type).\n\nThis info isn’t used yet but such functionality will allow line wrapping,\nsource maps, etc.\n\n###### Fields\n\n* `current` (`() => Info`)\n  — get current tracked info\n* `shift` (`(value: number) => undefined`)\n  — define a relative increased line shift (the typical indent for lines)\n* `move` (`(value: string) => string`)\n  — move past some generated markdown\n\n### `Unsafe`\n\nSchema that defines when a character cannot occur (TypeScript type).\n\n###### Fields\n\n* `afterNode` (`Array<string>`, optional)\n  — `character` is bad when these nodes are after it\n* `after` (`string`, optional)\n  — `character` is bad when this is after it\n* `atBreak` (`boolean`, optional)\n  — `character` is bad at a break (potentially w/ `before` between)\n* `beforeNode` (`Array<string>`, optional)\n  — `character` is bad when these nodes are before it\n* `before` (`string`, optional)\n  — `character` is bad when this is before it\n* `character` (`string`)\n  — single unsafe character\n* `inConstruct` ([`Array<ConstructName>`][api-construct-name],\n  `ConstructName`, optional)\n  — constructs where this is bad\n* `notInConstruct` ([`Array<ConstructName>`][api-construct-name],\n  `ConstructName`, optional)\n  — constructs where this is fine again\n* `unicode` (`boolean`, default: `false`)\n  — compile the regex with `u`\n\n## List of extensions\n\n* [`syntax-tree/mdast-util-directive`][github-mdast-util-directive]\n  — directives\n* [`syntax-tree/mdast-util-frontmatter`][github-mdast-util-frontmatter]\n  — frontmatter (YAML, TOML, more)\n* [`syntax-tree/mdast-util-gfm`][github-mdast-util-gfm]\n  — GFM\n* [`syntax-tree/mdast-util-gfm-autolink-literal`](https://github.com/syntax-tree/mdast-util-gfm-autolink-literal)\n  — GFM autolink literals\n* [`syntax-tree/mdast-util-gfm-footnote`](https://github.com/syntax-tree/mdast-util-gfm-footnote)\n  — GFM footnotes\n* [`syntax-tree/mdast-util-gfm-strikethrough`](https://github.com/syntax-tree/mdast-util-gfm-strikethrough)\n  — GFM strikethrough\n* [`syntax-tree/mdast-util-gfm-table`](https://github.com/syntax-tree/mdast-util-gfm-table)\n  — GFM tables\n* [`syntax-tree/mdast-util-gfm-task-list-item`](https://github.com/syntax-tree/mdast-util-gfm-task-list-item)\n  — GFM task list items\n* [`syntax-tree/mdast-util-math`][github-mdast-util-math]\n  — math\n* [`syntax-tree/mdast-util-mdx`][github-mdast-util-mdx]\n  — MDX\n* [`syntax-tree/mdast-util-mdx-expression`](https://github.com/syntax-tree/mdast-util-mdx-expression)\n  — MDX expressions\n* [`syntax-tree/mdast-util-mdx-jsx`](https://github.com/syntax-tree/mdast-util-mdx-jsx)\n  — MDX JSX\n* [`syntax-tree/mdast-util-mdxjs-esm`](https://github.com/syntax-tree/mdast-util-mdxjs-esm)\n  — MDX ESM\n\n## Syntax\n\nMarkdown is serialized according to CommonMark but care is taken to format in\nsuch a way that the resulting markdown should work with most markdown parsers.\nExtensions can add support for custom syntax.\n\n## Syntax tree\n\nThe syntax tree is [mdast][github-mdast].\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional types\n[`Attention`][api-attention],\n[`AttentionInfo`][api-attention-info],\n[`ConstructName`][api-construct-name],\n[`ConstructNameMap`][api-construct-name-map],\n[`Handle`][api-handle],\n[`Handlers`][api-handlers],\n[`Info`][api-info],\n[`Join`][api-join],\n[`Map`][api-map],\n[`Options`][api-options],\n[`SafeConfig`][api-safe-config],\n[`State`][api-State], and\n[`Unsafe`][api-Unsafe].\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line, `mdast-util-to-markdown@^2`,\ncompatible with Node.js 16.\n\n## Security\n\n`mdast-util-to-markdown` will do its best to serialize markdown to match the\nsyntax tree, but there are several cases where that is impossible.\nIt’ll do its best, but complete roundtripping is impossible given that any value\ncould be injected into the tree.\n\nAs markdown is sometimes used for HTML, and improper use of HTML can open you up\nto a [cross-site scripting (XSS)][wikipedia-xss] attack,\nuse of `mdast-util-to-markdown`\nand parsing it again later could potentially be unsafe.\nWhen parsing markdown afterwards and then going to HTML, use something like\n[`hast-util-sanitize`][github-hast-util-sanitize] to make the tree safe.\n\n## Related\n\n* [`syntax-tree/mdast-util-from-markdown`](https://github.com/syntax-tree/mdast-util-from-markdown)\n  — parse markdown to mdast\n* [`micromark/micromark`](https://github.com/micromark/micromark)\n  — parse markdown\n* [`remarkjs/remark`][github-remark]\n  — process markdown\n\n## Contribute\n\nSee [`contributing.md`][health-contributing] in\n[`syntax-tree/.github`][health] for\nways to get started.\nSee [`support.md`][health-support] for ways to get help.\n\nThis project has a [code of conduct][health-coc].\nBy interacting with this repository, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © [Titus Wormer][wooorm]\n\n<!-- Definitions -->\n\n[api-attention]: #attention\n\n[api-attention-info]: #attentioninfo\n\n[api-construct-name]: #constructname\n\n[api-construct-name-map]: #constructnamemap\n\n[api-default-handlers]: #defaulthandlers\n\n[api-handle]: #handle\n\n[api-handlers]: #handlers\n\n[api-info]: #info\n\n[api-join]: #join\n\n[api-map]: #map\n\n[api-options]: #options\n\n[api-safe-config]: #safeconfig\n\n[api-state]: #state\n\n[api-to-markdown]: #tomarkdowntree-options\n\n[api-tracker]: #tracker\n\n[api-unsafe]: #unsafe\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[build]: https://github.com/syntax-tree/mdast-util-to-markdown/actions\n\n[build-badge]: https://github.com/syntax-tree/mdast-util-to-markdown/workflows/main/badge.svg\n\n[chat]: https://github.com/syntax-tree/unist/discussions\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[collective]: https://opencollective.com/unified\n\n[coverage]: https://codecov.io/github/syntax-tree/mdast-util-to-markdown\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-to-markdown.svg\n\n[downloads]: https://www.npmjs.com/package/mdast-util-to-markdown\n\n[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-to-markdown.svg\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[github-hast-util-sanitize]: https://github.com/syntax-tree/hast-util-sanitize\n\n[github-mdast]: https://github.com/syntax-tree/mdast\n\n[github-mdast-association]: https://github.com/syntax-tree/mdast#association\n\n[github-mdast-nodes]: https://github.com/syntax-tree/mdast#nodes\n\n[github-mdast-util-directive]: https://github.com/syntax-tree/mdast-util-directive\n\n[github-mdast-util-frontmatter]: https://github.com/syntax-tree/mdast-util-frontmatter\n\n[github-mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm\n\n[github-mdast-util-math]: https://github.com/syntax-tree/mdast-util-math\n\n[github-mdast-util-mdx]: https://github.com/syntax-tree/mdast-util-mdx\n\n[github-remark]: https://github.com/remarkjs/remark\n\n[github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify\n\n[github-unist-point]: https://github.com/syntax-tree/unist#point\n\n[health]: https://github.com/syntax-tree/.github\n\n[health-coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md\n\n[health-contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md\n\n[health-support]: https://github.com/syntax-tree/.github/blob/main/support.md\n\n[license]: license\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[size]: https://bundlejs.com/?q=mdast-util-to-markdown\n\n[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=mdast-util-to-markdown\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[typescript]: https://www.typescriptlang.org\n\n[wikipedia-xss]: https://en.wikipedia.org/wiki/Cross-site_scripting\n\n[wooorm]: https://wooorm.com\n","readmeFilename":"readme.md"}