-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Feature request: Table column width #266
Comments
You can add a style with the selector element by number, for example:
|
Not a solution. I have more then one table on the page. |
|
I just wanted to the Table 1:
and Table 2:
looked the same as they are in source - the same column width (proportionally).
But leave last column without inline styles, so it will not break the layout:
|
Updated example: http://jsfiddle.net/iegik/3D2Fb/ |
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. |
Tables are really useful sometimes, I also want a Markdown variant to deal with that. :) BTW, adding a number after the vertical bar may be better.
And you may like DokuWiki markdown syntax about tables: https://www.dokuwiki.org/wiki:syntax#tables It is more elegant, though no way to specify column width. (If you have made a markdown extension for this, I will be glad to head that.) |
The main goal for Markdown is to keep all simple. KISS, I am trying to keep MD style using only "|" and "---" characters, that looks like simple lines. Inline style
— 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! |
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 |
+1 expect can designated table column width, by dash count or something else |
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). |
This is not part of any spec so it will have to be an extension |
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.
|
What if i want make short column, where header is wider?
|
You can add nbsps to the other columns, that's all I've got.
|
For me I was able to get around this by adding: | <div style="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. J |
So, we have columns, for example:
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/The text was updated successfully, but these errors were encountered: