Giter Site home page Giter Site logo

parser: separate off parser about textlint HOT 3 CLOSED

textlint avatar textlint commented on May 24, 2024
parser: separate off parser

from textlint.

Comments (3)

azu avatar azu commented on May 24, 2024

I'v just implemeted markdown-to-ast parser.

It is dependent on jgm/CommonMark's parser.

from textlint.

azu avatar azu commented on May 24, 2024

Maybe we need re-define the meaning of raw.

[label](http://example.com "title")

Is raw of theLink node [label](http://example.com "title") or label?

Do We have to introduce like value property for node?

Ah, the following markdown is parsed to Link node > Str Node.
so, we don't need value propety.
A user should use raw of Str node for linting.

[label](http://example.com "title")
/*
{
    "start_line": 1,
    "start_column": 1,
    "end_line": 0,
    "children": [
        {
            "start_line": 1,
            "start_column": 1,
            "end_line": 0,
            "inline_content": [
                {
                    "destination": "http://example.com",
                    "title": "title",
                    "label": [
                        {
                            "c": "label",
                            "raw": "label",
                            "loc": {
                                "start": {
                                    "line": 1,
                                    "column": 0
                                },
                                "end": {
                                    "line": 1,
                                    "column": 5
                                }
                            },
                            "range": [
                                0,
                                5
                            ],
                            "type": "Str"
                        }
                    ],
                    "raw": "[label](http://example.com \"title\")",
                    "loc": {
                        "start": {
                            "line": 1,
                            "column": 0
                        },
                        "end": {
                            "line": 1,
                            "column": 35
                        }
                    },
                    "range": [
                        0,
                        35
                    ],
                    "type": "Link"
                }
            ],
            "children": [],
            "raw": "[label](http://example.com \"title\")",
            "loc": {
                "start": {
                    "line": 1,
                    "column": 0
                },
                "end": {
                    "line": 1,
                    "column": 35
                }
            },
            "range": [
                0,
                35
            ],
            "type": "Paragraph"
        }
    ],
    "raw": "[label](http://example.com \"title\")",
    "loc": {
        "start": {
            "line": 1,
            "column": 0
        },
        "end": {
            "line": 1,
            "column": 35
        }
    },
    "range": [
        0,
        35
    ],
    "type": "Document"
}
*/

from textlint.

azu avatar azu commented on May 24, 2024

landed https://github.com/azu/markdown-to-ast/ in 1.3.0!

from textlint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.