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

Support tables with "rowspan" or "colpsan" attributes #62

Closed
4 tasks done
andrey-skl opened this issue May 17, 2021 · 4 comments
Closed
4 tasks done

Support tables with "rowspan" or "colpsan" attributes #62

andrey-skl opened this issue May 17, 2021 · 4 comments
Labels
🗄 area/interface This affects the public interface 💪 phase/solved Post is done 🧒 semver/minor This is backwards-compatible change 🦋 type/enhancement This is great to have

Comments

@andrey-skl
Copy link

andrey-skl commented May 17, 2021

Initial checklist

  • I read the support docs
  • I read the contributing guide
  • I agree to follow the code of conduct
  • I searched issues and couldn’t find anything (or linked relevant results below)

Subject

  • Have a table with rowspan/colspan and missing cell in next row:
<table>
<tbody>
    <tr>
        <th>Table</th>
        <th>With rowspan</th>
    </tr>
    <tr>
        <td rowspan="2">Rowspan</td>
        <td>test</td>
    </tr>
    <tr>
        <!-- There is no cell because it is occupied by rowspan -->
        <td>test</td>
    </tr>
</tbody>
</table>

Which, when rendered, should look somehow like that:
image

Problem

When converting to MDAST, the missing cells are added automatically, so the following tree is constructed (notice empty tableCell added to third row's end):
image

So, if serialize to Markdown, it would look like:

| Table | With rowspan |
| - | - |
| Rowspan | test |
| test | |

Notice the "test" in third column is shifted to the left

Solution

The converter may take "rowspan", "colspan" attributes into account and put empty cells into the corresponding positions, to preserve table structure in general

Alternatives

I don't see any alternative implementation. Related to #54.

@github-actions github-actions bot added the 👋 phase/new Post is being triaged automatically label May 17, 2021
@github-actions

This comment has been minimized.

@github-actions github-actions bot added 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels May 17, 2021
@wooorm wooorm added the 🙆 yes/confirmed This is confirmed and ready to be worked on label May 17, 2021
@wooorm
Copy link
Member

wooorm commented May 17, 2021

I think that would be a welcome addition! Something in table.js probably, as it has the needed insight on rows and columns!

@wooorm wooorm added the 👍 phase/yes Post is accepted and can be worked on label May 17, 2021
@github-actions github-actions bot removed the 🤞 phase/open Post is being triaged manually label May 17, 2021
@github-actions

This comment has been minimized.

@wooorm wooorm added 🗄 area/interface This affects the public interface 🦋 type/enhancement This is great to have 🧒 semver/minor This is backwards-compatible change help wanted 🙏 This could use your insight or help labels May 17, 2021
@wooorm wooorm closed this as completed in 9664b65 Aug 26, 2021
@wooorm wooorm added the 💪 phase/solved Post is done label Aug 26, 2021
@github-actions github-actions bot removed 👍 phase/yes Post is accepted and can be worked on 🙆 yes/confirmed This is confirmed and ready to be worked on help wanted 🙏 This could use your insight or help labels Aug 26, 2021
@wooorm
Copy link
Member

wooorm commented Aug 26, 2021

Released!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🗄 area/interface This affects the public interface 💪 phase/solved Post is done 🧒 semver/minor This is backwards-compatible change 🦋 type/enhancement This is great to have
Development

No branches or pull requests

2 participants