Skip to content

[Bug] Can't parse if the following rows after the first rows have fewer cells than the table width #71

@PRESIDENT810

Description

@PRESIDENT810

This should be considered as a valid table (GitHub can also render it):

First Header Second header Third Header
Content Cell Content Cell

However this won't pass if I put it in integration.spec.ts:

    it('should deal with tables even the cells and the table width do not match', () => {
      const text = `
| First Header                             | Second header | Third Header |
|----------------------------------|----------|--------------|
| Content Cell                | Content Cell | 
      `;
      const actual = markdownToBlocks(text);
      const expected = [
        notion.table(
          [
            notion.tableRow([
              [notion.richText('First Header')],
              [notion.richText('Second header')],
              [notion.richText('Third Header')],
            ]),
            notion.tableRow([
              [notion.richText('Content Cell')],
              [notion.richText('Content Cell')],
              [notion.richText('')],
            ]),
          ],
          3
        ),
      ];

      expect(actual).toStrictEqual(expected);
    });

Tried to fix it by myself but I'm not very familiar with compilers so I'm afraid there's nothing much I can do

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions