Paragraph Node to plain text with SourceMap.
SourceMap mean that could revert
position in plain text to
position in Node.
npm install textlint-util-to-string
index are the same as those explained in Constellation/structured-source.
column property of
position as it is 0-based index.
Return instance of Source.
originalIndexFromIndex(generatedIndex): number | undefined
Get original index from generated index value
originalPositionFromPosition(position): Position | undefined
Get original position from generated position
originalIndexFromPosition(generatedPosition): number | undefined
Get original index from generated position
originalPositionFromIndex(generatedIndex): Position | undefined
Get original position from generated index
;;let originalText = "This is [Example！？]()";let AST = ;let source = AST;let result = source;// StringSource#toString returns a plain textassert;// "Example" is located at the index 8 in the plain text// ^let index1 = result;assert;// The same "E" is located at the index 9 in the original textassert;assert
- azu/textlint-rule-first-sentence-length: textlint rule that limit maximum length of First sentence of the section.
- azu/textlint-rule-en-max-word-count: textlint rule that specify the maximum word count of a sentence.
- nodaguti/textlint-rule-spellchecker: textlint rule to check spellings with native spellchecker
Why return relative position from rootNode?
let AST = ...let rootNode = ASTchildren10;let source = rootNode;source; // should be 0
To return relative position easy to compute position(We think).
One space has a single absolute position, The other should be relative position.
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D