Skip to content
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

Add textlint #1

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open

Add textlint #1

wants to merge 39 commits into from

Conversation

azu
Copy link
Member

@azu azu commented Mar 27, 2016

Add Markdown and plain texts support.

Would We created a fork of astexplorer?
It is specific usage of textlint and textlint is a minor tool.

Pros

Would the user of astexplorer need textlint support?

Cons

  • Maintaince cost 🆙
  • Drop saving feature

Ref: textlint/textlint#176

@azu
Copy link
Member Author

azu commented Mar 27, 2016

ERROR in /Users/azu/~/remark/index.js
Module not found: Error: Cannot resolve module 'json' in /Users/azu/node_modules/remark
 @ /Users/azu/~/remark/index.js 21:13-41

ERROR in /Users/azu/~/remark/lib/parse.js
Module not found: Error: Cannot resolve module 'json' in /Users/azu/node_modules/remark/lib
 @ /Users/azu/~/remark/lib/parse.js 26:20-52

ERROR in /Users/azu/~/character-entities/index.js
Module not found: Error: Cannot resolve module 'json' in /Users/azu/node_modules/character-entities
 @ /Users/azu/~/character-entities/index.js 17:17-40

ERROR in /Users/azu/~/character-entities-legacy/index.js
Module not found: Error: Cannot resolve module 'json' in /Users/azu/node_modules/character-entities-legacy
 @ /Users/azu/~/character-entities-legacy/index.js 17:17-40

ERROR in /Users/azu/~/character-entities-html4/index.js
Module not found: Error: Cannot resolve module 'json' in /Users/azu/node_modules/character-entities-html4
 @ /Users/azu/~/character-entities-html4/index.js 17:17-40

ERROR in /Users/azu/~/character-reference-invalid/index.js
Module not found: Error: Cannot resolve module 'json' in /Users/azu/node_modules/character-reference-invalid
 @ /Users/azu/~/character-reference-invalid/index.js 17:17-40

requiring json throw error...

npm install webpack@beta resolve this issue.

@azu
Copy link
Member Author

azu commented Mar 27, 2016

ast explorer 2016-03-27 12-42-38

@azu
Copy link
Member Author

azu commented Mar 27, 2016

Currenlty, Transform of textlint don't work.

da1e9eb

import compileModule from '../../../utils/compileModule';
import pkg from 'textlint/package.json';

const ID = 'textlint';

export default {
    id: ID,
    displayName: ID,
    version: pkg.version,
    homepage: pkg.homepage,

    defaultParserID: 'textlint:markdown-to-ast',

    loadTransformer(callback) {
        require(['textlint/lib/textlint-core', 'babel-core'], (TextLintCore, babel) => {
            callback({ TextLintCore, babel });
        })
    },

    transform({TextLintCore, babel}, transformCode, code) {
        console.log(TextLintCore);
        const textlintCore = new TextLintCore();
        let rule = compileModule( // eslint-disable-line no-shadow
            babel.transform(transformCode).code
        );
        textlintCore.setupRules({
            'astExplorerRule': rule
        });
        return textlintCore.lintText(code, ".md").then(result => {
            return JSON.stringify(result);
        });
    }
};

Error

