Skip to content

Commit

Permalink
docs(readme): simple examples of usage
Browse files Browse the repository at this point in the history
  • Loading branch information
tunnckoCore committed Feb 11, 2017
1 parent 998dc43 commit 78ae626
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 12 deletions.
27 changes: 26 additions & 1 deletion .verb.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,37 @@ $ yarn add {%= name %}
> For more use-cases see the [tests](test.js)
```js
const {%= varname %} = require('{%= name %}')
const h = require('mich-h')
const toHtml = require('{%= name %}')

const tree = h('h1.big#hero.header', 'Hello World')

const html = toHtml(tree)
console.log(html)
// => '<h1 id="hero" class="big header">Hello World</h1>'

```

Or, using the JSX syntax and adding the [JSX Pragma](https://jasonformat.com/wtf-is-jsx/) somewhere at the top

```jsx
/** @jsx h */
const h = require('mich-h')
const toHtml = require('{%= name %}')

const hi = 'Hello World'
const tree = <h1 id="hero" className="big header">{hi}<h1>

const html = toHtml(tree)
console.log(html)
// => '<h1 id="hero" class="big header">Hello World</h1>'
```

## API
{%= apidocs('index.js') %}

TODO

{% if (verb.related && verb.related.list && verb.related.list.length) { %}
## Related
{%= related(verb.related.list, {words: 20}) %}
Expand Down
59 changes: 48 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,36 @@ $ yarn add mich-to-html
> For more use-cases see the [tests](test.js)
```js
const michToHtml = require('mich-to-html')
const h = require('mich-h')
const toHtml = require('mich-to-html')

const tree = h('h1.big#hero.header', 'Hello World')

const html = toHtml(tree)
console.log(html)
// => '<h1 id="hero" class="big header">Hello World</h1>'

```

Or, using the JSX syntax and adding the [JSX Pragma](https://jasonformat.com/wtf-is-jsx/) somewhere at the top

```jsx
/** @jsx h */
const h = require('mich-h')
const toHtml = require('mich-to-html')

const hi = 'Hello World'
const tree = <h1 id="hero" className="big header">{hi}<h1>

const html = toHtml(tree)
console.log(html)
// => '<h1 id="hero" class="big header">Hello World</h1>'
```

## API

TODO

## Related
- [always-done](https://www.npmjs.com/package/always-done): Handle completion and errors with elegance! Support for streams, callbacks, promises, child processes, async/await and sync functions. A drop-in replacement… [more](https://github.com/hybridables/always-done#readme) | [homepage](https://github.com/hybridables/always-done#readme "Handle completion and errors with elegance! Support for streams, callbacks, promises, child processes, async/await and sync functions. A drop-in replacement for [async-done][] - pass 100% of its tests plus more")
- [minibase](https://www.npmjs.com/package/minibase): Minimalist alternative for Base. Build complex APIs with small units called plugins. Works well with most of the already existing… [more](https://github.com/node-minibase/minibase#readme) | [homepage](https://github.com/node-minibase/minibase#readme "Minimalist alternative for Base. Build complex APIs with small units called plugins. Works well with most of the already existing [base][] plugins.")
Expand Down Expand Up @@ -96,6 +121,28 @@ Copyright © 2016-2017, [Charlike Mike Reagent](https://i.am.charlike.online). R
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.1, on February 11, 2017._
_Project scaffolded using [charlike][] cli._

[always-done]: https://github.com/hybridables/always-done
[async-done]: https://github.com/gulpjs/async-done
[base]: https://github.com/node-base/base
[charlike]: https://github.com/tunnckocore/charlike
[commitizen]: https://github.com/commitizen/cz-cli
[dezalgo]: https://github.com/npm/dezalgo
[once]: https://github.com/isaacs/once
[standard-version]: https://github.com/conventional-changelog/standard-version
[verb-generate-readme]: https://github.com/verbose/verb-generate-readme
[verb]: https://github.com/verbose/verb

[always-done]: https://github.com/hybridables/always-done
[async-done]: https://github.com/gulpjs/async-done
[base]: https://github.com/node-base/base
[charlike]: https://github.com/tunnckocore/charlike
[commitizen]: https://github.com/commitizen/cz-cli
[dezalgo]: https://github.com/npm/dezalgo
[once]: https://github.com/isaacs/once
[standard-version]: https://github.com/conventional-changelog/standard-version
[verb-generate-readme]: https://github.com/verbose/verb-generate-readme
[verb]: https://github.com/verbose/verb

[downloads-url]: https://www.npmjs.com/package/mich-to-html
[downloads-img]: https://img.shields.io/npm/dt/mich-to-html.svg

Expand All @@ -117,13 +164,3 @@ _Project scaffolded using [charlike][] cli._
[standard-url]: https://github.com/feross/standard
[standard-img]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg

[always-done]: https://github.com/hybridables/always-done
[async-done]: https://github.com/gulpjs/async-done
[base]: https://github.com/node-base/base
[charlike]: https://github.com/tunnckocore/charlike
[commitizen]: https://github.com/commitizen/cz-cli
[dezalgo]: https://github.com/npm/dezalgo
[once]: https://github.com/isaacs/once
[standard-version]: https://github.com/conventional-changelog/standard-version
[verb-generate-readme]: https://github.com/verbose/verb-generate-readme
[verb]: https://github.com/verbose/verb

0 comments on commit 78ae626

Please sign in to comment.