For example if we want to increasing the heading level of all headings in a markdown document:
import type {Root} from 'mdast'
import {remark} from 'remark'
import {visit} from 'unist-util-visit'
const file = await remark()
  .use(function () {
    return function (tree: Root) {
      // Check that the Node is a heading:
      visit(tree, 'heading', function (node) {
        // The types know `node` is a heading.
        node.depth += 1
      })
    }
  })
  .process('## Hello, *World*!')
console.log(String(file))
(alias) interface Root
import Root
Document fragment or a whole document.
Should be used as the root of a tree and must not be used as a child.
(alias) const remark: Processor<Root, undefined, undefined, Root, string>
import remark
Create a new unified processor that already uses remark-parse and remark-stringify.
(alias) function visit<Tree extends Node, Check extends Test>(tree: Tree, check: Check, visitor: BuildVisitor<Tree, Check>, reverse?: boolean | null | undefined): undefined (+1 overload)
import visit
(alias) remark(): Processor<Root, undefined, undefined, Root, string>
import remark
Create a new unified processor that already uses remark-parse and remark-stringify.
(method) Processor<Root, undefined, undefined, Root, string>.use<[], Root, void>(plugin: Plugin<[], Root, void>, ...parameters: [] | [boolean]): Processor<Root, undefined, undefined, Root, string> (+2 overloads)
Configure the processor to use a plugin, a list of usable values, or a preset.
If the processor is already using a plugin, the previous plugin configuration is changed based on the options that are passed in. In other words, the plugin is not added a second time.
Note: use cannot be called on frozen processors. Call the processor first to create a new unfrozen processor.
- @example There are many ways to pass plugins to 
.use(). This example gives an overview:import {unified} from 'unified'
unified()
  // Plugin with options:
  .use(pluginA, {x: true, y: true})
  // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):
  .use(pluginA, {y: false, z: true})
  // Plugins:
  .use([pluginB, pluginC])
  // Two plugins, the second with options:
  .use([pluginD, [pluginE, {}]])
  // Preset with plugins and settings:
  .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})
  // Settings only:
  .use({settings: {position: false}})
 - @template {Array} [Parameters=[]]
 - @template {Node | string | undefined} [Input=undefined]
 - @template [Output=Input]
 - @overload
 - @overload
 - @overload
 - @param value Usable value.
 - @param parameters Parameters, when a plugin is given as a usable value.
 - @returns Current processor.
 
(alias) interface Root
import Root
Document fragment or a whole document.
Should be used as the root of a tree and must not be used as a child.
(alias) visit<Root, "heading">(tree: Root, check: "heading", visitor: BuildVisitor<Root, "heading">, reverse?: boolean | null | undefined): undefined (+1 overload)
import visit
(parameter) node: Heading
(parameter) node: Heading
(property) Heading.depth: number
Heading rank.
A value of 1 is said to be the highest rank and 6 the lowest.
(method) Processor<Root, undefined, undefined, Root, string>.process(file?: Compatible | undefined): Promise<VFile> (+1 overload)
Process the given file as configured on the processor.
Note: process freezes the processor if not already frozen.
Note: process performs the parse, run, and stringify phases.
- @overload
 - @overload
 - @param file File (optional); typically 
string or VFile]; any value accepted as x in new VFile(x). - @param done Callback (optional).
 - @returns Nothing if 
done is given. Otherwise a promise, rejected with a fatal error or resolved with the processed file. The parsed, transformed, and compiled value is available at file.value (see note).Note: unified typically compiles by serializing: most compilers return string (or Uint8Array). Some compilers, such as the one configured with rehype-react, return other values (in this case, a React tree). If you’re using a compiler that doesn’t serialize, expect different result values.
To register custom results in TypeScript, add them to {@linkcode CompileResultMap}.
 
