Skip to content

Commit

Permalink
Merge 8780927 into a8a3446
Browse files Browse the repository at this point in the history
  • Loading branch information
denysdovhan committed Dec 25, 2015
2 parents a8a3446 + 8780927 commit 4ebfe11
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 41 deletions.
54 changes: 27 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# remark-textr
# mdast-textr

[![NPM version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]
[![Coveralls Status][coveralls-image]][coveralls-url]
[![Dependency Status][depstat-image]][depstat-url]

> [Remark][remark] plugin for [Textr][textr] — modular tool to [make your typography better][typewriter-habits].
> [Mdast][mdast] plugin for [Textr][textr] — modular tool to [make your typography better][typewriter-habits].
Process your markdown with [Textr][textr] plugins, **skipping code**.

Expand All @@ -19,13 +19,13 @@ Process your markdown with [Textr][textr] plugins, **skipping code**.

## Install

npm install --save remark-textr
npm install --save mdast-textr

## Usage

```js
import remark from 'remark';
import remarkTextr from 'remark-textr';
import mdast from 'mdast';
import mdastTextr from 'mdast-textr';

// textr plugin — just function to replace triple dots to ellipses
const ellipses = input => input.replace(/\.{3}/gim, '');
Expand All @@ -36,17 +36,17 @@ const text = `
function(...args) { return args; }
`.trim();

remark.use(remarkTextr, { plugins: [ ellipses ] }).process(text);/*
mdast.use(mdastTextr, { plugins: [ ellipses ] }).process(text);/*
## spread operator…
function(...args) { return args; } */
```

## API

### remark.use(remarkTextr[, remarkOptions])
### mdast.use(mdastTextr[, mdastOptions])

#### remarkOptions
#### mdastOptions

Type: `Object`
Default: `{}`
Expand All @@ -55,7 +55,7 @@ Contain `plugins` and `options` which are Textr’s options. Check out [Textr us

[textr-usage]: https://github.com/shuvalov-anton/textr#usage

##### remarkOptions.plugins
##### mdastOptions.plugins

Type: `Array`
Default: `[]`
Expand All @@ -64,7 +64,7 @@ Array of [Textr][textr] plugins. They are available on npm, labelled with [textr

[textr-plugins]: https://www.npmjs.com/browse/keyword/textr

##### remarkOptions.options
##### mdastOptions.options

Type: `Object`
Default: `{}`
Expand All @@ -75,20 +75,20 @@ For example, you may want to set your [ISO 639][iso] [locale code][locale]. It's

## CLI

`remark-textr` as remark plugin has no CLI itself, so you are gonna use remark CLI instead. So check the [remark-cli docs][remark-cli] first. `remark` and `remark-textr` both have to be installed. Also you have to define `textr` plugins as Array of Strings, but you are lucky and `remark-textr` will require them for you!
`mdast-textr` as mdast plugin has no CLI itself, so you are gonna use mdast CLI instead. So check the [mdast-cli docs][mdast-cli] first. `mdast` and `mdast-textr` both have to be installed. Also you have to define `textr` plugins as Array of Strings, but you are lucky and `mdast-textr` will require them for you!

[remark-cli]: https://github.com/wooorm/remark/#cli
[mdast-cli]: https://github.com/wooorm/mdast/#cli
[t-base]: https://github.com/iamstarkov/typographic-base

### inline

remark --use "textr=plugins:['typographic-base']" README.md --output README.md
mdast --use "textr=plugins:['typographic-base']" README.md --output README.md

### config

remark README.md --output README.md
mdast README.md --output README.md

With this `.remarkrc` config defined:
With this `.mdastrc` config defined:

```json
{
Expand All @@ -105,22 +105,22 @@ With this `.remarkrc` config defined:

MIT © [Denys Dovhan](http://denysdovhan.com)

[remark]: https://github.com/wooorm/remark
[use]: https://github.com/wooorm/remark#remarkuseplugin-options
[mdast]: http://mdast.js.org/
[use]: https://github.com/wooorm/mdast#mdastuseplugin-options
[locale]: https://github.com/shuvalov-anton/textr#locale-option-consistence
[iso]: http://www.wikiwand.com/en/List_of_ISO_639-1_codes

[remarkrc]: https://github.com/wooorm/remark/blob/master/doc/remarkrc.5.md
[remark-use]: https://github.com/wooorm/remark/blob/master/doc/remark.3.md#remarkuseplugin-options
[mdastrc]: https://github.com/wooorm/mdast/blob/master/doc/mdastrc.5.md
[mdast-use]: https://github.com/wooorm/mdast/blob/master/doc/mdast.3.md#mdastuseplugin-options

[npm-url]: https://npmjs.org/package/remark-textr
[npm-image]: https://img.shields.io/npm/v/remark-textr.svg?style=flat-square
[npm-url]: https://npmjs.org/package/mdast-textr
[npm-image]: https://img.shields.io/npm/v/mdast-textr.svg?style=flat-square

[travis-url]: https://travis-ci.org/denysdovhan/remark-textr
[travis-image]: https://img.shields.io/travis/denysdovhan/remark-textr.svg?style=flat-square
[travis-url]: https://travis-ci.org/denysdovhan/mdast-textr
[travis-image]: https://img.shields.io/travis/denysdovhan/mdast-textr.svg?style=flat-square

[coveralls-url]: https://coveralls.io/r/denysdovhan/remark-textr
[coveralls-image]: https://img.shields.io/coveralls/denysdovhan/remark-textr.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/denysdovhan/mdast-textr
[coveralls-image]: https://img.shields.io/coveralls/denysdovhan/mdast-textr.svg?style=flat-square

[depstat-url]: https://david-dm.org/denysdovhan/remark-textr
[depstat-image]: https://david-dm.org/denysdovhan/remark-textr.svg?style=flat-square
[depstat-url]: https://david-dm.org/denysdovhan/mdast-textr
[depstat-image]: https://david-dm.org/denysdovhan/mdast-textr.svg?style=flat-square
15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "remark-textr",
"version": "2.0.0",
"description": "Remark plugin for Textr — modular tool to make your typography better.",
"name": "mdast-textr",
"version": "1.0.0",
"description": "Mdast plugin for Textr — modular tool to make your typography better.",
"main": "index.es5.js",
"scripts": {
"watch": "npm run transpile -- --watch",
Expand All @@ -19,11 +19,10 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/denysdovhan/remark-textr.git"
"url": "git+https://github.com/denysdovhan/mdast-typographer.git"
},
"keywords": [
"mdast",
"remark",
"plugin",
"markdown",
"md",
Expand All @@ -36,9 +35,9 @@
"author": "Denys Dovhan <email@denysdovhan.com> (http://denysdovhan.com)",
"license": "MIT",
"bugs": {
"url": "https://github.com/denysdovhan/remark-textr/issues"
"url": "https://github.com/denysdovhan/mdast-typographer/issues"
},
"homepage": "https://github.com/denysdovhan/remark-textr#readme",
"homepage": "https://github.com/denysdovhan/mdast-typographer#readme",
"devDependencies": {
"assert": "*",
"babel-cli": "^6.1.18",
Expand All @@ -49,7 +48,7 @@
"coveralls": "*",
"eslint": "^1.9.0",
"isparta": "*",
"remark": "^3.0.0",
"mdast": "^2.1.0",
"mocha": "*",
"npm-run-all": "*",
"rimraf": "*",
Expand Down
12 changes: 6 additions & 6 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { equal } from 'assert';
import remark from 'remark';
import remarkTextr from './index';
import mdast from 'mdast';
import mdastTextr from './index';

// textr plugin — just function to replace triple dots to ellipses
const ellipses = input => input.replace(/\.{3}/gim, '…');
Expand All @@ -11,16 +11,16 @@ const text = `
function(...args) { return args; }
`;

it('should remarkTextr in node', () =>
it('should mdastTextr in node', () =>
equal(
remark.use(remarkTextr, { plugins: [ ellipses ] }).process(text),
mdast.use(mdastTextr, { plugins: [ ellipses ] }).process(text),
`## spread operator…
function(...args) { return args; }
`));

it('should remarkTextr in CLI (with options)', () =>
equal(remark.use(remarkTextr, {
it('should mdastTextr in CLI (with options)', () =>
equal(mdast.use(mdastTextr, {
plugins: [ 'typographic-ellipses', 'typographic-quotes' ],
options: { locale: 'ru' }
}).process('yo "there" ...\n'), 'yo «there» …\n')
Expand Down

0 comments on commit 4ebfe11

Please sign in to comment.