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

Wellformed the table's rowspan and/or colspan attributes #156

Merged
merged 9 commits into from
Dec 1, 2024

Conversation

TheNorthMemory
Copy link
Contributor

@TheNorthMemory TheNorthMemory commented Aug 12, 2024

  • Setup GitHub workflows
  • Test against with markdown-it v14
  • optimize .npmignore only with necessary files
  • Wellformed the table's rowspan and/or colspan attributes

@TheNorthMemory
Copy link
Contributor Author

optimized some jsdocs and added some @typedef for better code tracing, see here

@TheNorthMemory TheNorthMemory changed the title Setup GitHub workflows ci Wellformed the table's rowspan and/or colspan attributes Aug 18, 2024
@TheNorthMemory
Copy link
Contributor Author

TheNorthMemory commented Aug 18, 2024

Wellformed the table's rowspan and/or colspan attributes, usage sample below:

| A                       | B   | C   | D                |
| ----------------------- | --- | --- | ---------------- |
| 1                       | 11  | 111 | 1111 {rowspan=3} |
| 2 {colspan=2 rowspan=2} | 22  | 222 | 2222             |
| 3                       | 33  | 333 | 3333             |

{border=1}

Output:

<table border="1">
  <thead>
    <tr>
      <th>A</th>
      <th>B</th>
      <th>C</th>
      <th>D</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>1</td>
      <td>11</td>
      <td>111</td>
      <td rowspan="3">1111</td>
    </tr>
    <tr>
      <td colspan="2" rowspan="2">2</td>
      <td>22</td>
    </tr>
    <tr>
      <td>3</td>
    </tr>
  </tbody>
</table>

current looking view as:

A B C D
1 11 111 1111
2 22
3

before rending as:

A B C D
1 11 111 1111
2 22 222 2222
3 33 333 3333

transform the cells B222,B2222,B33,B333,B3333 to hidden.

Copy link
Owner

@arve0 arve0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi 👋 Thanks for contributing :octocat:

I must admit that the code is challenging, I do not know much about rowspan or colspan, and it has been some years since this code was written. I cannot totally grasp my own code either. The type-hinting will help, thank you for those!

If you could please answer my questions, I'll do a review soonish.

Thanks again 🙌

test.js Show resolved Hide resolved
test.js Show resolved Hide resolved
test.js Show resolved Hide resolved
@TheNorthMemory
Copy link
Contributor Author

Hi 👋 Thanks for contributing :octocat:

I must admit that the code is challenging, I do not know much about rowspan or colspan, and it has been some years since this code was written. I cannot totally grasp my own code either. The type-hinting will help, thank you for those!

If you could please answer my questions, I'll do a review soonish.

Thanks again 🙌

The rowspan and colspan are all the html standard for rending table. And this pkg was already supporting parsing and transform those as well. It's great. Just need a little bit extra modification, the definition is:

picture from MDN

This improvement is solving the overflow cells, better for rendering. See the above notes.

@TheNorthMemory
Copy link
Contributor Author

A real rendered markdown table (490 rows x 3 columns) is launched here. It looks expectation and no more time spent(from the GitHub actions). Hopes it may helpful.

@TheNorthMemory
Copy link
Contributor Author

Hi there, feel free take a look this website https://wechatpay.im/openapi/, there were more than 790+ rendered pages with this feature. Hopes this pr may be merged. @arve0

@arve0 arve0 merged commit 1963653 into arve0:master Dec 1, 2024
@arve0
Copy link
Owner

arve0 commented Dec 1, 2024

Sorry for the delay. It's published with version 4.3.0.

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

Successfully merging this pull request may close these issues.

2 participants