namespace console
var console: Console
The console module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.
The module exports two specific components:
- A 
Console class with methods such as console.log(), console.error() and console.warn() that can be used to write to any Node.js stream. - A global 
console instance configured to write to process.stdout and process.stderr. The global console can be used without importing the node:console module. 
Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O for more information.
Example using the global console:
console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(new Error('Whoops, something bad happened'));
// Prints error message and stack trace to stderr:
//   Error: Whoops, something bad happened
//     at [eval]:5:15
//     at Script.runInThisContext (node:vm:132:18)
//     at Object.runInThisContext (node:vm:309:38)
//     at node:internal/process/execution:77:19
//     at [eval]-wrapper:6:22
//     at evalScript (node:internal/process/execution:76:60)
//     at node:internal/main/eval_string:23:3
const name = 'Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr
Example using the Console class:
const out = getStreamSomehow();
const err = getStreamSomehow();
const myConsole = new console.Console(out, err);
myConsole.log('hello world');
// Prints: hello world, to out
myConsole.log('hello %s', 'world');
// Prints: hello world, to out
myConsole.error(new Error('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to err
const name = 'Will Robinson';
myConsole.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to err
(method) Console.log(message?: any, ...optionalParams: any[]): void
Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).
const count = 5;
console.log('count: %d', count);
// Prints: count: 5, to stdout
console.log('count:', count);
// Prints: count: 5, to stdout
See util.format() for more information.
var String: StringConstructor
(value?: any) => string
Allows manipulation and formatting of text strings and determination and location of substrings within strings.
import type {Root} from 'mdast'
import {remark} from 'remark'
import {visit} from 'unist-util-visit'
const file = await remark()
  .use(function () {
    return function (tree: Root) {
      // Check that the Node is a list:
      visit(tree, 'list', function (node) {
        if (node.ordered) {
          // The types know `node` is an ordered list.
          node.ordered = false
        }
      })
    }
  })
  .process('1. list item')
console.log(String(file))
(alias) interface Root
import Root
Document fragment or a whole document.
Should be used as the root of a tree and must not be used as a child.
(alias) const remark: Processor<Root, undefined, undefined, Root, string>
import remark
Create a new unified processor that already uses remark-parse and remark-stringify.
(alias) function visit<Tree extends Node, Check extends Test>(tree: Tree, check: Check, visitor: BuildVisitor<Tree, Check>, reverse?: boolean | null | undefined): undefined (+1 overload)
import visit
(alias) remark(): Processor<Root, undefined, undefined, Root, string>
import remark
Create a new unified processor that already uses remark-parse and remark-stringify.
(method) Processor<Root, undefined, undefined, Root, string>.use<[], Root, void>(plugin: Plugin<[], Root, void>, ...parameters: [] | [boolean]): Processor<Root, undefined, undefined, Root, string> (+2 overloads)
Configure the processor to use a plugin, a list of usable values, or a preset.
If the processor is already using a plugin, the previous plugin configuration is changed based on the options that are passed in. In other words, the plugin is not added a second time.
Note: use cannot be called on frozen processors. Call the processor first to create a new unfrozen processor.
- @example There are many ways to pass plugins to 
.use(). This example gives an overview:import {unified} from 'unified'
unified()
  // Plugin with options:
  .use(pluginA, {x: true, y: true})
  // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):
  .use(pluginA, {y: false, z: true})
  // Plugins:
  .use([pluginB, pluginC])
  // Two plugins, the second with options:
  .use([pluginD, [pluginE, {}]])
  // Preset with plugins and settings:
  .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})
  // Settings only:
  .use({settings: {position: false}})
 - @template {Array} [Parameters=[]]
 - @template {Node | string | undefined} [Input=undefined]
 - @template [Output=Input]
 - @overload
 - @overload
 - @overload
 - @param value Usable value.
 - @param parameters Parameters, when a plugin is given as a usable value.
 - @returns Current processor.
 
(alias) interface Root
import Root
Document fragment or a whole document.
Should be used as the root of a tree and must not be used as a child.
(alias) visit<Root, "list">(tree: Root, check: "list", visitor: BuildVisitor<Root, "list">, reverse?: boolean | null | undefined): undefined (+1 overload)
import visit
(property) List.ordered?: boolean | null | undefined
Whether the items have been intentionally ordered (when true), or that the order of items is not important (when false or not present).
(property) List.ordered?: boolean | null | undefined
Whether the items have been intentionally ordered (when true), or that the order of items is not important (when false or not present).
(method) Processor<Root, undefined, undefined, Root, string>.process(file?: Compatible | undefined): Promise<VFile> (+1 overload)
Process the given file as configured on the processor.
Note: process freezes the processor if not already frozen.
Note: process performs the parse, run, and stringify phases.
- @overload
 - @overload
 - @param file File (optional); typically 
string or VFile]; any value accepted as x in new VFile(x). - @param done Callback (optional).
 - @returns Nothing if 
done is given. Otherwise a promise, rejected with a fatal error or resolved with the processed file. The parsed, transformed, and compiled value is available at file.value (see note).Note: unified typically compiles by serializing: most compilers return string (or Uint8Array). Some compilers, such as the one configured with rehype-react, return other values (in this case, a React tree). If you’re using a compiler that doesn’t serialize, expect different result values.
To register custom results in TypeScript, add them to {@linkcode CompileResultMap}.
 
