@textlint/textlint-plugin-text
Advanced tools
Comparing version 3.0.10 to 3.1.0-alpha.bbfc8f6d
@@ -17,9 +17,18 @@ /* eslint-disable no-unused-vars */ | ||
var TextProcessor = exports.TextProcessor = function () { | ||
function TextProcessor(config) { | ||
function TextProcessor() { | ||
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
_classCallCheck(this, TextProcessor); | ||
this.config = config; | ||
// support "extension" option | ||
this.extensions = this.config.extensions ? this.config.extensions : []; | ||
} | ||
_createClass(TextProcessor, [{ | ||
key: "availableExtensions", | ||
value: function availableExtensions() { | ||
return [".txt", ".text"].concat(this.extensions); | ||
} | ||
}, { | ||
key: "processor", | ||
@@ -39,7 +48,2 @@ value: function processor(ext) { | ||
} | ||
}], [{ | ||
key: "availableExtensions", | ||
value: function availableExtensions() { | ||
return [".txt", ".text"]; | ||
} | ||
}]); | ||
@@ -46,0 +50,0 @@ |
{ | ||
"name": "@textlint/textlint-plugin-text", | ||
"version": "3.0.10", | ||
"version": "3.1.0-alpha.bbfc8f6d", | ||
"description": "plain text plugin for textlint", | ||
@@ -32,3 +32,3 @@ "homepage": "https://github.com/textlint/textlint/tree/master/packages/@textlint/textlint-plugin-text/", | ||
"dependencies": { | ||
"@textlint/text-to-ast": "^3.0.8" | ||
"@textlint/text-to-ast": "^3.1.0-alpha.bbfc8f6d" | ||
}, | ||
@@ -42,6 +42,6 @@ "devDependencies": { | ||
"cross-env": "^4.0.0", | ||
"mocha": "^4.0.1", | ||
"mocha": "^5.1.1", | ||
"power-assert": "^1.4.2", | ||
"rimraf": "^2.6.2", | ||
"textlint": "^10.2.1", | ||
"textlint": "^10.3.0-alpha.bbfc8f6d", | ||
"textlint-rule-no-todo": "^2.0.0" | ||
@@ -48,0 +48,0 @@ }, |
@@ -13,17 +13,33 @@ # @textlint/textlint-plugin-text | ||
This plugin is built-in support on textlint. | ||
This plugin is built-in in textlint. | ||
No need configuration. | ||
----- | ||
------ | ||
No need configuration. | ||
Following config is set by default. | ||
Manually add text plugin to do following: | ||
``` | ||
{ | ||
"plugins": [ | ||
"text" | ||
] | ||
"plugins": { | ||
"@textlint/markdown": true | ||
} | ||
} | ||
``` | ||
## Options | ||
- `extensions`: `string[]` | ||
- Additional file extensions for markdown | ||
For example, if you want to treat `.custom-ext` as text, put following config to `.textlintrc` | ||
```json5 | ||
{ | ||
"plugins": { | ||
"@textlint/text": { | ||
"extensions": [".custom-ext"] | ||
} | ||
} | ||
} | ||
``` | ||
## Changelog | ||
@@ -30,0 +46,0 @@ |
@@ -5,9 +5,12 @@ /* eslint-disable no-unused-vars */ | ||
import { parse } from "@textlint/text-to-ast"; | ||
export class TextProcessor { | ||
constructor(config) { | ||
constructor(config = {}) { | ||
this.config = config; | ||
// support "extension" option | ||
this.extensions = this.config.extensions ? this.config.extensions : []; | ||
} | ||
static availableExtensions() { | ||
return [".txt", ".text"]; | ||
availableExtensions() { | ||
return [".txt", ".text"].concat(this.extensions); | ||
} | ||
@@ -14,0 +17,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
13822
81
74
1