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

Badges and separate lines in the same paragraph #38

Open
anacrolix opened this issue Oct 9, 2017 · 6 comments
Open

Badges and separate lines in the same paragraph #38

anacrolix opened this issue Oct 9, 2017 · 6 comments
Labels

Comments

@anacrolix
Copy link

I ran this on some project READMEs, and one interesting case is what it does to the badges. When writing these out by hand, it's easy to put them on separate lines, without a blank line between them, which renders them in the same paragraph, and makes them easy to maintain. But the tool merges them to the same line, which doesn't seem desirable.

@dmitshur
Copy link
Member

I understand what you're referring to.

I can suggest two alternatives that would work:

  1. Have the badges on the same line, space separated. It's consistent with the rendering as HTML. It's what I do in most READMEs, including the one in this repository. Downside might be that they're harder to maintain, as you said, but I change badges infrequently.

  2. Put 2 spaces at the end of each line to preserve the trailing newline. Like this:

    [![Build Status](https://travis-ci.org/...)](https://travis-ci.org/...)<space><space>
    [![GoDoc](https://godoc.org/...)](https://godoc.org/...)<space><space>

    Where <space> is just a space ( ).

@anacrolix
Copy link
Author

Option 2 results in the badges on different lines. Is there a strong need to merge text in the same paragraph on different markdown lines?

@dmitshur
Copy link
Member

You're right, option 2 will give different behavior.

It had to be done in some way. I considered it for some time:

//extensions |= blackfriday.EXTENSION_HARD_LINE_BREAK

But ended up choosing to go without EXTENSION_HARD_LINE_BREAK option.

It was mostly motivated by the desire
to have manually wrapped text become
automatically wrapped text, so that it
would be readable even as you resize
the width of your editor. E.g., this
paragraph would become a normal
paragraph instead of a narrow one.

Option 1 still works.

@anacrolix
Copy link
Author

anacrolix commented Oct 11, 2017

Do you want to reconsider that extension or expose a command-line flag?

@dmitshur
Copy link
Member

dmitshur commented Oct 12, 2017

I can reconsider the extension, but I won't be adding command-ling flags. I want to maintain the zero-configuration property of the formatting tool, just like gofmt.

It will take me a while to think about whether that extension is a good idea. If you'd like to have it sooner, I suggest you make a fork and apply the change there for your own needs. That would be helpful, because you could also provide feedback on how well it works in your experience.

@anacrolix
Copy link
Author

Thanks

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

No branches or pull requests

2 participants