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

nice to have: default option for justification #3

Closed
bcullman opened this issue Nov 7, 2018 · 4 comments
Closed

nice to have: default option for justification #3

bcullman opened this issue Nov 7, 2018 · 4 comments

Comments

@bcullman
Copy link

bcullman commented Nov 7, 2018

every markdown processor I have ever used has defaulted to align left, so I never use the justification syntax.

It would be nice, if we could choose default from the formatting options, and it would omit the :-

@fcrespo82
Copy link
Owner

Correct me if I'm wrong, but isn't it the option markdown-table-formatter.defaultTableJustification, as it says in the config "Defines the default justification for tables that have only a "-" on the formatting line"

You could set it to Right (e.g) and type like below

| Header 1 | Header 2 |
|-|-|
| Line 1 - Col 1 | Line 1 - Col 2 | 
| Line 2 - Col 1 | Line 2 - Col 2 | 

To have it output like this

Header 1 Header 2
Line 1 - Col 1 Line 1 - Col 2
Line 2 - Col 1 Line 2 - Col 2

But the following

| Header 1 | Header 2 |
|||
| Line 1 - Col 1 | Line 1 - Col 2 | 
| Line 2 - Col 1 | Line 2 - Col 2 | 

and this other one

| Header 1 | Header 2 |
| Line 1 - Col 1 | Line 1 - Col 2 | 
| Line 2 - Col 1 | Line 2 - Col 2 | 

are not valid extended markdown syntax as noted on MultiMarkdown Table Rules.

The “separator” line uses ---- or ==== to indicate the line between a header and cell. The length of the line doesn’t matter, but must have at least one character per cell.

[emphasis added]

I understand that having to type one less character "-" per column could be useful in some situations. Bu I need to see if it will have any side effects on the rest of the code.

I will keep this issue open while I study this case.

@bcullman
Copy link
Author

bcullman commented Nov 7, 2018

thanks for responding.

Please note the following from http://fletcher.github.io/MultiMarkdown-5/tables.html#tablerules

...If no colon is present, the default alignment of your system is selected (left in most cases).

I have always formatted md tables in this manner:

| Header 1 | Header 2 |
| -------- | -------- |
| Line 1 - Col 1 | Line 1 - Col 2 | 
| Line 2 - Col 1 | Line 2 - Col 2 |

resulting in

Header 1 Header 2
Line 1 - Col 1 Line 1 - Col 2
Line 2 - Col 1 Line 2 - Col 2

I think this is a cleaner look in md. The following is also valid:

| Header 1 | Header 2 |
|----------|----------|
| Line 1 - Col 1 | Line 1 - Col 2 | 
| Line 2 - Col 1 | Line 2 - Col 2 |

resulting in

Header 1 Header 2
Line 1 - Col 1 Line 1 - Col 2
Line 2 - Col 1 Line 2 - Col 2

@fcrespo82
Copy link
Owner

Oh, thank you, some how I missed that... I will take a look on how to include this!

@fcrespo82
Copy link
Owner

Included in v1.4.0. I added a flag to it called removeColonsIfSameAsDefault which is defaulted to false. If you have any other bug fix or feature requests please page me.

Thank you for using my extension and helping improve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants