remark-textr
Advanced tools
Comparing version 2.1.0 to 3.0.0
@@ -20,4 +20,4 @@ 'use strict'; | ||
function attacher(processor) { | ||
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
function attacher() { | ||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | ||
_ref$plugins = _ref.plugins, | ||
@@ -24,0 +24,0 @@ plugins = _ref$plugins === undefined ? [] : _ref$plugins, |
@@ -5,3 +5,3 @@ import visit from 'unist-util-visit'; | ||
export default function attacher( | ||
processor, { plugins = [], options = {} } = {} | ||
{ plugins = [], options = {} } = {} | ||
) { | ||
@@ -8,0 +8,0 @@ return function transformer(ast) { |
{ | ||
"name": "remark-textr", | ||
"version": "2.1.0", | ||
"version": "3.0.0", | ||
"description": "Remark plugin for Textr — modular tool to make your typography better.", | ||
@@ -52,5 +52,5 @@ "main": "index.es5.js", | ||
"isparta": "*", | ||
"remark": "^6.0.1", | ||
"remark": "^7.0.0", | ||
"mocha": "*", | ||
"npm-run-all": "4.0.1", | ||
"npm-run-all": "4.0.2", | ||
"rimraf": "*", | ||
@@ -57,0 +57,0 @@ "typographic-ellipses": "^1.0.11", |
41
test.js
import { equal } from 'assert'; | ||
import remark from 'remark'; | ||
import remarkTextr from './index'; | ||
import remarkTextr from '.'; | ||
@@ -8,3 +8,4 @@ // textr plugin — just function to replace triple dots to ellipses | ||
const text = ` | ||
it('should remarkTextr in node', () => { | ||
const fixture = ` | ||
## spread operator... | ||
@@ -15,15 +16,29 @@ | ||
it('should remarkTextr in node', () => | ||
equal( | ||
remark().use(remarkTextr, { plugins: [ ellipses ] }).process(text), | ||
`## spread operator… | ||
const expected = ` | ||
## spread operator… | ||
function(...args) { return args; } | ||
`)); | ||
`; | ||
it('should remarkTextr in CLI (with options)', () => | ||
equal(remark().use(remarkTextr, { | ||
plugins: [ 'typographic-ellipses', 'typographic-quotes' ], | ||
options: { locale: 'ru' } | ||
}).process('yo "there" ...\n'), 'yo «there» …\n') | ||
); | ||
const actual = remark() | ||
.use(remarkTextr, { plugins: [ ellipses ] }) | ||
.processSync(fixture) | ||
.toString(); | ||
equal(actual.trim(), expected.trim()); | ||
}); | ||
it('should remarkTextr in CLI (with options)', () => { | ||
const fixture = 'yo "there" ...\n'; | ||
const expected = 'yo «there» …\n'; | ||
const actual = remark() | ||
.use(remarkTextr, { | ||
plugins: [ 'typographic-ellipses', 'typographic-quotes' ], | ||
options: { locale: 'ru' } | ||
}) | ||
.processSync(fixture) | ||
.toString(); | ||
equal(actual.trim(), expected.trim()); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
72
115200