You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| Some | text | and number
| ---- | -------- | ----
| some | long text | 1
| awesome | another text | 1
Some
text
and number
some
long text
1
awesome
another text
1
Now, I need, that second column will be larger and last - smaller. Obviously, that we look at line that goes after headers: if shorter stroke - shorter column.
Solution:
So, count the dashes (with space and column separator) and use percentage width's by the ratio!
For example table { width:100%;} (Total: 24chars), <th style="width:29.17%"> (first column - 7chars), <th style="width:45.83%"> (second column - 11chars), and leve last without width's. http://jsfiddle.net/iegik/3D2Fb/
Reacted by tamdc, Brian Feister, Romulo Pulcinelli Benedetti, kukuruza, angus.aqlu, Edmund, Nobo Nadie, Aleksey Fomkin, Vitalie Spinu, Crea7dosSantos and 11 more
looked the same as they are in source - the same column width (proportionally).
And in HTML solution is to pass inline style attribute with "width" values in "%" to table headers:
<table>
<thead>
<tr>
<th style="width:10%">
...
But leave last column without inline styles, so it will not break the layout:
Most of the features you are requesting don't fit in well with the greater de facto markdown spec. I don't think they should be included in marked. This kind of stuff should really be done in a custom markdown extension, but I wouldn't call it markdown.
The main goal for Markdown is to keep all simple.
So, don`t think, that some numbers will make text beautiful!
KISS, I am trying to keep MD style using only "|" and "---" characters, that looks like simple lines. Inline style "width:**%" affects only relatively to the table and do not make BIG changes it visually. (aka layout staff)
^2 Some ^3 text ^5 and number
— will not look like tables head, also "^" - usually means Exponentiation
| Some | text | and number |
— looks much better!
I`ll not to try change the holy Markdown, just want do represent it better!
This feature does not make sense, because it depends too much on viewport size of the browser, or exactly on the width of the whole table. And these things are not known to the parser, nor renderer. This should be achieved with client-side javascript. What else - if anyone uses css table-layout: fixed, it breaks immediately.
I'm with @kuba-kubula on this one, I think - also @ghost before deleting the first line.
Want to keep Marked light and out of the "template engine" business; adding attributes to the markup feel more like template engine (or CSS) business. (I don't know of a Markdown spec that allows for sizing of table columns.)
From a UX perspective mobile becomes an interesting problem space - especially if we're using percentages.
@jondlm also raises a good point regarding making an extension or override to handle the use case as it's not really markdown in the strictest sense. (Column spanning might be something worth pursuing - don't remember if the Multi-Markdown or CommonMark specs cover that.)
Going to leave this and PR open for now, but not feeling this as being a problem space to pursue solving with Marked (see #956).
For anyone facing this issue, just use  -s (non breaking space) to extend the header of the column you want to make wider. You can copy it from here: " ". Make sure to add equal amount before and after the header text so it will stay centered.
Wide Column
Short Column
1
Uh, sama lamaa duma lamaa you assuming I'm a human What I gotta do to get it through to you I'm superhuman Innovative and I'm made of rubber So that anything you say is ricocheting off of me and it'll glue to you I'm devastating, more than ever demonstrating
2
How to give a motherfuckin' audience a feeling like it's levitating Never fading, and I know that the haters are forever waiting For the day that they can say I fell off, they'd be celebrating 'Cause I know the way to get 'em motivated I make elevating music, you make elevator music
Reacted by alp tuğan, aeldar, Yu Huang and Toni Cobo
| <divstyle="width:150px" /> Header Text | Some other header longer |
to the header column. I didn't put the div around the text, because for my app the SSR to Client hydration would rehydrate the inner text twice. This did the trick though.
Activity
aplib commentedon Oct 15, 2013
You can add a style with the selector element by number, for example:
iegik commentedon Oct 18, 2013
Not a solution. I have more then one table on the page.
aplib commentedon Oct 18, 2013
table:nth-of-type(1) {1 - number of the table
Indexing is from 1
iegik commentedon Nov 12, 2013
I just wanted to
the Table 1:
and Table 2:
looked the same as they are in source - the same column width (proportionally).
And in HTML solution is to pass inline style attribute with "width" values in "%" to table headers:
But leave last column without inline styles, so it will not break the layout:
iegik commentedon Nov 13, 2013
Updated example: http://jsfiddle.net/iegik/3D2Fb/
jondlm commentedon Nov 29, 2013
Most of the features you are requesting don't fit in well with the greater de facto markdown spec. I don't think they should be included in marked. This kind of stuff should really be done in a custom markdown extension, but I wouldn't call it markdown.
iegik commentedon Dec 12, 2013
The main goal for Markdown is to keep all simple.
So, don`t think, that some numbers will make text beautiful!
KISS, I am trying to keep MD style using only "|" and "---" characters, that looks like simple lines. Inline style
"width:**%"affects only relatively to the table and do not make BIG changes it visually. (aka layout staff)— will not look like tables head, also "^" - usually means Exponentiation
— looks much better!
I`ll not to try change the holy Markdown, just want do represent it better!
kuba-kubula commentedon Dec 13, 2013
This feature does not make sense, because it depends too much on viewport size of the browser, or exactly on the width of the whole table. And these things are not known to the parser, nor renderer. This should be achieved with client-side javascript. What else - if anyone uses css
table-layout: fixed, it breaks immediately.crifan commentedon Nov 21, 2017
+1 expect can designated table column width, by dash count or something else
joshbruce commentedon Jan 26, 2018
I'm with @kuba-kubula on this one, I think - also @ghost before deleting the first line.
Going to leave this and PR open for now, but not feeling this as being a problem space to pursue solving with Marked (see #956).
UziTech commentedon Dec 5, 2018
This is not part of any spec so it will have to be an extension
maor-rozenfeld commentedon Apr 20, 2020
For anyone facing this issue, just use  -s (non breaking space) to extend the header of the column you want to make wider. You can copy it from here: " ". Make sure to add equal amount before and after the header text so it will stay centered.
iegik commentedon Apr 21, 2020
What if i want make short column, where header is wider?
maor-rozenfeld commentedon Apr 21, 2020
You can add nbsps to the other columns, that's all I've got.
jdgamble555 commentedon Feb 6, 2024
For me I was able to get around this by adding:
to the header column. I didn't put the div around the text, because for my app the SSR to Client hydration would rehydrate the inner text twice. This did the trick though.
J