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 width adjustment by dash character #816

Closed
wants to merge 3 commits into from

Conversation

swcho
Copy link

@swcho swcho commented Oct 12, 2016

Hi, I have little idea to determine table column width by dash characters.

For example, if you have next table.

Header 1|Header 2|Header 3|Header 4
:---    |:--:    |--:     |---
Cell 1  |Cell 2  |Cell 3  |Cell 4
*Cell 5*|Cell 6  |Cell 7  |Cell 8

Each column will have 30%, 20%, 20%, 30% width.
The percentage value of width is determined by (row dash count / total dash count) * 100.
So, if you want to have the same column width, you can adjust dash as below

Header 1|Header 2|Header 3|Header 4
:-    |:-:    |-:     |-
Cell 1  |Cell 2  |Cell 3  |Cell 4
*Cell 5*|Cell 6  |Cell 7  |Cell 8

Last but not least, to use this feature you can turn on flag "tableWidth" through options.

I hope this is useful.
Thanks.

swcho and others added 3 commits October 12, 2016 21:26
@joshbruce joshbruce added this to Queue in PRs Dec 1, 2017
@joshbruce
Copy link
Member

See #980

@iegik
Copy link

iegik commented Jan 26, 2018

Duplicate of #266

@iegik
Copy link

iegik commented Jan 26, 2018

I like, that You also see the benefits from this feature.
As already discussed in #266, and my expectations are:

  • It should not depends too much on viewport size
  • It should not contain additional formatting
  • It should narrow sell with big content if column marked as shorter
  • It should leave column longer, even if content of cell is short when column marked as longer

The counting dashes, for me is the best solution for calculating relative sizes of columns.
As I see, the Markdown main goal is represent formatted text in text form. So, total dash + spaces should represent approximate table width.
width: 100% - is strongly depends of viewport size, we can avoid using of this, by reverse solution: limiting cell sizes by min-width.
Also notice, that some cell should not be limited - they can be stretched automatically.
Any ideas?

@joshbruce
Copy link
Member

Closing as not spec-based (don't believe GFM tables has this functionality). Marking as NFU for possible reconsideration during 2.x development.

@joshbruce joshbruce closed this Apr 5, 2018
@styfle styfle moved this from Queue to Close in PRs Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
PRs
Close
Development

Successfully merging this pull request may close these issues.

None yet

3 participants