markdown: Add support for HTML table column align attribute (#41163)
This PR allows you to define `align="right"` for example to change the default alignment on **HTML** table columns. This PR also refactors where we store the alignments in order to make it so you can define it column based instead of only row based. See that the `Revenue` column is left aligned instead of the default `centered`. **Result** <img width="1161" height="177" alt="Screenshot 2025-10-25 at 11 01 38" src="https://github.com/user-attachments/assets/94bda4f0-00c1-4726-a3bd-99b3f2573ef5" /> **Code example** ```HTML <table> <tr> <th rowspan="2">Region</th> <th colspan="2" align="left">Revenue</th> <th rowspan="2">Growth</th> </tr> <tr> <th>Q2 2024</th> <th>Q3 2024</th> </tr> <tr> <td>North America</td> <td>$2.8M</td> <td>$2.4B</td> <td>+85,614%</td> </tr> <tr> <td>Europe</td> <td>$1.2M</td> <td>$1.9B</td> <td>+158,233%</td> </tr> <tr> <td>Asia-Pacific</td> <td>$0.5M</td> <td>$1.4B</td> <td>+279,900%</td> </tr> </table> ``` Release Notes: - markdown preview: Add support for `HTML` table column `align` attribute
This commit is contained in:
@@ -106,7 +106,6 @@ pub struct ParsedMarkdownTable {
|
||||
pub source_range: Range<usize>,
|
||||
pub header: Vec<ParsedMarkdownTableRow>,
|
||||
pub body: Vec<ParsedMarkdownTableRow>,
|
||||
pub column_alignments: Vec<ParsedMarkdownTableAlignment>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Default)]
|
||||
@@ -126,6 +125,7 @@ pub struct ParsedMarkdownTableColumn {
|
||||
pub row_span: usize,
|
||||
pub is_header: bool,
|
||||
pub children: MarkdownParagraph,
|
||||
pub alignment: ParsedMarkdownTableAlignment,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
||||
Reference in New Issue
Block a user