Skip to content

Commit

Permalink
docs: Fix API docs links
Browse files Browse the repository at this point in the history
  • Loading branch information
eemeli committed Dec 30, 2024
1 parent 374c19c commit 8ef085f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
35 changes: 27 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,29 @@ The first has the simplest API and "just works", the second gets you all the bel

A [command-line tool](https://eemeli.org/yaml/#command-line-tool) is also included.

### Parse & Stringify

```js
import { parse, stringify } from 'yaml'
// or
import YAML from 'yaml'
// or
const YAML = require('yaml')
```

### Parse & Stringify

- [`parse(str, reviver?, options?): value`](https://eemeli.org/yaml/#yaml-parse)
- [`stringify(value, replacer?, options?): string`](https://eemeli.org/yaml/#yaml-stringify)

### Documents

<!-- prettier-ignore -->
```js
import {
Document,
isDocument,
parseAllDocuments,
parseDocument
} from 'yaml'
```

- [`Document`](https://eemeli.org/yaml/#documents)
- [`constructor(value, replacer?, options?)`](https://eemeli.org/yaml/#creating-documents)
- [`#anchors`](https://eemeli.org/yaml/#working-with-anchors)
- [`#contents`](https://eemeli.org/yaml/#content-nodes)
- [`#directives`](https://eemeli.org/yaml/#stream-directives)
- [`#errors`](https://eemeli.org/yaml/#errors)
Expand All @@ -83,6 +88,15 @@ const YAML = require('yaml')

### Content Nodes

<!-- prettier-ignore -->
```js
import {
isAlias, isCollection, isMap, isNode,
isPair, isScalar, isSeq, Scalar,
visit, visitAsync, YAMLMap, YAMLSeq
} from 'yaml'
```

- [`isAlias(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types)
- [`isCollection(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types)
- [`isMap(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types)
Expand All @@ -93,13 +107,18 @@ const YAML = require('yaml')
- [`new Scalar(value)`](https://eemeli.org/yaml/#scalar-values)
- [`new YAMLMap()`](https://eemeli.org/yaml/#collections)
- [`new YAMLSeq()`](https://eemeli.org/yaml/#collections)
- [`doc.createAlias(node, name?): Alias`](https://eemeli.org/yaml/#working-with-anchors)
- [`doc.createAlias(node, name?): Alias`](https://eemeli.org/yaml/#creating-nodes)
- [`doc.createNode(value, options?): Node`](https://eemeli.org/yaml/#creating-nodes)
- [`doc.createPair(key, value): Pair`](https://eemeli.org/yaml/#creating-nodes)
- [`visit(node, visitor)`](https://eemeli.org/yaml/#finding-and-modifying-nodes)
- [`visitAsync(node, visitor)`](https://eemeli.org/yaml/#finding-and-modifying-nodes)

### Parsing YAML

```js
import { Composer, Lexer, Parser } from 'yaml'
```

- [`new Lexer().lex(src)`](https://eemeli.org/yaml/#lexer)
- [`new Parser(onNewLine?).parse(src)`](https://eemeli.org/yaml/#parser)
- [`new Composer(options?).compose(tokens)`](https://eemeli.org/yaml/#composer)
Expand Down
6 changes: 3 additions & 3 deletions docs/01_intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ import {
} from 'yaml'
```

- [`isNode(foo): boolean`](#identifying-nodes)
- [`is*(foo): boolean`](#identifying-node-types)
- [`new Scalar(value)`](#scalar-values)
- [`new YAMLMap()`](#collections)
- [`new YAMLSeq()`](#collections)
- [`doc.createAlias(node, name?): Alias`](#creating-nodes)
- [`doc.createNode(value, options?): Node`](#creating-nodes)
- [`doc.createPair(key, value): Pair`](#creating-nodes)
- [`visit(node, visitor)`](#modifying-nodes)
- [`visitAsync(node, visitor)`](#modifying-nodes)
- [`visit(node, visitor)`](#finding-and-modifying-nodes)
- [`visitAsync(node, visitor)`](#finding-and-modifying-nodes)

<h3>Parsing YAML</h3>

Expand Down

0 comments on commit 8ef085f

Please sign in to comment.