namespace console
var console: Console
The console module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.
The module exports two specific components:
- A 
Console class with methods such as console.log(), console.error() and console.warn() that can be used to write to any Node.js stream. - A global 
console instance configured to write to process.stdout and process.stderr. The global console can be used without importing the node:console module. 
Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O for more information.
Example using the global console:
console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(new Error('Whoops, something bad happened'));
// Prints error message and stack trace to stderr:
//   Error: Whoops, something bad happened
//     at [eval]:5:15
//     at Script.runInThisContext (node:vm:132:18)
//     at Object.runInThisContext (node:vm:309:38)
//     at node:internal/process/execution:77:19
//     at [eval]-wrapper:6:22
//     at evalScript (node:internal/process/execution:76:60)
//     at node:internal/main/eval_string:23:3
const name = 'Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr
Example using the Console class:
const out = getStreamSomehow();
const err = getStreamSomehow();
const myConsole = new console.Console(out, err);
myConsole.log('hello world');
// Prints: hello world, to out
myConsole.log('hello %s', 'world');
// Prints: hello world, to out
myConsole.error(new Error('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to err
const name = 'Will Robinson';
myConsole.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to err
(method) Console.log(message?: any, ...optionalParams: any[]): void
Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).
const count = 5;
console.log('count: %d', count);
// Prints: count: 5, to stdout
console.log('count:', count);
// Prints: count: 5, to stdout
See util.format() for more information.
var String: StringConstructor
(value?: any) => string
Allows manipulation and formatting of text strings and determination and location of substrings within strings.
As always with TypeScript, make sure that the input values are typed correctly.
import type {Root} from 'hast'
import rehypeParse from 'rehype-parse'
import rehypeStringify from 'rehype-stringify'
import {unified} from 'unified'
import {visitParents} from 'unist-util-visit-parents'
const file = await unified()
  .use(rehypeParse, {fragment: true})
  .use(function () {
    return function (tree: Root) {
      visitParents(tree, 'element', function (node, parents) {
        if (
          node.tagName === 'code' &&
          parents.some(function (parent) {
            return parent.type === 'element' && parent.tagName === 'pre'
          })
        ) {
          console.log('`<code>` in `<pre>`')
        }
      })
    }
  })
  .use(rehypeStringify)
  .process(
    "<pre><code>console.log('hi!')</code></pre><p><code>hello!</code></p>"
  )
(alias) interface Root
import Root
Document fragment or a whole document.
Should be used as the root of a tree and must not be used as a child.
Can also be used as the value for the content field on a 'template' element.
(alias) const rehypeParse: Plugin<[(Options | null | undefined)?], string, Root>
import rehypeParse
Plugin to add support for parsing from HTML.
- @this processor.
 - @param Configuration (optional).
 - @returns Nothing.
 
(alias) const rehypeStringify: Plugin<[(Options | null | undefined)?], Root, string>
import rehypeStringify
Plugin to add support for serializing as HTML.
- @this processor.
 - @param Configuration (optional).
 - @returns Nothing.
 
(alias) const unified: Processor<undefined, undefined, undefined, undefined, undefined>
import unified
(alias) function visitParents<Tree extends Node, Check extends Test>(tree: Tree, check: Check, visitor: BuildVisitor<Tree, Check>, reverse?: boolean | null | undefined): undefined (+1 overload)
import visitParents
Visit nodes, with ancestral information.
This algorithm performs depth-first tree traversal in preorder (NLR) or if reverse is given, in reverse preorder (NRL).
You can choose for which nodes visitor is called by passing a test. For complex tests, you should test yourself in visitor, as it will be faster and will have improved type information.
Walking the tree is an intensive task. Make use of the return values of the visitor when possible. Instead of walking a tree multiple times, walk it once, use unist-util-is to check if a node matches, and then perform different operations.
You can change the tree. See Visitor for more info.
- @overload
 - @overload
 - @param tree Tree to traverse.
 - @param test 
unist-util-is-compatible test - @param visitor Handle each node.
 - @param reverse Traverse in reverse preorder (NRL) instead of the default preorder (NLR).
 - @returns Nothing.
 - @template {UnistNode} Tree Node type.
 - @template {Test} Check 
unist-util-is-compatible test. 
(alias) unified(): Processor<undefined, undefined, undefined, undefined, undefined>
import unified
(method) Processor<undefined, undefined, undefined, undefined, undefined>.use<[{
    fragment: boolean;
}], string, Root>(plugin: Plugin<[{
    fragment: boolean;
}], string, Root>, ...parameters: [boolean] | [{
    fragment: boolean;
}]): Processor<Root, undefined, undefined, undefined, undefined> (+2 overloads)
Configure the processor to use a plugin, a list of usable values, or a preset.
If the processor is already using a plugin, the previous plugin configuration is changed based on the options that are passed in. In other words, the plugin is not added a second time.
Note: use cannot be called on frozen processors. Call the processor first to create a new unfrozen processor.
- @example There are many ways to pass plugins to 
.use(). This example gives an overview:import {unified} from 'unified'
unified()
  // Plugin with options:
  .use(pluginA, {x: true, y: true})
  // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):
  .use(pluginA, {y: false, z: true})
  // Plugins:
  .use([pluginB, pluginC])
  // Two plugins, the second with options:
  .use([pluginD, [pluginE, {}]])
  // Preset with plugins and settings:
  .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})
  // Settings only:
  .use({settings: {position: false}})
 - @template {Array} [Parameters=[]]
 - @template {Node | string | undefined} [Input=undefined]
 - @template [Output=Input]
 - @overload
 - @overload
 - @overload
 - @param value Usable value.
 - @param parameters Parameters, when a plugin is given as a usable value.
 - @returns Current processor.
 
(alias) const rehypeParse: Plugin<[(Options | null | undefined)?], string, Root>
import rehypeParse
Plugin to add support for parsing from HTML.
- @this processor.
 - @param Configuration (optional).
 - @returns Nothing.
 
