Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
hudochenkov committed May 18, 2021
1 parent 3eb068b commit 8af26ab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ A good example of a parser is [Safe Parser], which parses malformed/broken CSS.
Because there is no point to generate broken output, this package only provides
a parser.

The parser API is a function which receives a string & returns a [`Root`] node.
The parser API is a function which receives a string & returns a [`Root`] or [`Document`] node.
The second argument is a function which receives an object with PostCSS options.

```js
Expand All @@ -54,6 +54,7 @@ module.exports = function parse (css, opts) {

[Safe Parser]: https://github.com/postcss/postcss-safe-parser
[`Root`]: https://postcss.org/api/#root
[`Document`]: https://postcss.org/api/#document


### Main Theory
Expand Down Expand Up @@ -170,7 +171,7 @@ The Stringifier API is little bit more complicated, than the parser API.
PostCSS generates a source map, so a stringifier can’t just return a string.
It must link every substring with its source node.

A Stringifier is a function which receives [`Root`] node and builder callback.
A Stringifier is a function which receives [`Root`] or [`Document`] node and builder callback.
Then it calls builder with every node’s string and node instance.

```js
Expand Down

0 comments on commit 8af26ab

Please sign in to comment.