The text editor is losing line breaks

Issue #7396 open
Vladislav Victorovich
created an issue

No description provided.

Official response

  • Alastair Wilkes staff

    @Ania Rudzińska & @Hristijan Gjorgjievski

    Hmm - you shouldn't need two spaces at the end of the line inside code blocks (invoked using triple backtick ``` or with a four-space-indent). You should only need it within paragraphs. How are you invoking a code block?

    For others:

    For now, you’ll need to add two spaces at the end of each line per the Markdown spec. Removing this requirement for comments and issue/PR descriptions is in our backlog. At this time, we don't plan to remove this requirement for rendered Markdown files (READMEs/Wikis) because that could negatively affect the rendering of existing content.

Comments (77)

  1. Dmitrii Semikin

    This does not work for me for some reason. I tried <br>, <br/>, <br /> and <BR>, but this does not break the line. It just literally insert the tag in text. (I'm trying to break the line in wiki).

    Can you, please, explain, why it behaves this way and how can I break the line?

    Thanks.

  2. sean.d.matthews

    Yeah, this is not a good way to do this. Think about how people are using comments-- pasting debug output. Sometimes that debug output can be many lines. I don't want to go through and put something at the end of every line.

  3. Euan Reid

    Quite possibly the most stupid design decision ever, given we've had a long time of people quite happily accepting the idea of a line break meaning there will be a new line. Reflavouring the markdown so it matches users' expectations and functions intuitively is the correct fix, not using the horribly hacky "two spaces for a clear line break" the creator chose. It'd be like saying we need to pronounce gif as jif.

  4. jantonan

    perhaps you guys can add an option in the user settings OR in the Wysiwyg edit with a cookie so it remembers my settings?:

    17-04-2015 09-41-44.png

    or use the ⏎ character in it... it's just fast example

    It really frustrates me as designer, because i write the text in your edit but the result is totally different, it's called a Wysiwyg for a reason right? (what you see is what you get)

  5. Chris Graham

    This is stupid. Nobody wants to reformat copy&pasted text, and regardless it needs to be intuitive. If Markdown has a default behaviour we don't like, Bitbucket should make it configurable in Markdown and change the default configuration. If Markdown doesn't already have some sense of text context, it is worth giving it one.

  6. Kevin Preller

    "It's not a bug, it's a feature."

    "@Preston Waters: Agree again, this is ridiculous, and it has annoyed me to the point that I am looking for an alternative issue tracking system."

    We will move to another system for future projects because of this too. I can't believe this issue is marked as "resolved".

  7. Kevin Preller

    @Jeffrey Kranenburg I think it simply is counter-intuitive. 90% of the developers I work with know markdown from GitHub, where it works like you expect it. Every person we try to work with is having problems when using BitBucket issues because of the line breaks. You have to explain to them they need to use double spaces on each line break.

    Especially when trying to copy/paste text into the editor; it's different if you get an unformatted result vs a completely different result because all of your line break get lost.

    Yes, this is "how the syntax works". But for me this is a major flaw in the markdown syntax itself. And I'm not alone with that. This was discussed on StackOverflow a time ago: http://meta.stackexchange.com/questions/26011/should-the-markdown-renderer-treat-a-single-line-break-as-br

    "A markup should not break elementary common sense rules in order to provide other elevated functionality."

    This is just bad user experience and if this "is how markdown works", maybe markdown isn't that great for an issue tracker. Which might be the reason companies like GitHub customized it to match the requirements better - and Bitbucket should do the same or embed a better suited alternative to markdown.

  8. Patrick Breitenbach

    Why would you ever want a newline not to be a newline? That's an HTML thing, not a Markdown thing.

    Edit: I guess it has to do with supporting email text which apparently breaks lines that aren't actually broken. So markdown default puts them back together.

  9. Anonymous

    Meanwhile... Double trailing spaces seem to do nothing at all. What do you do if you want just one simple line in the between a code box and your text? I guess use something else.

  10. Ilya Savinkov

    Life hack: if you need to see all "eaten" newlines in somebody's message:
    1. Open Developer Console (F12 or Right Click - Inspect)
    2. Add CSS rule white-space: pre-line; to the block with broken text.

  11. Nathan Salmon

    I gave it a go, but I really I can't understand this design decision. If a user has to search Google, find a bug logged against the product, and read the resolution in order to figure out how to use a line feed, doesn't the feel like an inefficient design that would lead to a less than ideal user experience? This sort of situation isn't isolated to this specific example.

    A bit of unsolicited advice: From a user experience initiative, it might be a good idea to take a look at the number of view hits on "resolved" issues, and take another look at improving the resolution for those that are high on the list.

  12. Joseph Keller

    Is this forreal? The ONLY way I found out about this was to Google it and I finally stumbled onto after wasting my time trying to find it.

    Were you guys honestly expecting anyone to figure this out by accident? Get a clue.

  13. David Caldarelli

    Wow, that is a surprising result, and runs contrary to the bitbucket on-line help that I found before I found this page.

    @Erik van Zijst et al, please get someone to fix the "Paragraph" section of this page to teach your users the two-space requirement: https://confluence.atlassian.com/bitbucketserver/markdown-syntax-guide-776639995.html Thanks.

    PS - it's also worth noting that bitbucket is kind enough to import a texty version of the changelogs into a Pull Request, which includes 4 spaces at the beginning of lines that fall under each commit. If there was any way bitbucket could automatically interpret these 4 spaces (which are always after a CR) as an instruction to display a CR on the pull request page, instead of removing the CR that is mid-paragraph, that would make it look awesome and be fully automatic.

  14. linuxlars

    I agree, this is ridiculous. I've spent 20 minutes so far trying to get that to work in a code block and nada. One would expect this to work just like markdown, CR/LF/CRLF at the end of the line breaks to the new line. This can't be a hard fix.

    For what it's worth, after 28 minutes, I gave up and attached a screen shot.

  15. Wouter Hartog

    Agree. this is a very annoying behavior, causing me to spend a lot of unnecessary time to edit text to something that is readable.

    It's also not consistent: if I type text in the text box, then line feeds are working normally, but when I copy and paste text from Notepad plus plus for example, it has this odd behavior which can only be fixed by the two spaces at the end.

  16. Frank Fusco

    I think you guys should just change this. This was a problem for me just copying and pasting within the editor. This is a super dumb argument to have to make.

  17. Scott Rogers

    Extremely stupid, so I +1 every comment on here.

    I have my IDE setup to clean up extra whitespace on line endings. Well, because that's just extra garbage.

    Two spaces, how unprofessional.

  18. Max Floden

    Agree with what has been said by everyone else. It should be fairly simple to make this configurable as suggested by Anton Koster. Ie a button or setting to "replace all normal line breaks with markdown line break"

    Edit: Is this thread even being watched by Bitbucket as it is marked as resolved?

  19. julian miller

    funny comments but sad the thread has gone on for years. i've had the same experience as those above.

    even if you all were religious about markup it still should be in the manual so you don't have to be lucky enough to discover it in this thread.

    my suspicion is this is a thread that no one at atlassian frequents or maybe has ever seen? erik (staff) does not really explain the issue just says the same thing 3 times.

    i just want to post issues without having to massage the format each time.

    i would like to hear from someone at atlassian, otherwise this thread could go on for another decade.

    maybe this helps:

    https://stackoverflow.com/questions/170961/whats-the-best-crlf-carriage-return-line-feed-handling-strategy-with-git

  20. Alastair Wilkes staff

    Hi y'all,

    Based on your feedback, we’re experimenting with changing this behavior - as of right now, newlines should be represented as you'd expect (with no need to add two spaces). Note: it could take a little while for this to propagate, due to caching.

    However - because changing this behavior could undesirably affect old content that may have been authored assuming this behavior, we may restore or modify it in the future based on customer feedback.

    EDIT: We need to turn this off for a bit, but I am confident we will be able to turn it back on soon.

    Finally - except for a short time after an issue is first resolved, we typically do not monitor resolved/closed issues for new comments as there are simply too many. If you would like to 'reopen' the discussion on a closed issue it's best to open a new one so it gets seen.

    Thanks!
    Alastair

  21. Cristi Scutaru

    Where are you with this very important issue, guys? (Five years old issue and you could not implement a simple expected behavior?!...)

    I expect regular users to leave comments to my public repository, or they cannot do it the way it is now, they may create a mess. Do you realize this is a MAJOR reason why we may not use this otherwise great repository (i.e. the Issues)?

    Thanks, Cristian

  22. Sebastiaan Candel

    I'm a new Premium user and it is absolutely ridiculous that after 5?? years this is still an issue. @alwilkes Follow proper (i.e. industry standard) markdown parsing and display guidelines! We are NOT going to modify all our markdown just because BB handles other standards.

  23. Michael Kastner

    I am looking for a Github alternative. A rather simple problem like fixing the md line break lingering around for years without anybody taking care of it makes me wonder how bitbucket handles real problems.

    I'd like to spend my time writing code and not figuring out how to write some exotic markdown. BTW: four spaces for list elements? Seriously?

    Please, do yourself a favour and fix it.

  24. Hristijan Gjorgjievski

    Two spaces at the end of the line and then a new line does not work for code blocks. Is there any alternative? This is displayed on one line:

    git clone git@bitbucket.org:x/x.git cd x npm install npm run start:dev

  25. Alastair Wilkes staff

    @Ania Rudzińska & @Hristijan Gjorgjievski

    Hmm - you shouldn't need two spaces at the end of the line inside code blocks (invoked using triple backtick ``` or with a four-space-indent). You should only need it within paragraphs. How are you invoking a code block?

    For others:

    For now, you’ll need to add two spaces at the end of each line per the Markdown spec. Removing this requirement for comments and issue/PR descriptions is in our backlog. At this time, we don't plan to remove this requirement for rendered Markdown files (READMEs/Wikis) because that could negatively affect the rendering of existing content.

  26. julian miller

    so alistair, in issues we need to add 2 spaces or shift cr to get a normal cr?

    there is no way when copying and pasting pages of normal text to have it come thru normal (wysiwyg) without doing some text massage first?

  27. julian miller

    why does it work this way in issues? issues is where people should be able to edit normally. this is still a problem.

    let's say i paste a half page of text from a user describing a issue. there are (or were) carriage returns and that all is removed. now i have to go thru and put spaces after each line to make it legible.

    i can understand it elsewhere but why in issues?

  28. Log in to comment