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

Table alignment in Markdown cells is ignored. #3180

Closed
scubahub opened this issue Nov 2, 2017 · 4 comments
Closed

Table alignment in Markdown cells is ignored. #3180

scubahub opened this issue Nov 2, 2017 · 4 comments

Comments

@scubahub
Copy link

@scubahub scubahub commented Nov 2, 2017

Table column alignment directives (colons) are ignored. For example, the following renders with every column right aligned.

left | center | right
:--- | :---| | ---:
a | b | c
1 | 2 | 3
@blink1073
Copy link
Member

@blink1073 blink1073 commented Nov 2, 2017

I see the same behavior in the classic notebook as well. The DOM nodes created by marked don't have any style or class applied. We are setting the gfm and table properties, so I'm not sure why that is.

Loading

@blink1073 blink1073 added this to the 1.0 milestone Nov 2, 2017
@AbdealiJK
Copy link
Member

@AbdealiJK AbdealiJK commented Nov 5, 2017

This seems to be a reproducible bug with marked:

var marked = require('marked');
marked.setOptions({
    renderer: new marked.Renderer(),
    gfm: true,
    tables: true
});

console.log(marked('I am using __markdown__.'));
console.log(marked('left | center | right\n'
+ ':--- | :---| | ---:\n'
+ 'a | b | c\n'
+ '1 | 2 | 3'))

EDIT:
Nevermind ... there was a typo in the table code in the description.
This works perfectly fine in marked:

left | center | right
:--- | :---: | ---:
a | b | c
1 | 2 | 3

The current behaviour is happening because of the sanitizer at renderers.ts#L56 which is removing inline styles and converts <th style="text-align:left">Header 1</th> to <th>Header 1</th>

Loading

@blink1073
Copy link
Member

@blink1073 blink1073 commented Nov 6, 2017

Great catch @AbdealiJK! This is blocked by #1812.

Loading

@jasongrout jasongrout removed this from the 1.0 milestone Sep 5, 2018
@ian-r-rose ian-r-rose added this to the 1.0 milestone Sep 6, 2018
@jasongrout
Copy link
Contributor

@jasongrout jasongrout commented Sep 12, 2018

This may work already in master now that #1812 is fixed.

Loading

@blink1073 blink1073 mentioned this issue Sep 28, 2018
31 tasks
@lock lock bot locked as resolved and limited conversation to collaborators Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

5 participants