All <tables> go through MarkdownTable

What does this MR do and why?

Closes Pass all `<table>`s through `MarkdownTable` to ... (#630465).

All <tables> go through MarkdownTable.

render_markdown_tables.js now puts all tables through MarkdownTable except for those that legitimately don't want any treatment at all (already-applied, detached, JSON (to be fixed!), nested). We work out if the table is to be sorted here, but even non-sortable tables still get put into MarkdownTable.

We also fix how we determine the sortable header row: it can be in the <thead>, or it can be a single leading row of <th>s in the <tbody>, thus catching RTE-emitted HTML-syntax tables.

Screenshots or screen recordings

What Before After
1. Pipe table syntax in the PTE case-1-pipe-table-before.png case-1-pipe-table-after.png
No change.
2. <table><thead><tr><th>...</th>...</tr></thead><tbody><tr>...</tr>... in the PTE (table has <thead> with one <tr> containing <th>s, and <tbody>) case-2-html-thead-tbody-before.png case-2-html-thead-tbody-after.png
No change.
3. <table><tr>...</tr><tr>...</tr>... (table has no <thead>, no <tbody>, no <th>s at all) in the PTE case-3-html-headerless-before.png case-3-html-headerless-after.png
Table gains wrapper (note top outline), but not sortable, as there is neither <thead> nor <th> in the source.
4. <table><tr><th>...</th>...</tr><tr>...</tr>... in the PTE (table has first <tr> containing only <th>s) case-4-html-leading-th-row-before.png case-4-html-leading-th-row-after.png
Table is now sortable!
5. Regular table created in the RTE case-5-rte-table-before.png case-5-rte-table-after.png
No change.
6. Table created in the RTE with block-level elements (when you receive the "HTML warning" while editing) case-6-rte-block-table-before.png case-6-rte-block-table-after.png
Table is now sortable!
7. AsciiDoc wiki page with striped header table, and striped headerless table case-7-asciidoc-wiki-before.png case-7-asciidoc-wiki-after.png
Striped headerless table gets wrapper.
8. <table><thead><tr>...</tr><tr>...</tr></thead><tbody>... (table has two <tr>s in <thead>) case-8-two-header-rows-before.png case-8-two-header-rows-after.png
Table doesn't lose its second header row (!); no longer sortable.
9. Case 4 in a Rapid Diffs MR diff comment case-9-rapid-diffs-comment-before.png case-9-rapid-diffs-comment-after.png
Table is now sortable!

How to set up and validate locally

TODO

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Asherah Connor

Merge request reports

Loading
Loading