shurcooL-legacy / atom-markdown-format

Formats your Markdown text on save.

Home Page:https://atom.io/packages/markdown-format

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

It messes up markdown tables

exalted opened this issue · comments

Markdown tables extension is currently not enabled/supported. I'll consider adding support for it.

Well… for the time being could you at least leave them untouched?

On Wednesday, May 14, 2014, Dmitri Shuralyov notifications@github.com
wrote:

Markdown tables extension is currently not enabled/supported. I'll
consider adding support for it.


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-43099571
.

Ali

To leave it untouched I would need to support Markdown tables. Otherwise, it's just poorly formatted plain text with a bunch of | and - characters, as far as the Markdown parser sees it.

I'll try to fix it tonight or tomorrow.

Okay, a follow up here.

I did play around with this to find out what it would take. It turned out to be more difficult than I expected, and it would require a significant amount of work to have correct (and formatted) rendering of tables using Markdown text.

At the same time, it's a good opportunity for markdownfmt to do something very helpful - since making these tables formatted by hand is quite a tedious task. The way postgres CLI client renders tables in text is a good inspiration.

Therefore, adding support for tables sounds like a good idea to me, so I'd be happy to accept a PR for it, or I may eventually get to do it myself, but it may be a couple weeks/months as I have higher priorities atm.

Until then, the current status is that tables are not yet supported, so if you need them, you can't use markdownfmt.

Thanks for the updates.

On Sunday, June 8, 2014, Dmitri Shuralyov notifications@github.com wrote:

Okay, a follow up here.

I did play around with this to find out what it would take. It turned out
to be more difficult than I expected, and it would require a significant
amount of work to have correct (and formatted) rendering of tables using
Markdown text.

At the same time, it's a good opportunity for markdownfmt to do something
helpful.

So, the current status is that tables are not yet supported, so if you
need them, you can't use markdownfmt.

However, adding support for tables sounds like a good idea to me, so I'd
be happy to accept a PR for it, or I may eventually get to do it myself,
but it may be a couple weeks/months as I have higher priorities atm.


Reply to this email directly or view it on GitHub
#1 (comment)
.

Ali

Good news, I've made a lot of progress on table rendering, and it's starting to look good. I just have to clean up the code and I'll commit.

It turned out a lot easier than I originally estimated. Much thanks to @gholt for helping me figure out how to get it done.

@exalted, would you be able to test it and let me know if it works for your needs?

Should I still wait for a later message of yours or?

Ali

On Tue, Jun 17, 2014 at 8:27 AM, Dmitri Shuralyov notifications@github.com
wrote:

Good news, I've made a lot of progress on table rendering, it's starting
to look good. I just have to clean up the code and I'll commit.

It turned out a lot easier than I originally estimated. Much thanks to
@gholt https://github.com/gholt.

@exalted https://github.com/exalted, would you be able to test it and
let me know if it works for your needs?


Reply to this email directly or view it on GitHub
#1 (comment)
.

You can try it right now. It's on the feature/tables branch, so if you can check it out and go build...

I just want to refactor it more, but the functionality should remain the same.

I will check it out as soon as I can. Thanks.

Ali

On Tue, Jun 17, 2014 at 11:23 AM, Dmitri Shuralyov <notifications@github.com

wrote:

You can try it right now. It's on the feature/tables branch
https://github.com/shurcooL/markdownfmt/tree/feature/tables, so if you
can check it out and go build...


Reply to this email directly or view it on GitHub
#1 (comment)
.

Have you had a chance to try it out yet?

I think I'm ready to merge it to master unless you've found issues.

Hi Dmitri, I will look to it today and let you know. Sorry for the delay.

On Sunday, June 22, 2014, Dmitri Shuralyov notifications@github.com wrote:

Have you had a chance to try it out yet?

I think I'm ready to merge it to master unless you've found issues.


Reply to this email directly or view it on GitHub
#1 (comment)
.

Ali

@shurcooL could you give quick instructions on how to build & try please?

Assuming you have Go installed (or via homebrew) and $GOPATH set to some folder
(e.g., export GOPATH=/Users/Me/Work/mygopath),

go get -d -u github.com/shurcooL/markdownfmt
cd $GOPATH/src/github.com/shurcooL/markdownfmt
git checkout feature/tables
go install github.com/shurcooL/markdownfmt

That will install markdownfmt binary in $GOPATH/bin folder. Set the path to binary in the Atom package to point there.

Ok, I am on it now. I will keep you posted.

Ok, I have three things I would like to say:

First of all: this is really cool and thank you.

Second is a small issue:

| A | B |
|---|---|
| Foo–Bar | Baz |

… will be formatted as:

| A        | B   |
|----------|-----|
| Foo–Bar | Baz |

… rather than:

| A        | B   |
|----------|-----|
| Foo–Bar  | Baz |

… I believe there's a small bug with dashes. (Please note that -, and are different very different things.)

And as for the last point: I kinda am okay how you wanted to change header separator line from | --- | to |---|, but do you think could you keep user's preferred styling instead of overriding it? I personally do prefer leaving a single space before and after ---. (This is also true for alignment statements, such as | :--- |, | ---: |, or | :---: |, etc.)

Can you do me a favor, create a separate issue for each of the smaller issues you've found in the shurcooL/markdownfmt repo. That way I can address them separately.

Sure thing!

I've moved this issue to shurcooL/markdownfmt#9, closing here.