Skip to content

Commit 7d88f57

Browse files
committed
Refactor module for changes in remark, retext
Been a while! remark now includes `remark-range` internally, so there’s no reason to depend on it. Additionally, changes in unified resulted in the tree no longer being patched on `file`s. This update ensures everything is nice and clean and updated again. The interface also changed: the first parameter is now a node, before the file. Related to remarkjs/remark-retext#1.
1 parent aa5851c commit 7d88f57

15 files changed

+311
-542
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ charset = utf-8
88
trim_trailing_whitespace = true
99
insert_final_newline = true
1010

11-
[*.{json,html,svg,css,remarkrc,eslintrc}]
11+
[*.{json,remarkrc,eslintrc,sh}]
1212
indent_size = 2
1313

1414
[*.md]

.eslintignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
components/
21
coverage/
2+
example.js
33
mdast-util-to-nlcst.js
44
mdast-util-to-nlcst.min.js

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.DS_Store
22
*.log
3-
components/
43
coverage/
54
node_modules/
65
mdast-util-to-nlcst.js

.jscs.json

Lines changed: 22 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,31 @@
11
{
22
"excludeFiles": [
3-
"components/",
43
"coverage/",
54
"node_modules/",
65
"mdast-util-to-nlcst.js",
76
"mdast-util-to-nlcst.min.js"
87
],
8+
"preset": "crockford",
9+
"requireMultipleVarDecl": false,
10+
"disallowDanglingUnderscores": false,
11+
"disallowQuotedKeysInObjects": {
12+
"allExcept": [
13+
"reserved"
14+
]
15+
},
16+
"disallowKeywords": [
17+
"with"
18+
],
19+
"maximumLineLength": {
20+
"value": 79,
21+
"allExcept": [
22+
"regex",
23+
"urlComments"
24+
]
25+
},
926
"jsDoc": {
1027
"checkAnnotations": "jsdoc3",
28+
"checkParamExistence": true,
1129
"checkParamNames": true,
1230
"checkRedundantAccess": true,
1331
"checkRedundantParams": true,
@@ -17,127 +35,9 @@
1735
"enforceExistence": true,
1836
"requireHyphenBeforeDescription": true,
1937
"requireNewlineAfterDescription": true,
20-
"requireParamTypes": true,
2138
"requireParamDescription": true,
39+
"requireParamTypes": true,
40+
"requireReturnDescription": true,
2241
"requireReturnTypes": true
23-
},
24-
"requireCurlyBraces": [
25-
"if",
26-
"else",
27-
"for",
28-
"while",
29-
"do",
30-
"try",
31-
"catch"
32-
],
33-
"requireSpaceAfterKeywords": [
34-
"if",
35-
"else",
36-
"for",
37-
"while",
38-
"do",
39-
"switch",
40-
"return",
41-
"try",
42-
"catch"
43-
],
44-
"requireSpaceBeforeBlockStatements": true,
45-
"requireParenthesesAroundIIFE": true,
46-
"requireSpacesInConditionalExpression": true,
47-
"requireSpacesInFunctionExpression": {
48-
"beforeOpeningCurlyBrace": true
49-
},
50-
"requireSpacesInAnonymousFunctionExpression": {
51-
"beforeOpeningRoundBrace": true,
52-
"beforeOpeningCurlyBrace": true
53-
},
54-
"requireSpacesInNamedFunctionExpression": {
55-
"beforeOpeningRoundBrace": true,
56-
"beforeOpeningCurlyBrace": true
57-
},
58-
"requireBlocksOnNewline": true,
59-
"disallowEmptyBlocks": true,
60-
"disallowSpacesInsideObjectBrackets": true,
61-
"disallowSpacesInsideArrayBrackets": true,
62-
"disallowSpacesInsideParentheses": true,
63-
"requireSpacesInsideObjectBrackets": "all",
64-
"disallowDanglingUnderscores": true,
65-
"disallowSpaceAfterObjectKeys": true,
66-
"requireCommaBeforeLineBreak": true,
67-
"requireOperatorBeforeLineBreak": [
68-
"?",
69-
"+",
70-
"-",
71-
"/",
72-
"*",
73-
"=",
74-
"==",
75-
"===",
76-
"!=",
77-
"!==",
78-
">",
79-
">=",
80-
"<",
81-
"<="
82-
],
83-
"requireSpaceBeforeBinaryOperators": [
84-
"+",
85-
"-",
86-
"/",
87-
"*",
88-
"=",
89-
"==",
90-
"===",
91-
"!=",
92-
"!=="
93-
],
94-
"requireSpaceAfterBinaryOperators": [
95-
"+",
96-
"-",
97-
"/",
98-
"*",
99-
"=",
100-
"==",
101-
"===",
102-
"!=",
103-
"!=="
104-
],
105-
"disallowSpaceAfterPrefixUnaryOperators": [
106-
"++",
107-
"--",
108-
"+",
109-
"-",
110-
"~",
111-
"!"
112-
],
113-
"disallowSpaceBeforePostfixUnaryOperators": [
114-
"++",
115-
"--"
116-
],
117-
"disallowImplicitTypeConversion": [
118-
"numeric",
119-
"boolean",
120-
"binary",
121-
"string"
122-
],
123-
"requireCamelCaseOrUpperCaseIdentifiers": true,
124-
"disallowKeywords": [
125-
"with"
126-
],
127-
"disallowMultipleLineStrings": true,
128-
"disallowMultipleLineBreaks": true,
129-
"validateLineBreaks": "LF",
130-
"validateQuoteMarks": "'",
131-
"disallowMixedSpacesAndTabs": true,
132-
"disallowTrailingWhitespace": true,
133-
"disallowTrailingComma": true,
134-
"disallowKeywordsOnNewLine": [
135-
"else"
136-
],
137-
"requireLineFeedAtFileEnd": true,
138-
"maximumLineLength": 78,
139-
"requireCapitalizedConstructors": true,
140-
"safeContextKeyword": "self",
141-
"requireDotNotation": true,
142-
"disallowYodaConditions": true
42+
}
14343
}

.remarkignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
components/
2-
test/fixtures/
1+
test

.remarkrc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"output": true,
33
"plugins": [
4+
"comment-config",
45
"lint",
56
"github",
6-
"comment-config",
7-
"slug",
8-
"validate-links"
7+
"validate-links",
8+
"usage"
99
],
1010
"settings": {
1111
"bullet": "*"

.travis.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
language: node_js
2-
script: npm run-script test
32
node_js:
4-
- '0.10'
53
- '0.11'
64
- '0.12'
75
- '4.0'
86
- '5.0'
9-
- iojs
7+
- '6.0'
108
sudo: false
11-
after_script: npm install codecov.io && cat ./coverage/lcov.info | codecov
9+
after_success:
10+
- bash <(curl -s https://codecov.io/bash)
1211
deploy:
1312
- provider: npm
1413
1514
api_key:
1615
secure: ktMmSsdD5PXBn07Ns6A3Ly814H8TQyPeb7TuTJNlBYGwkkdyBElwJAsiDDdj+tHr8FPiP7qCaZrOmynxyvFiXRRFOJj3P9UA3IzptMMQPnqaOYLF1AQvSBnGdo54sGXa9cnKICBGT6cuap8HZ6blJAEEwkeq9UH3cbT4knQahmEeDmJbg5hS5mQxC/MpBfOg9+15AAnCN3Q7sMYS33LcstDaKhD5g/BR42+ZSxXTSuNlgG0hEccvXPEMOqtez8ap5vLf+py27nhGjfkL8lUQvsqEb3bB7oTgqsQ8fsOJ3NEDPZXW3pfhe3s9ACk8SDkTmTrdNn97nZG7vsq8ovhzc9ojeAQ4jXjO5tcgUEDborFWtkZ157NwbXPVCThdUP1ZhsbtLk+q+AV1c8ON0fnc8VQgtPDev2X37xIyIuA29YkyDIZ2DkNhIaePK2Z7EOIiwGjIpajGQQjco7Z2bgTnBm44wH6hA6YWDxs/QEaH3o/+0SfWXdTFyX/YPOWpRZcyD2UynymJ2A5bPGdoEGkhYp+nsqKxWDCBb8fBOl2VkO02Y6SwesHOW4v0CpQSNOY8FLqTlOOkeiH+H2d9SsSAQARCG6FMUUafsZEGEW+RKhndBOAY9HGs96Zpz06PJh8SAlgsiNL+kkVnzxdpEKnlA/OUySmXyDftTfJQM2OK1MQ=
1716
on:
1817
tags: true
18+
node: '5.0'
1919
- provider: releases
2020
api_key:
2121
secure: RT2G8/cLutMJLAr0bWSSaYDHoQpL5NNAtEi72YQHdl1G/4N30xJiuzw65aoxUnm7ewpKKys3YnFblbJCeLe4CUNfxMm4SrIkJd2oEVGdV5U0eBcXeXBff89pcIdqQ6U5keltgwNKdiw/PAxfvKTNPNrgqtJr1xL8gdu1XgLkVGO2CsLuytkusfaH+jv53uM6UzFZwZYtUVp8X9CigTlpFGKKIB4EN525M1M9mj42BbJ888VTfuCkBpEWXK1ePBlK2HKQXRaRWt01BQ+aKzqNR/Xdi66RKAjFkdi0WbyNetZVJtnOalRhUV7lpCiTCmjQhjt1ldBXpjY2Mq27vylMe54MyfDYgVzeRDkCO/dWTdpueyBTsteBYairBhXeIcZ9mLzahXB3SkRErfGMJwNCkNNxnHBku3nrv3150UppmzOEl9sZXht7D26Ikjqhxk5saabiRDUuD5vlvXbXZ+HbQB0UIYp1PHuX656I8Myh/o5bgxdXgotSFa97rP+tlaoc6ITip/LsAAbwbiNkNF66jlFGUFtn9TcMUsGMDUJk2H9U3iY9ohFHyEOcs2vpQbjFxr6B9SoB4wMCzcHqNH/TbaVRtP/9isGMR/TY5IMPEhcd+DT0iSW1V+DhMN4ur/x+HuNSRvN1Lp3fOWs5v8BBTtOfO6N1SMYQTwZdXmkNzHk=
@@ -24,3 +24,4 @@ deploy:
2424
- "mdast-util-to-nlcst.min.js"
2525
on:
2626
tags: true
27+
node: '6.0'

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(The MIT License)
22

3-
Copyright (c) 2015-2016 Titus Wormer <[email protected]>
3+
Copyright (c) 2015 Titus Wormer <[email protected]>
44

55
Permission is hereby granted, free of charge, to any person obtaining
66
a copy of this software and associated documentation files (the

component.json

Lines changed: 0 additions & 23 deletions
This file was deleted.

example.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Dependencies:
2+
var toNLCST = require('./index.js');
3+
var inspect = require('unist-util-inspect');
4+
var English = require('parse-english');
5+
var remark = require('remark');
6+
var vfile = require('vfile');
7+
8+
// Process:
9+
var file = vfile('Some *foo*sball.');
10+
var tree = remark().parse(file);
11+
12+
// Stringify:
13+
var nlcst = toNLCST(tree, file, English);
14+
15+
// Which, when inspecting, yields:
16+
console.log('txt', inspect.noColor(nlcst));

history.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,7 @@
1313
* Fix implicit sentence detection ([1756f46](https://github.com/wooorm/mdast-util-to-nlcst/commit/1756f46))
1414
* Remove support for component ([08e7b38](https://github.com/wooorm/mdast-util-to-nlcst/commit/08e7b38))
1515
* Remove support for bower ([e8a41f6](https://github.com/wooorm/mdast-util-to-nlcst/commit/e8a41f6))
16-
* Refactor npm test target ([379ee93](https://github.com/wooorm/mdast-util-to-nlcst/commit/379ee93))
17-
* Refactor to replace mocha with tape ([1efd2ca](https://github.com/wooorm/mdast-util-to-nlcst/commit/1efd2ca))
1816
* Update dependencies, dev-dependencies ([60235cd](https://github.com/wooorm/mdast-util-to-nlcst/commit/60235cd))
19-
* Update `mdast` to `remark` ([ed96d00](https://github.com/wooorm/mdast-util-to-nlcst/commit/ed96d00))
2017

2118
1.0.0 / 2015-09-18
2219
==================
23-
24-
* Refactor module ([0dd7eb9](https://github.com/wooorm/mdast-util-to-nlcst/commit/0dd7eb9))
25-
26-
0.2.1 / 2015-08-15
27-
==================
28-
29-
* Fix mis-labeled dependencies ([2a81939](https://github.com/wooorm/mdast-util-to-nlcst/commit/2a81939))
30-
* Update mdast ([d0939b8](https://github.com/wooorm/mdast-util-to-nlcst/commit/d0939b8))
31-
32-
0.2.0 / 2015-08-11
33-
==================
34-
35-
* Refactor API for upcoming unified changes ([c9b2db7](https://github.com/wooorm/mdast-util-to-nlcst/commit/c9b2db7))
36-
* Refactor for changes in mdast ([f5ded15](https://github.com/wooorm/mdast-util-to-nlcst/commit/f5ded15))
37-
38-
0.1.0 / 2015-07-25
39-
==================

0 commit comments

Comments
 (0)