Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,49 @@
*Please use only this documented API when working with the parser. Methods
not documented here are subject to change at any point.*

<!-- toc -->

- [`parser` function](#parser-function)
* [`parser.atword([props])`](#parseratwordprops)
* [`parser.colon([props])`](#parsercolonprops)
* [`parser.comma([props])`](#parsercommaprops)
* [`parser.comment([props])`](#parsercommentprops)
* [`parser.func([props])`](#parserfuncprops)
* [`parser.number([props])`](#parsernumberprops)
* [`parser.operator([props])`](#parseroperatorprops)
* [`parser.paren([props])`](#parserparenprops)
* [`parser.string([props])`](#parserstringprops)
* [`parser.value([props])`](#parservalueprops)
* [`parser.word([props])`](#parserwordprops)
- [Node types](#node-types)
* [`node.type`](#nodetype)
* [`node.parent`](#nodeparent)
* [`node.toString()`, `String(node)`, or `'' + node`](#nodetostring-stringnode-or---node)
* [`node.next()` & `node.prev()`](#nodenext--nodeprev)
* [`node.replaceWith(node)`](#nodereplacewithnode)
* [`node.remove()`](#noderemove)
* [`node.clone()`](#nodeclone)
* [`node.raws`](#noderaws)
* [`node.source`](#nodesource)
* [`node.sourceIndex`](#nodesourceindex)
- [Container types](#container-types)
* [`container.nodes`](#containernodes)
* [`container.first` & `container.last`](#containerfirst--containerlast)
* [`container.at(index)`](#containeratindex)
* [`container.index(node)`](#containerindexnode)
* [`container.length`](#containerlength)
* [`container.each(callback)`](#containereachcallback)
* [`container.walk(callback)`](#containerwalkcallback)
* [`container.walk` proxies](#containerwalk-proxies)
* [`container.prepend(node)` & `container.append(node)`](#containerprependnode--containerappendnode)
* [`container.insertBefore(old, new)` & `container.insertAfter(old, new)`](#containerinsertbeforeold-new--containerinsertafterold-new)
* [`container.removeChild(node)`](#containerremovechildnode)
* [`container.removeAll()` or `container.empty()`](#containerremoveall-or-containerempty)
- [Root nodes`](#root-nodes)
- [Value nodes](#value-nodes)

<!-- tocstop -->

## `parser` function

This is the module's main entry point, and returns a `new Parser`.
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,11 @@ and utilized many patterns and logical constructs from the project.

Tests and some tokenizing techniques found in [postcss-value-parser](https://github.com/TrySound/postcss-value-parser)
were used.

## Contributing

- `git fork/clone`
- `npm i`
- Before PR'ing, make sure `npm test` still pass. Add test if you're adding features.

When you tweak [API.md](API.md), please run `npm run toc` before PR'ing.
Loading