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

The ASTs of CRLF and LF files are different #147

Open
BlackGlory opened this issue Sep 1, 2021 · 1 comment
Open

The ASTs of CRLF and LF files are different #147

BlackGlory opened this issue Sep 1, 2021 · 1 comment

Comments

@BlackGlory
Copy link
Contributor

Is this expected behavior?

LF

const lf =
  '* Section1' + '\n'
+ '** Section2'
{
  "type": "document",
  "properties": {},
  "children": [
    {
      "type": "section",
      "level": 1,
      "properties": {},
      "children": [
        {
          "type": "headline",
          "actionable": false,
          "children": [
            {
              "type": "stars",
              "level": 1
            },
            {
              "type": "text",
              "value": "Section1"
            },
            {
              "type": "newline"
            }
          ],
          "level": 1
        },
        {
          "type": "section",
          "level": 2,
          "properties": {},
          "children": [
            {
              "type": "headline",
              "actionable": false,
              "children": [
                {
                  "type": "stars",
                  "level": 2
                },
                {
                  "type": "text",
                  "value": "Section2"
                }
              ],
              "level": 2
            }
          ]
        }
      ]
    }
  ]
}

CRLF

const crlf =
  '* Section1' + '\r\n'
+ '** Section2'
{
  "type": "document",
  "properties": {},
  "children": [
    {
      "type": "section",
      "level": 1,
      "properties": {},
      "children": [
        {
          "type": "headline",
          "actionable": false,
          "children": [
            {
              "type": "stars",
              "level": 1
            },
            {
              "type": "text",
              "value": "Section1"
            },
            {
              "type": "newline"
            }
          ],
          "level": 1
        },
        {
          "type": "newline"
        },
        {
          "type": "section",
          "level": 2,
          "properties": {},
          "children": [
            {
              "type": "headline",
              "actionable": false,
              "children": [
                {
                  "type": "stars",
                  "level": 2
                },
                {
                  "type": "text",
                  "value": "Section2"
                }
              ],
              "level": 2
            }
          ]
        }
      ]
    }
  ]
}
@BlackGlory BlackGlory changed the title [v3.1.0] The AST of CRLF and LF files are different The ASTs of CRLF and LF files are different Sep 25, 2021
@BlackGlory
Copy link
Contributor Author

I noticed that when files use CRLF, there are many incorrect results, so maybe all files should be converted to LF before parsing.

BlackGlory added a commit to BlackGlory/romast that referenced this issue Sep 25, 2021
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

No branches or pull requests

1 participant