Skip to content

Commit

Permalink
Fix casing
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Nov 7, 2018
1 parent 9efb82b commit 9448c22
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 27 deletions.
10 changes: 5 additions & 5 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

module.exports = toHAST
module.exports = toHast

var xtend = require('xtend')
var u = require('unist-builder')
Expand All @@ -27,8 +27,8 @@ function factory(tree, options) {

return h

/* Finalise the created `right`, a HAST node, from
* `left`, an MDAST node. */
/* Finalise the created `right`, a hast node, from
* `left`, an mdast node. */
function augment(left, right) {
var data
var ctx
Expand Down Expand Up @@ -86,8 +86,8 @@ function factory(tree, options) {
}
}

/* Transform `tree`, which is an MDAST node, to a HAST node. */
function toHAST(tree, options) {
/* Transform `tree`, which is an mdast node, to a hast node. */
function toHast(tree, options) {
var h = factory(tree, options)
var node = one(h, tree)
var footnotes = footer(h)
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mdast-util-to-hast",
"version": "3.0.3",
"description": "Transform MDAST to HAST",
"description": "Transform mdast to hast",
"license": "MIT",
"keywords": [
"mdast",
Expand Down Expand Up @@ -43,8 +43,8 @@
},
"scripts": {
"format": "remark . -qfo && prettier --write '**/*.js' && xo --fix",
"build-bundle": "browserify index.js -s mdastUtilToHAST > mdast-util-to-hast.js",
"build-mangle": "browserify index.js -s mdastUtilToHAST -p tinyify > mdast-util-to-hast.min.js",
"build-bundle": "browserify index.js -s mdastUtilToHast > mdast-util-to-hast.js",
"build-mangle": "browserify index.js -s mdastUtilToHast -p tinyify > mdast-util-to-hast.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test/index.js",
Expand Down
36 changes: 18 additions & 18 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![Downloads][downloads-badge]][downloads]
[![Chat][chat-badge]][chat]

Transform [MDAST][] to [HAST][].
Transform [mdast][] to [hast][].

> **Note**: You probably want to use [remark-rehype][].
Expand All @@ -32,13 +32,13 @@ var inspect = require('unist-util-inspect')
var unified = require('unified')
var parse = require('remark-parse')
var vfile = require('to-vfile')
var toHAST = require('mdast-util-to-hast')
var toHast = require('mdast-util-to-hast')

var tree = unified()
.use(parse)
.parse(vfile.readSync('example.md'))

console.log(inspect(toHAST(tree)))
console.log(inspect(toHast(tree)))
```

Which when running with `node example` yields:
Expand All @@ -54,9 +54,9 @@ root[1] (1:1-2:1, 0-20)

## API

### `toHAST(node[, options])`
### `toHast(node[, options])`

Transform the given [MDAST][] tree to a [HAST][] tree.
Transform the given [mdast][] tree to a [hast][] tree.

##### Options

Expand All @@ -72,7 +72,7 @@ are found. The default behaviour is to prefer the last duplicate definition.

###### `options.handlers`

Object mapping [MDAST nodes][mdast] to functions handling those elements.
Object mapping [mdast nodes][mdast] to functions handling those elements.
Take a look at [`lib/handlers/`][handlers] for examples.

##### Returns
Expand All @@ -86,17 +86,17 @@ Take a look at [`lib/handlers/`][handlers] for examples.
* [`position`][unist-position]s are properly patched
* Unknown nodes with `children` are transformed to `div` elements
* Unknown nodes with `value` are transformed to `text` nodes
* [`node.data.hName`][hname] configures the HAST element’s tag-name
* [`node.data.hProperties`][hproperties] is mixed into the HAST element’s
* [`node.data.hName`][hname] configures the hast element’s tag-name
* [`node.data.hProperties`][hproperties] is mixed into the hast element’s
properties
* [`node.data.hChildren`][hchildren] configures the HAST element’s children
* [`node.data.hChildren`][hchildren] configures the hast element’s children

##### Examples

###### `hName`

`node.data.hName` sets the tag-name of an element.
The following [MDAST][]:
The following [mdast][]:

```js
{
Expand All @@ -106,7 +106,7 @@ The following [MDAST][]:
}
```

Yields, in [HAST][]:
Yields, in [hast][]:

```js
{
Expand All @@ -120,7 +120,7 @@ Yields, in [HAST][]:
###### `hProperties`

`node.data.hProperties` in sets the properties of an element.
The following [MDAST][]:
The following [mdast][]:

```js
{
Expand All @@ -132,7 +132,7 @@ The following [MDAST][]:
}
```

Yields, in [HAST][]:
Yields, in [hast][]:

```js
{
Expand All @@ -150,7 +150,7 @@ Yields, in [HAST][]:
###### `hChildren`

`node.data.hChildren` sets the children of an element.
The following [MDAST][]:
The following [mdast][]:

```js
{
Expand All @@ -171,7 +171,7 @@ The following [MDAST][]:
}
```

Yields, in [HAST][] (**note**: the `pre` and `language-js` class are normal
Yields, in [hast][] (**note**: the `pre` and `language-js` class are normal
`mdast-util-to-hast` functionality):

```js
Expand Down Expand Up @@ -199,11 +199,11 @@ Yields, in [HAST][] (**note**: the `pre` and `language-js` class are normal
## Related

* [`mdast-util-to-nlcst`](https://github.com/syntax-tree/mdast-util-to-nlcst)
— Transform MDAST to NLCST
— Transform mdast to nlcst
* [`hast-util-sanitize`](https://github.com/syntax-tree/hast-util-sanitize)
— Sanitize HAST nodes
— Sanitize hast nodes
* [`hast-util-to-mdast`](https://github.com/syntax-tree/hast-util-to-mdast)
— Transform HAST to MDAST
— Transform hast to mdast
* [`remark-rehype`](https://github.com/remarkjs/remark-rehype)
— rehype support for remark
* [`rehype-remark`](https://github.com/rehypejs/rehype-remark)
Expand Down
2 changes: 1 addition & 1 deletion test/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var test = require('tape')
var u = require('unist-builder')
var to = require('..')

test('toHAST()', function(t) {
test('toHast()', function(t) {
t.throws(
function() {
to(u('bar', [true]))
Expand Down

0 comments on commit 9448c22

Please sign in to comment.