(property) fragment: boolean
(method) Processor<Root, undefined, undefined, undefined, undefined>.use<[], Root, void>(plugin: Plugin<[], Root, void>, ...parameters: [] | [boolean]): Processor<Root, undefined, undefined, undefined, undefined> (+2 overloads)
Configure the processor to use a plugin, a list of usable values, or a preset.
If the processor is already using a plugin, the previous plugin configuration is changed based on the options that are passed in. In other words, the plugin is not added a second time.
Note: use cannot be called on frozen processors. Call the processor first to create a new unfrozen processor.
- @example There are many ways to pass plugins to 
.use(). This example gives an overview:import {unified} from 'unified'
unified()
  // Plugin with options:
  .use(pluginA, {x: true, y: true})
  // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):
  .use(pluginA, {y: false, z: true})
  // Plugins:
  .use([pluginB, pluginC])
  // Two plugins, the second with options:
  .use([pluginD, [pluginE, {}]])
  // Preset with plugins and settings:
  .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})
  // Settings only:
  .use({settings: {position: false}})
 - @template {Array} [Parameters=[]]
 - @template {Node | string | undefined} [Input=undefined]
 - @template [Output=Input]
 - @overload
 - @overload
 - @overload
 - @param value Usable value.
 - @param parameters Parameters, when a plugin is given as a usable value.
 - @returns Current processor.
 
(alias) interface Root
import Root
Document fragment or a whole document.
Should be used as the root of a tree and must not be used as a child.
Can also be used as the value for the content field on a 'template' element.
(alias) visitParents<Root, "element">(tree: Root, check: "element", visitor: BuildVisitor<Root, "element">, reverse?: boolean | null | undefined): undefined (+1 overload)
import visitParents
Visit nodes, with ancestral information.
This algorithm performs depth-first tree traversal in preorder (NLR) or if reverse is given, in reverse preorder (NRL).
You can choose for which nodes visitor is called by passing a test. For complex tests, you should test yourself in visitor, as it will be faster and will have improved type information.
Walking the tree is an intensive task. Make use of the return values of the visitor when possible. Instead of walking a tree multiple times, walk it once, use unist-util-is to check if a node matches, and then perform different operations.
You can change the tree. See Visitor for more info.
- @overload
 - @overload
 - @param tree Tree to traverse.
 - @param test 
unist-util-is-compatible test - @param visitor Handle each node.
 - @param reverse Traverse in reverse preorder (NRL) instead of the default preorder (NLR).
 - @returns Nothing.
 - @template {UnistNode} Tree Node type.
 - @template {Test} Check 
unist-util-is-compatible test. 
(parameter) node: Element
(parameter) parents: (Root | Element)[]
(parameter) node: Element
(property) Element.tagName: string
Tag name (such as 'body') of the element.
(parameter) parents: (Root | Element)[]
(method) Array<Root | Element>.some(predicate: (value: Root | Element, index: number, array: (Root | Element)[]) => unknown, thisArg?: any): boolean
Determines whether the specified callback function returns true for any element of an array.
- @param predicate A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array.
 - @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
 
(parameter) parent: Root | Element
(parameter) parent: Root | Element
(property) type: "root" | "element"
Node type of hast root.
Node type of elements.
(parameter) parent: Element
(property) Element.tagName: string
Tag name (such as 'body') of the element.
namespace console
var console: Console
The console module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.
The module exports two specific components:
- A 
Console class with methods such as console.log(), console.error() and console.warn() that can be used to write to any Node.js stream. - A global 
console instance configured to write to process.stdout and process.stderr. The global console can be used without importing the node:console module. 
Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O for more information.
Example using the global console:
console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(new Error('Whoops, something bad happened'));
// Prints error message and stack trace to stderr:
//   Error: Whoops, something bad happened
//     at [eval]:5:15
//     at Script.runInThisContext (node:vm:132:18)
//     at Object.runInThisContext (node:vm:309:38)
//     at node:internal/process/execution:77:19
//     at [eval]-wrapper:6:22
//     at evalScript (node:internal/process/execution:76:60)
//     at node:internal/main/eval_string:23:3
const name = 'Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr
Example using the Console class:
const out = getStreamSomehow();
const err = getStreamSomehow();
const myConsole = new console.Console(out, err);
myConsole.log('hello world');
// Prints: hello world, to out
myConsole.log('hello %s', 'world');
// Prints: hello world, to out
myConsole.error(new Error('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to err
const name = 'Will Robinson';
myConsole.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to err
(method) Console.log(message?: any, ...optionalParams: any[]): void
Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).
const count = 5;
console.log('count: %d', count);
// Prints: count: 5, to stdout
console.log('count:', count);
// Prints: count: 5, to stdout
See util.format() for more information.
(method) Processor<Root, undefined, undefined, undefined, undefined>.use<[], Root, string>(plugin: Plugin<[], Root, string>, ...parameters: [] | [boolean]): Processor<Root, undefined, undefined, Root, string> (+2 overloads)
Configure the processor to use a plugin, a list of usable values, or a preset.
If the processor is already using a plugin, the previous plugin configuration is changed based on the options that are passed in. In other words, the plugin is not added a second time.
Note: use cannot be called on frozen processors. Call the processor first to create a new unfrozen processor.
- @example There are many ways to pass plugins to 
.use(). This example gives an overview:import {unified} from 'unified'
unified()
  // Plugin with options:
  .use(pluginA, {x: true, y: true})
  // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):
  .use(pluginA, {y: false, z: true})
  // Plugins:
  .use([pluginB, pluginC])
  // Two plugins, the second with options:
  .use([pluginD, [pluginE, {}]])
  // Preset with plugins and settings:
  .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})
  // Settings only:
  .use({settings: {position: false}})
 - @template {Array} [Parameters=[]]
 - @template {Node | string | undefined} [Input=undefined]
 - @template [Output=Input]
 - @overload
 - @overload
 - @overload
 - @param value Usable value.
 - @param parameters Parameters, when a plugin is given as a usable value.
 - @returns Current processor.
 
