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

MarkdownComponent drops table alignment #2008

Open
f-loris opened this issue Feb 7, 2023 · 0 comments
Open

MarkdownComponent drops table alignment #2008

f-loris opened this issue Feb 7, 2023 · 0 comments
Assignees
Labels

Comments

@f-loris
Copy link
Contributor

f-loris commented Feb 7, 2023

Describe the bug
When specifying the text alignment of columns in a markdown table it is not considered in the rendered html although showdown supports it. I could verify that showdown is providing the alignment in the html it correctly, but I suspect the DomSanitizer is dropping the inline css styles:

this._domSanitizer.sanitize(SecurityContext.HTML, markupStr) ?? '';
)

The sample from below is rendered from showdown as:

<table>
<thead>
<tr>
<th>Tables</th>
<th style="text-align:center;">Are</th>
<th style="text-align:right;">Cool</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>col 3 is</strong></td>
<td style="text-align:center;">right-aligned</td>
<td style="text-align:right;">$1600</td>
</tr>
<tr>
<td>col 2 is</td>
<td style="text-align:center;"><em>centered</em></td>
<td style="text-align:right;">$12</td>
</tr>
<tr>
<td>zebra stripes</td>
<td style="text-align:center;">are neat</td>
<td style="text-align:right;">$1</td>
</tr>
</tbody>

But in the rendered html of the MarkdownComponent the inline style of the th and td elements are gone.

To Reproduce
Steps to reproduce the behavior:

  1. Use the following markdown with a td-markdown component
| Tables        | Are           | Cool  |
| ------------- |:-------------:| -----:|
| **col 3 is**  | right-aligned | $1600 |
| col 2 is      | *centered*    |   $12 |
| zebra stripes | are neat      |    $1 |
  1. The table is shown but the column 2 is not centered and column 3 not right-aligened as the inline style is dropped by the MarkdownComponent.

Expected behavior
The style or at least some css class should be in the rendered html to be able to style the table appropriately.

Desktop:

  • OS: Windows
  • Browser chrome
  • Version 109.0.5414.75
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants