update docs, add descriptions for api methods

This commit is contained in:
Leo Horie 2016-12-02 17:51:07 -05:00
parent d56c30cc4a
commit cdb9017a72
25 changed files with 613 additions and 40 deletions

View file

@ -1,5 +1,6 @@
# m(selector, attributes, children)
- [Description](#description)
- [Signature](#signature)
- [How it works](#how-it-works)
- [Flexibility](#flexibility)
@ -17,6 +18,24 @@
---
### Description
Represents an HTML element in a Mithril view
```javascript
m("div", {class: "foo"}, "hello")
// represents <div class="foo">hello</div>
```
You can also [use HTML syntax](https://babeljs.io/repl/#?code=%2F**%20%40jsx%20m%20*%2F%0A%3Ch1%3EMy%20first%20app%3C%2Fh1%3E) via a Babel plugin.
```markup
/** jsx m */
<div class="foo">hello</div>
```
---
### Signature
`vnode = m(selector, attributes, children)`