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

Bug: Tables without final newline #123

Closed
quantizor opened this issue Jan 4, 2016 · 6 comments
Closed

Bug: Tables without final newline #123

quantizor opened this issue Jan 4, 2016 · 6 comments
Labels
remark 🐛 type/bug This is a problem

Comments

@quantizor
Copy link

remark.parse("|foo|bar|\n|-|-|\n|1|2|") results in mdast with the following shape:

{
    type: 'root',
    children: [
        {
            type: 'table',
            align: [
                null,
                null
            ],
            children: [
                {
                    type: 'tableHeader',
                    children: [
                        Object
                    ]
                }
            ]
        },
        {
            type: 'paragraph',
            children: [
                {
                    type: 'text',
                    value: '|1|2|',
                    position: [
                        Object
                    ]
                }
            ]
        }
    ]
}

(I took out the position objects to make the above more concise.)

For some reason the row is being pulled out as a paragraph now. I see there are some new table options added to the parse configuration object and toyed with them, but neither seems to fix the issue.

Parsing the above string definitely worked in the 2.x tree.

quantizor pushed a commit to quantizor/markdown-to-jsx that referenced this issue Jan 4, 2016
Everything is working except for tables, issue open @
remarkjs/remark#123
@wooorm
Copy link
Member

wooorm commented Jan 5, 2016

I think 3.1.3 closed this. I got these results with the aforementioned example:

{
  "type": "root",
  "children": [
    {
      "type": "table",
      "align": [
        null,
        null
      ],
      "children": [
        {
          "type": "tableHeader",
          "children": [
            {
              "type": "tableCell",
              "children": [
                {
                  "type": "text",
                  "value": "foo"
                }
              ]
            },
            {
              "type": "tableCell",
              "children": [
                {
                  "type": "text",
                  "value": "bar"
                }
              ]
            }
          ]
        },
        {
          "type": "tableRow",
          "children": [
            {
              "type": "tableCell",
              "children": [
                {
                  "type": "text",
                  "value": "1"
                }
              ]
            },
            {
              "type": "tableCell",
              "children": [
                {
                  "type": "text",
                  "value": "2"
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

@quantizor
Copy link
Author

3.1.3 was installed when I tried it :/

On Jan 5, 2016, at 3:51 AM, Titus Wormer notifications@github.com wrote:

I think 3.1.3 closed this. I got these results with the aforementioned example:

{
"type": "root",
"children": [
{
"type": "table",
"align": [
null,
null
],
"children": [
{
"type": "tableHeader",
"children": [
{
"type": "tableCell",
"children": [
{
"type": "text",
"value": "foo"
}
]
},
{
"type": "tableCell",
"children": [
{
"type": "text",
"value": "bar"
}
]
}
]
},
{
"type": "tableRow",
"children": [
{
"type": "tableCell",
"children": [
{
"type": "text",
"value": "1"
}
]
},
{
"type": "tableCell",
"children": [
{
"type": "text",
"value": "2"
}
]
}
]
}
]
}
]
}

Reply to this email directly or view it on GitHub.

@wooorm
Copy link
Member

wooorm commented Jan 5, 2016

Then I’m guessing the problem is the missing EOF EOL, I’ll check.

@quantizor
Copy link
Author

@wooorm You're right, it works if I add another newline to the end of the string. Is there a way to overcome the need for it?

quantizor pushed a commit to quantizor/markdown-to-jsx that referenced this issue Jan 5, 2016
@wooorm wooorm changed the title Trouble with table parsing in 3.x Bug: Tables without final newline Jan 5, 2016
@wooorm wooorm closed this as completed in fd2f281 Jan 5, 2016
@quantizor
Copy link
Author

🎉 thanks!

@wooorm
Copy link
Member

wooorm commented Jan 5, 2016

No problem, thanks for reporting! 😄

@wooorm wooorm added 🐛 type/bug This is a problem remark labels Jan 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
remark 🐛 type/bug This is a problem
Development

No branches or pull requests

2 participants