(alias) const rehypeStringify: Plugin<[(Options | null | undefined)?], Root, string>
import rehypeStringify
Plugin to add support for serializing as HTML.
- @this processor.
 - @param Configuration (optional).
 - @returns Nothing.
 
(method) Processor<Root, undefined, undefined, Root, string>.process(file?: Compatible | undefined): Promise<VFile> (+1 overload)
Process the given file as configured on the processor.
Note: process freezes the processor if not already frozen.
Note: process performs the parse, run, and stringify phases.
- @overload
 - @overload
 - @param file File (optional); typically 
string or VFile]; any value accepted as x in new VFile(x). - @param done Callback (optional).
 - @returns Nothing if 
done is given. Otherwise a promise, rejected with a fatal error or resolved with the processed file. The parsed, transformed, and compiled value is available at file.value (see note).Note: unified typically compiles by serializing: most compilers return string (or Uint8Array). Some compilers, such as the one configured with rehype-react, return other values (in this case, a React tree). If you’re using a compiler that doesn’t serialize, expect different result values.
To register custom results in TypeScript, add them to {@linkcode CompileResultMap}.
 
import type {Paragraph, Root} from 'mdast'
import {remark} from 'remark'
import {selectAll} from 'unist-util-select'
remark()
  .use(function () {
    return function (mdast: Root) {
      const matches = selectAll('blockquote paragraph', mdast) as Paragraph[]
      console.log(matches)
    }
  })
  .process('> block quote')
(alias) interface Paragraph
import Paragraph
(alias) interface Root
import Root
Document fragment or a whole document.
Should be used as the root of a tree and must not be used as a child.
(alias) const remark: Processor<Root, undefined, undefined, Root, string>
import remark
Create a new unified processor that already uses remark-parse and remark-stringify.
(alias) function selectAll(selector: string, tree?: Node | NodeLike | null | undefined): Array<Node>
import selectAll
Select all nodes that match selector in the given tree.
Searches the tree in preorder.
- @param selector CSS selector, such as (
heading, link, linkReference). - @param tree Tree to search.
 - @returns Nodes in 