index.js?e7c5:62 Uncaught (in promise) TypeError: Cannot redefine property: exports
    at Function.defineProperty (native)
    at Object.eval (eval at <anonymous> (http://127.0.0.1:8080/0.js:39:2), <anonymous>:62:8)
    at eval (eval at <anonymous> (http://127.0.0.1:8080/0.js:39:2), <anonymous>:67:30)
    at Object.webpackJsonp../node_modules/ansi-styles/index.js (http://127.0.0.1:8080/0.js:39:2)
    at __webpack_require__ (http://127.0.0.1:8080/vendor.js:48:30)
    at Object.eval (eval at <anonymous> (http://127.0.0.1:8080/0.js:2189:2), <anonymous>:3:18)
    at eval (eval at <anonymous> (http://127.0.0.1:8080/0.js:2189:2), <anonymous>:118:30)
    at Object.webpackJsonp../node_modules/chalk/index.js (http://127.0.0.1:8080/0.js:2189:2)
    at __webpack_require__ (http://127.0.0.1:8080/vendor.js:48:30)
    at eval (eval at <anonymous> (http://127.0.0.1:8080/0.js:309:2), <anonymous>:24:14)
    at Object.webpackJsonp../node_modules/babel-core/lib/helpers/code-frame.js (http://127.0.0.1:8080/0.js:309:2)
    at __webpack_require__ (http://127.0.0.1:8080/vendor.js:48:30)
    at eval (eval at <anonymous> (http://127.0.0.1:8080/0.js:1579:2), <anonymous>:17:25)
    at Object.webpackJsonp../node_modules/babel-core/lib/traversal/path/replacement.js (http://127.0.0.1:8080/0.js:1579:2)
    at __webpack_require__ (http://127.0.0.1:8080/vendor.js:48:30)
    at eval (eval at <anonymous> (http://127.0.0.1:8080/0.js:1479:2), <anonymous>:172:53)(anonymous function) @ index.js?e7c5:62(anonymous function) @ index.js?e7c5:67webpackJsonp../node_modules/ansi-styles/index.js @ 0.js:39__webpack_require__ @ vendor.js:48(anonymous function) @ index.js?d69f:3(anonymous function) @ index.js?d69f:118webpackJsonp../node_modules/chalk/index.js @ 0.js:2189__webpack_require__ @ vendor.js:48(anonymous function) @ code-frame.js?6fae:24webpackJsonp../node_modules/babel-core/lib/helpers/code-frame.js @ 0.js:309__webpack_require__ @ vendor.js:48(anonymous function) @ replacement.js?6cf9:17webpackJsonp../node_modules/babel-core/lib/traversal/path/replacement.js @ 0.js:1579__webpack_require__ @ vendor.js:48(anonymous function) @ index.js?8e66:172webpackJsonp../node_modules/babel-core/lib/traversal/path/index.js @ 0.js:1479__webpack_require__ @ vendor.js:48(anonymous function) @ context.js?dbf0:16webpackJsonp../node_modules/babel-core/lib/traversal/context.js @ 0.js:1389__webpack_require__ @ vendor.js:48(anonymous function) @ index.js?e6c1:13webpackJsonp../node_modules/babel-core/lib/traversal/index.js @ 0.js:1409__webpack_require__ @ vendor.js:48(anonymous function) @ plugin-pass.js?398e:19webpackJsonp../node_modules/babel-core/lib/transformation/plugin-pass.js @ 0.js:739__webpack_require__ @ vendor.js:48(anonymous function) @ plugin.js?74c9:16webpackJsonp../node_modules/babel-core/lib/transformation/plugin.js @ 0.js:749__webpack_require__ @ vendor.js:48(anonymous function) @ transformer.js?b6c7:12webpackJsonp../node_modules/babel-core/lib/transformation/transformer.js @ 0.js:759__webpack_require__ @ vendor.js:48(anonymous function) @ plugin-manager.js?5e76:20webpackJsonp../node_modules/babel-core/lib/transformation/file/plugin-manager.js @ 0.js:449__webpack_require__ @ vendor.js:48(anonymous function) @ pipeline.js?eb65:12webpackJsonp../node_modules/babel-core/lib/transformation/pipeline.js @ 0.js:729__webpack_require__ @ vendor.js:48(anonymous function) @ index.js?0346:12webpackJsonp../node_modules/babel-core/lib/transformation/index.js @ 0.js:589__webpack_require__ @ vendor.js:48(anonymous function) @ node.js?b46f:25webpackJsonp../node_modules/babel-core/lib/api/node.js @ 0.js:79__webpack_require__ @ vendor.js:48(anonymous function) @ index.js?99f1:1webpackJsonp../node_modules/babel-core/index.js @ 0.js:69__webpack_require__ @ vendor.js:48(anonymous function) @ index.js?0f54:15Promise.resolve (async)webpackJsonpCallback @ vendor.js:19(anonymous function) @ 3.js:1

@azu
Copy link
Member Author

azu commented Mar 27, 2016

Work transformers!
ast explorer 2016-03-27 13-36-32

@azu
Copy link
Member Author

azu commented Mar 27, 2016

acb5dfb

Add promise support tot transform method.

textlint#lintText return promise.

azu pushed a commit that referenced this pull request May 24, 2021
Update with changes from fkling/astexplorer
azu and others added 22 commits February 5, 2023 19:04
…-markdown-13.x-lockfile

fix(deps): update dependency @textlint/textlint-plugin-markdown to v13.3.2
…x-lockfile

fix(deps): update dependency @textlint/text-to-ast to v13.3.2
fix(deps): update textlint to v14.0.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant