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 Tabular Cell Merging with formatOnSave HTML Table Rendering #1469

Open
cloudyparts opened this issue Oct 8, 2024 · 0 comments
Open

Comments

@cloudyparts
Copy link

Feature Request: Support Tabular Cell Merging with formatOnSave HTML Table Rendering

Proposal

Markdown tables can be rendered with merged cells using HTML comments for the original table structure. On save, the extension would convert the table to HTML, where cells with the same values are automatically merged following specific rules.

Example Markdown

Source table is hidden in and the HTML Table is rendered below the source table.

    <!---
    | 1   | 1   | 2   | 3   | 4   |
    | --- | --- | --- | --- | --- |
    | A   | B   | D   | D   | F   |
    | A   | B   | D   | D   | G   |
    | A   | C   | E   | H   | H   |
    --->

    <table border="1">
      <tr>
        <th colspan="2">1</th>
        <th>2</th>
        <th>3</th>
        <th>4</th>
      </tr>
      <tr>
        <td rowspan="3">A</td>
        <td rowspan="2">B</td>
        <td colspan="2" rowspan="2">D</td>
        <td>F</td>
      </tr>
      <tr>
        <td>G</td>
      </tr>
      <tr>
        <td>C</td>
        <td>E</td>
        <td colspan="2">H</td>
      </tr>
    </table>

Rules for Merging Cells:

  1. Headers only merge columns and not rows.
  2. Columns have precedence over rows when merging cells with the same content.
  3. Merge first by columns, then by rows where applicable.

Benefits

  • Avoids the need to manually convert tables to HTML.
  • Avoids the need to write HTML for semi-complex table views.
  • The tables stay easy to edit in Markdown and are rendered in HTML automatically on save, making large and complex tables easier to handle.

References

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