tree that match selector. This could include tree itself. 
(alias) remark(): Processor<Root, undefined, undefined, Root, string>
import remark
Create a new unified processor that already uses remark-parse and remark-stringify.
(method) Processor<Root, undefined, undefined, Root, string>.use<[], Root, void>(plugin: Plugin<[], Root, void>, ...parameters: [] | [boolean]): Processor<Root, undefined, undefined, Root, string> (+2 overloads)
Configure the processor to use a plugin, a list of usable values, or a preset.
If the processor is already using a plugin, the previous plugin configuration is changed based on the options that are passed in. In other words, the plugin is not added a second time.
Note: use cannot be called on frozen processors. Call the processor first to create a new unfrozen processor.
- @example There are many ways to pass plugins to 
.use(). This example gives an overview:import {unified} from 'unified'
unified()
  // Plugin with options:
  .use(pluginA, {x: true, y: true})
  // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):
  .use(pluginA, {y: false, z: true})
  // Plugins:
  .use([pluginB, pluginC])
  // Two plugins, the second with options:
  .use([pluginD, [pluginE, {}]])
  // Preset with plugins and settings:
  .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})
  // Settings only:
  .use({settings: {position: false}})
 - @template {Array} [Parameters=[]]
 - @template {Node | string | undefined} [Input=undefined]
 - @template [Output=Input]
 - @overload
 - @overload
 - @overload
 - @param value Usable value.
 - @param parameters Parameters, when a plugin is given as a usable value.
 - @returns Current processor.
 
(alias) interface Root
import Root
Document fragment or a whole document.
Should be used as the root of a tree and must not be used as a child.
const matches: Paragraph[]
(alias) selectAll(selector: string, tree?: Node | NodeLike | null | undefined): Array<Node>
import selectAll
Select all nodes that match selector in the given tree.
Searches the tree in preorder.
- @param selector CSS selector, such as (
heading, link, linkReference). - @param tree Tree to search.
 - @returns Nodes in 
tree that match selector. This could include tree itself. 
(alias) interface Paragraph
import Paragraph
namespace console
var console: Console
The console module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.
The module exports two specific components:
- A 
Console class with methods such as console.log(), console.error() and console.warn() that can be used to write to any Node.js stream. - A global 
console instance configured to write to process.stdout and process.stderr. The global console can be used without importing the node:console module. 
Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O for more information.
Example using the global console:
console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(new Error('Whoops, something bad happened'));
// Prints error message and stack trace to stderr:
//   Error: Whoops, something bad happened
//     at [eval]:5:15
//     at Script.runInThisContext (node:vm:132:18)
//     at Object.runInThisContext (node:vm:309:38)
//     at node:internal/process/execution:77:19
//     at [eval]-wrapper:6:22
//     at evalScript (node:internal/process/execution:76:60)
//     at node:internal/main/eval_string:23:3
const name = 'Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr
Example using the Console class:
const out = getStreamSomehow();
const err = getStreamSomehow();
const myConsole = new console.Console(out, err);
myConsole.log('hello world');
// Prints: hello world, to out
myConsole.log('hello %s', 'world');
// Prints: hello world, to out
myConsole.error(new Error('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to err
const name = 'Will Robinson';
myConsole.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to err
(method) Console.log(message?: any, ...optionalParams: any[]): void
Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).
const count = 5;
console.log('count: %d', count);
// Prints: count: 5, to stdout
console.log('count:', count);
// Prints: count: 5, to stdout
See util.format() for more information.
const matches: Paragraph[]
(method) Processor<Root, undefined, undefined, Root, string>.process(file?: Compatible | undefined): Promise<VFile> (+1 overload)
Process the given file as configured on the processor.
Note: process freezes the processor if not already frozen.
Note: process performs the parse, run, and stringify phases.
- @overload
 - @overload
 - @param file File (optional); typically 
string or VFile]; any value accepted as x in new VFile(x). - @param done Callback (optional).
 - @returns Nothing if 
done is given. Otherwise a promise, rejected with a fatal error or resolved with the processed file. The parsed, transformed, and compiled value is available at file.value (see note).Note: unified typically compiles by serializing: most compilers return string (or Uint8Array). Some compilers, such as the one configured with rehype-react, return other values (in this case, a React tree). If you’re using a compiler that doesn’t serialize, expect different result values.
To register custom results in TypeScript, add them to {@linkcode CompileResultMap}.