New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core rule utility #366

Open
azu opened this Issue Dec 11, 2017 · 4 comments

Comments

Projects
None yet
1 participant
@azu
Member

azu commented Dec 11, 2017

I've created many many rules.
But textlint not have core utility library without textlint-rule-helper.

Now, textlint have been reached baseline.

We can think what is needed as core rule utility.

Motivation

I've created some library to help create a textlint rule.

But, these library source is string, is not AST.
(Exception textlint-rule-helper and textlint-util-to-string)

So, string source cause some problems.
Because, To string drop some information about textlint AST Note.

For example, Converting Paragraph node to string and Drop children node inforation of the Paragraph node

Proposals 💭

I think that following utility is useful if exists.
Core utility should not relay on language convention as a possible.
In other word, core utility almost related with AST converter, manipulator, etc...

AST: AST is TxtNode.

Further reading

RedPen has Section and Sentence.

(Need more Further reading)

Next

Call for request idea! 💡

Create experimental implementation from ideas.
Probably, This issue will be moved to other repository.

@azu azu changed the title from Core rule utility library to Core rule utility Dec 11, 2017

@azu

This comment has been minimized.

Show comment
Hide comment
@azu

azu Dec 14, 2017

Member

My illustation:

  • Section // <= Rule user land
    • Paragraph // <= Provided by textlint
      • Sentence // <= Rule user land
        • Str // <= Provided by textlint
      • Sentence
    • Paragraph
      • Sentence
      • Sentence

Usage of extenstion:

"use strict";
const rule = function(context) {
    return use([SectionExtention, SentenceExtension]).then(() => {
        return {
            ["Section"](node) {

            },
            ["Sentence"](node) {

            }
        };
    })
};
module.exports = rule;

Notes:

Q. Why textlint does not provide Section and Sentence?
A. Section and Sentence depended on natural langurage.
For example, The definition of "A setence" need to diffirence rules by natural language.

textlint(TxtAST) define file format. It should not depended on natural language context.

Member

azu commented Dec 14, 2017

My illustation:

  • Section // <= Rule user land
    • Paragraph // <= Provided by textlint
      • Sentence // <= Rule user land
        • Str // <= Provided by textlint
      • Sentence
    • Paragraph
      • Sentence
      • Sentence

Usage of extenstion:

"use strict";
const rule = function(context) {
    return use([SectionExtention, SentenceExtension]).then(() => {
        return {
            ["Section"](node) {

            },
            ["Sentence"](node) {

            }
        };
    })
};
module.exports = rule;

Notes:

Q. Why textlint does not provide Section and Sentence?
A. Section and Sentence depended on natural langurage.
For example, The definition of "A setence" need to diffirence rules by natural language.

textlint(TxtAST) define file format. It should not depended on natural language context.

@azu

This comment has been minimized.

Show comment
Hide comment
@azu

This comment has been minimized.

Show comment
Hide comment
@azu
Member

azu commented Dec 20, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment