88[ ![ Backers] [ backers-badge ]] [ collective ]
99[ ![ Chat] [ chat-badge ]] [ chat ]
1010
11- ** [ mdast] [ ] ** utility that turns a syntax tree into markdown.
11+ ** [ mdast] [ github-mdast ] ** utility that turns a syntax tree into markdown.
1212
1313## Contents
1414
4343
4444## What is this?
4545
46- This package is a utility that takes an [ mdast] [ ] syntax tree as input and turns
47- it into serialized markdown.
46+ This package is a utility that takes an [ mdast] [ github-mdast ]
47+ syntax tree as input and turns it into serialized markdown.
4848
4949This utility is a low level project.
50- It’s used in [ ` remark-stringify ` ] [ remark-stringify ] , which focusses on making it
51- easier to transform content by abstracting these internals away.
50+ It’s used in [ ` remark-stringify ` ] [ github-remark-stringify ] ,
51+ which focusses on making it easier to transform content by abstracting
52+ these internals away.
5253
5354## When should I use this?
5455
5556If you want to handle syntax trees manually, use this.
56- For an easier time processing content, use the ** [ remark] [ ] ** ecosystem instead.
57+ For an easier time processing content, use the ** [ remark] [ github-remark ] **
58+ ecosystem instead.
5759
5860You can combine this utility with other utilities to add syntax extensions.
5961Notable examples that deeply integrate with it are
60- [ ` mdast-util-gfm ` ] [ mdast-util-gfm ] ,
61- [ ` mdast-util-mdx ` ] [ mdast-util-mdx ] ,
62- [ ` mdast-util-frontmatter ` ] [ mdast-util-frontmatter ] ,
63- [ ` mdast-util-math ` ] [ mdast-util-math ] , and
64- [ ` mdast-util-directive ` ] [ mdast-util-directive ] .
62+ [ ` mdast-util-gfm ` ] [ github- mdast-util-gfm] ,
63+ [ ` mdast-util-mdx ` ] [ github- mdast-util-mdx] ,
64+ [ ` mdast-util-frontmatter ` ] [ github- mdast-util-frontmatter] ,
65+ [ ` mdast-util-math ` ] [ github- mdast-util-math] , and
66+ [ ` mdast-util-directive ` ] [ github- mdast-util-directive] .
6567
6668## Install
6769
@@ -144,11 +146,11 @@ There is no default export.
144146
145147### ` toMarkdown(tree[, options]) `
146148
147- Turn an ** [ mdast] [ ] ** syntax tree into markdown.
149+ Turn an ** [ mdast] [ github-mdast ] ** syntax tree into markdown.
148150
149151###### Parameters
150152
151- * ` tree ` ([ ` Node ` ] [ node ] )
153+ * ` tree ` ([ ` Node ` ] [ github-mdast-nodes ] )
152154 — tree to serialize
153155* ` options ` ([ ` Options ` ] [ api-options ] , optional)
154156 — configuration
@@ -206,7 +208,7 @@ Handle a particular node (TypeScript type).
206208
207209* ` node ` (` any ` )
208210 — expected mdast node
209- * ` parent ` ([ ` Node ` ] [ node ] , optional)
211+ * ` parent ` ([ ` Node ` ] [ github-mdast-nodes ] , optional)
210212 — parent of ` node `
211213* ` state ` ([ ` State ` ] [ api-state ] )
212214 — info passed around about the current state
@@ -236,7 +238,7 @@ Info on the surrounding of the node that is serialized (TypeScript type).
236238
237239###### Fields
238240
239- * ` now ` ([ ` Point ` ][point])
241+ * ` now ` ([ ` Point ` ][github-unist- point])
240242 — current point
241243* ` lineShift ` ( ` number ` )
242244 — number of columns each line will be shifted by wrapping nodes
@@ -258,11 +260,11 @@ return defines how many blank lines to use between them.
258260
259261###### Parameters
260262
261- * ` left ` ([ ` Node ` ][node ])
263+ * ` left ` ([ ` Node ` ][github-mdast-nodes ])
262264 — first of two adjacent siblings
263- * ` right ` ([ ` Node ` ][node ])
265+ * ` right ` ([ ` Node ` ][github-mdast-nodes ])
264266 — second of two adjacent siblings
265- * ` parent ` ([ ` Node ` ][node ])
267+ * ` parent ` ([ ` Node ` ][github-mdast-nodes ])
266268 — parent of the two siblings
267269* ` state ` ([ ` State ` ][api-state])
268270 — info passed around about the current state
@@ -476,7 +478,7 @@ Info passed around about the current state (TypeScript type).
476478 — positions of child nodes in their parents
477479* ` associationId ` (` (node: Association) => string ` )
478480 — get an identifier from an association to match it to others (see
479- [ ` Association ` ] [ association ] )
481+ [ ` Association ` ] [ github-mdast- association] )
480482* ` enter ` (` (construct: ConstructName) => () => undefined ` )
481483 — enter a construct (returns a corresponding exit function)
482484 (see [ ` ConstructName ` ] [ api-construct-name ] )
@@ -548,11 +550,11 @@ Schema that defines when a character cannot occur (TypeScript type).
548550
549551## List of extensions
550552
551- * [ ` syntax-tree/mdast-util-directive ` ] ( https:// github.com/syntax-tree/ mdast-util-directive)
553+ * [ ` syntax-tree/mdast-util-directive ` ] [ github- mdast-util-directive ]
552554 — directives
553- * [ ` syntax-tree/mdast-util-frontmatter ` ] ( https:// github.com/syntax-tree/ mdast-util-frontmatter)
555+ * [ ` syntax-tree/mdast-util-frontmatter ` ] [ github- mdast-util-frontmatter ]
554556 — frontmatter (YAML, TOML, more)
555- * [ ` syntax-tree/mdast-util-gfm ` ] ( https:// github.com/syntax-tree/ mdast-util-gfm)
557+ * [ ` syntax-tree/mdast-util-gfm ` ] [ github- mdast-util-gfm ]
556558 — GFM
557559* [ ` syntax-tree/mdast-util-gfm-autolink-literal ` ] ( https://github.com/syntax-tree/mdast-util-gfm-autolink-literal )
558560 — GFM autolink literals
@@ -564,9 +566,9 @@ Schema that defines when a character cannot occur (TypeScript type).
564566 — GFM tables
565567* [ ` syntax-tree/mdast-util-gfm-task-list-item ` ] ( https://github.com/syntax-tree/mdast-util-gfm-task-list-item )
566568 — GFM task list items
567- * [ ` syntax-tree/mdast-util-math ` ] ( https:// github.com/syntax-tree/ mdast-util-math)
569+ * [ ` syntax-tree/mdast-util-math ` ] [ github- mdast-util-math ]
568570 — math
569- * [ ` syntax-tree/mdast-util-mdx ` ] ( https:// github.com/syntax-tree/ mdast-util-mdx)
571+ * [ ` syntax-tree/mdast-util-mdx ` ] [ github- mdast-util-mdx ]
570572 — MDX
571573* [ ` syntax-tree/mdast-util-mdx-expression ` ] ( https://github.com/syntax-tree/mdast-util-mdx-expression )
572574 — MDX expressions
@@ -583,7 +585,7 @@ Extensions can add support for custom syntax.
583585
584586## Syntax tree
585587
586- The syntax tree is [ mdast] [ ] .
588+ The syntax tree is [ mdast] [ github-mdast ] .
587589
588590## Types
589591
@@ -619,132 +621,134 @@ It’ll do its best, but complete roundtripping is impossible given that any val
619621could be injected into the tree.
620622
621623As markdown is sometimes used for HTML, and improper use of HTML can open you up
622- to a [ cross-site scripting (XSS)] [ xss ] attack, use of ` mdast-util-to-markdown `
624+ to a [ cross-site scripting (XSS)] [ wikipedia-xss ] attack,
625+ use of ` mdast-util-to-markdown `
623626and parsing it again later could potentially be unsafe.
624627When parsing markdown afterwards and then going to HTML, use something like
625- [ ` hast-util-sanitize ` ] [ hast-util-sanitize ] to make the tree safe.
628+ [ ` hast-util-sanitize ` ] [ github- hast-util-sanitize] to make the tree safe.
626629
627630## Related
628631
629632* [ ` syntax-tree/mdast-util-from-markdown ` ] ( https://github.com/syntax-tree/mdast-util-from-markdown )
630633 — parse markdown to mdast
631634* [ ` micromark/micromark ` ] ( https://github.com/micromark/micromark )
632635 — parse markdown
633- * [ ` remarkjs/remark ` ] ( https:// github.com/remarkjs/ remark)
636+ * [ ` remarkjs/remark ` ] [ github- remark ]
634637 — process markdown
635638
636639## Contribute
637640
638- See [ ` contributing.md ` ] [ contributing ] in [ ` syntax-tree/.github ` ] [ health ] for
641+ See [ ` contributing.md ` ] [ health-contributing ] in
642+ [ ` syntax-tree/.github ` ] [ health ] for
639643ways to get started.
640- See [ ` support.md ` ] [ support ] for ways to get help.
644+ See [ ` support.md ` ] [ health- support] for ways to get help.
641645
642- This project has a [ code of conduct] [ coc ] .
646+ This project has a [ code of conduct] [ health- coc] .
643647By interacting with this repository, organization, or community you agree to
644648abide by its terms.
645649
646650## License
647651
648- [ MIT] [ license ] © [ Titus Wormer] [ author ]
652+ [ MIT] [ license ] © [ Titus Wormer] [ wooorm ]
649653
650654<!-- Definitions -->
651655
652- [ build-badge ] : https://github.com/syntax-tree/mdast-util-to-markdown/workflows/main/badge.svg
656+ [ api-construct-name ] : #constructname
653657
654- [ build ] : https://github.com/syntax-tree/mdast-util-to-markdown/actions
658+ [ api-construct-name-map ] : #constructnamemap
655659
656- [ coverage-badge ] : https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-to-markdown.svg
660+ [ api-default-handlers ] : #defaulthandlers
657661
658- [ coverage ] : https://codecov.io/github/syntax-tree/mdast-util-to-markdown
662+ [ api-handle ] : #handle
659663
660- [ downloads-badge ] : https://img.shields.io/npm/dm/mdast-util-to-markdown.svg
664+ [ api-handlers ] : #handlers
661665
662- [ downloads ] : https://www.npmjs.com/package/mdast-util-to-markdown
666+ [ api-info ] : #info
663667
664- [ 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
668+ [ api-join ] : #join
665669
666- [ size ] : https://bundlejs.com/?q=mdast-util-to-markdown
670+ [ api-map ] : #map
667671
668- [ sponsors-badge ] : https://opencollective.com/unified/sponsors/badge.svg
672+ [ api-options ] : #options
669673
670- [ backers-badge ] : https://opencollective.com/unified/backers/badge.svg
674+ [ api-safe-config ] : #safeconfig
671675
672- [ collective ] : https://opencollective.com/unified
676+ [ api-state ] : #state
673677
674- [ chat-badge ] : https://img.shields.io/badge/chat-discussions-success.svg
678+ [ api-to-markdown ] : #tomarkdowntree-options
675679
676- [ chat ] : https://github.com/syntax-tree/unist/discussions
680+ [ api-tracker ] : #tracker
677681
678- [ npm ] : https://docs.npmjs.com/cli/install
682+ [ api-unsafe ] : #unsafe
679683
680- [ esmsh ] : https://esm.sh
684+ [ backers-badge ] : https://opencollective.com/unified/backers/badge.svg
681685
682- [ license ] : license
686+ [ build ] : https://github.com/syntax-tree/mdast-util-to-markdown/actions
683687
684- [ author ] : https://wooorm .com
688+ [ build-badge ] : https://github .com/syntax-tree/mdast-util-to-markdown/workflows/main/badge.svg
685689
686- [ health ] : https://github.com/syntax-tree/.github
690+ [ chat ] : https://github.com/syntax-tree/unist/discussions
687691
688- [ contributing ] : https://github.com/syntax-tree/.github/blob/main/contributing.md
692+ [ chat-badge ] : https://img.shields.io/badge/chat-discussions-success.svg
689693
690- [ support ] : https://github .com/syntax-tree/.github/blob/main/support.md
694+ [ collective ] : https://opencollective .com/unified
691695
692- [ coc ] : https://github.com/ syntax-tree/.github/blob/main/code-of-conduct.md
696+ [ coverage ] : https://codecov.io/github/ syntax-tree/mdast-util-to-markdown
693697
694- [ esm ] : https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
698+ [ coverage-badge ] : https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-to-markdown.svg
695699
696- [ typescript ] : https://www.typescriptlang.org
700+ [ downloads ] : https://www.npmjs.com/package/mdast-util-to-markdown
697701
698- [ xss ] : https://en.wikipedia.org/wiki/Cross-site_scripting
702+ [ downloads-badge ] : https://img.shields.io/npm/dm/mdast-util-to-markdown.svg
699703
700- [ hast-util-sanitize ] : https://github.com/syntax-tree/hast-util-sanitize
704+ [ esm ] : https://gist. github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
701705
702- [ point ] : https://github.com/syntax-tree/unist#point
706+ [ esmsh ] : https://esm.sh
703707
704- [ mdast ] : https://github.com/syntax-tree/mdast
708+ [ github-hast-util-sanitize ] : https://github.com/syntax-tree/hast-util-sanitize
705709
706- [ node ] : https://github.com/syntax-tree/mdast#nodes
710+ [ github-mdast ] : https://github.com/syntax-tree/mdast
707711
708- [ association ] : https://github.com/syntax-tree/mdast#association
712+ [ github-mdast- association] : https://github.com/syntax-tree/mdast#association
709713
710- [ mdast-util-gfm ] : https://github.com/syntax-tree/mdast-util-gfm
714+ [ github- mdast-nodes ] : https://github.com/syntax-tree/mdast#nodes
711715
712- [ mdast-util-mdx ] : https://github.com/syntax-tree/mdast-util-mdx
716+ [ github- mdast-util-directive ] : https://github.com/syntax-tree/mdast-util-directive
713717
714- [ mdast-util-frontmatter ] : https://github.com/syntax-tree/mdast-util-frontmatter
718+ [ github- mdast-util-frontmatter] : https://github.com/syntax-tree/mdast-util-frontmatter
715719
716- [ mdast-util-math ] : https://github.com/syntax-tree/mdast-util-math
720+ [ github- mdast-util-gfm ] : https://github.com/syntax-tree/mdast-util-gfm
717721
718- [ mdast-util-directive ] : https://github.com/syntax-tree/mdast-util-directive
722+ [ github- mdast-util-math ] : https://github.com/syntax-tree/mdast-util-math
719723
720- [ remark ] : https://github.com/remarkjs/remark
724+ [ github-mdast-util-mdx ] : https://github.com/syntax-tree/mdast-util-mdx
721725
722- [ remark-stringify ] : https://github.com/remarkjs/remark/tree/main/packages/remark-stringify
726+ [ github-remark ] : https://github.com/remarkjs/remark
723727
724- [ api-construct-name ] : #constructname
728+ [ github-remark-stringify ] : https://github.com/remarkjs/remark/tree/main/packages/remark-stringify
725729
726- [ api-construct-name-map ] : #constructnamemap
730+ [ github-unist-point ] : https://github.com/syntax-tree/unist#point
727731
728- [ api-default-handlers ] : #defaulthandlers
732+ [ health ] : https://github.com/syntax-tree/.github
729733
730- [ api-handle ] : #handle
734+ [ health-coc ] : https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
731735
732- [ api-handlers ] : #handlers
736+ [ health-contributing ] : https://github.com/syntax-tree/.github/blob/main/contributing.md
733737
734- [ api-info ] : #info
738+ [ health-support ] : https://github.com/syntax-tree/.github/blob/main/support.md
735739
736- [ api-join ] : #join
740+ [ license ] : license
737741
738- [ api-map ] : #map
742+ [ npm ] : https://docs.npmjs.com/cli/install
739743
740- [ api-options ] : #options
744+ [ size ] : https://bundlejs.com/?q=mdast-util-to-markdown
741745
742- [ api-safe-config ] : #safeconfig
746+ [ 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
743747
744- [ api-state ] : #state
748+ [ sponsors-badge ] : https://opencollective.com/unified/sponsors/badge.svg
745749
746- [ api-to-markdown ] : #tomarkdowntree-options
750+ [ typescript ] : https://www.typescriptlang.org
747751
748- [ api-tracker ] : #tracker
752+ [ wikipedia-xss ] : https://en.wikipedia.org/wiki/Cross-site_scripting
749753
750- [ api-unsafe ] : #unsafe
754+ [ wooorm ] : https://wooorm.com
0 commit comments