puzzlement: (Default)
puzzlement ([personal profile] puzzlement) wrote in [site community profile] dw_suggestions2010-10-08 12:09 pm

Turn off automatic line-breaks around certain HTML tags

Title:
Turn off automatic line-breaks around certain HTML tags

Area:
html, markup, entry editor

Summary:
The autoformatter adds line breaks immediately before and after tags like <ul>, resulting in either writing HTML code all squished into one line, or a huge number of line breaks being added. I suggest this whitespace be stripped.

Description:
Say I have auto-formatting on, and I code up a list like this:

"""
Here is my intro to the list:

<ul>
<li>Here is my first list item</li>
<li>Here is my second list item</li>
</ul>

Here is my continuing text.
"""

This comes out of rendering something like:

"""
Here is my intro to the list:


* Here is my first list item

* Here is my second list item


Here is my continuing text.
"""

That is, there are two or three blank lines around the list, especially immediately after it, and blank lines between list items too. I never want this, I'm putting the line breaks in so that I can read my own HTML code. I have to avoid it by doing something like:

<blockquote>
Here is my intro to the list:<ul><li>Here is my first list item</li><li>Here is my second list item</li></ul>Here is my continuing text.
</blockquote>

This is very hard to read over when reviewing or re-editing my entry.

I would prefer the more standard HTML rendering of:

<blockquote>
Here is my intro to the list:
* Here is my first list item
* Here is my second list item
Here is my continuing text
</blockquote>

This is *not* the same as http://dw-suggestions.dreamwidth.org/92411.html, which wants auto-formatting off within certain tags. I want it off *around* certain tags: if I put a line break right after a <ul> tag, I *don't* want a line break there, I just want to be able to read my own HTML.

The WordPress HTML editor has exactly the behaviour I like here.

Poll #4874 Turn off automatic line-breaks around certain HTML tags
Open to: Registered Users, detailed results viewable to: All, participants: 64


This suggestion:

View Answers

Should be implemented as-is.
36 (56.2%)

Should be implemented with changes. (please comment)
6 (9.4%)

Shouldn't be implemented.
7 (10.9%)

(I have no opinion)
13 (20.3%)

(Other: please comment)
2 (3.1%)

ratcreature: Word. RatCreature nods. (word.)

[personal profile] ratcreature 2010-10-27 09:41 am (UTC)(link)
This would be great. I now often don't use structural html like lists and just do it plain text with * or - symbols because of this.
musyc: Silver flute resting diagonally across sheet music (Default)

[personal profile] musyc 2010-10-27 10:38 am (UTC)(link)
Yes, please! I run into the same problem, and since I code my HTML by hand, I like to have it neat, on individual lines. Finding the one error in a huge jumble of code is often an exercise in frustration with current behavior.
jazzfish: A cartoon guy with his hands in the air saying "Woot." (Woot.)

[personal profile] jazzfish 2010-10-27 12:06 pm (UTC)(link)
Awesome.

It puts a break either before or after <hr> as well, and I can never remember which, so I have to remember to check it in Preview and change it.
poulpette: cropped picture of an illustrated octopus (Default)

[personal profile] poulpette 2010-10-27 01:31 pm (UTC)(link)
If you uncheck auto-format, lines breaks don't matter, but of course, it requires you to include your own line-break tags and/or paragraph tags.

I'm not dead set against this but I think it's an idea that might make things confusing for users who don't understand, or have a limited understanding of HTML.
elf: Computer chip with location dot (You Are Here)

[personal profile] elf 2010-10-27 02:20 pm (UTC)(link)
People who don't understand HTML aren't likely to be using lists & blockquotes. People who have limited understanding of it tend to be annoyed that it threw in extra returns they didn't expect.

I speak from experience; I now expect to have to open the "preview" window several times for a complex post, to figure out where I've accidentally left in a return before a tag that shouldn't have one.
poulpette: Tenth Doctor looking away (DW - Ten)

[personal profile] poulpette 2010-10-27 03:45 pm (UTC)(link)
It's true the behaviour can be annoying, but the fact is that it is predictable as [personal profile] kutsuwamushi points out below, and works in a coherent, logical way. The only thing auto formating does is convert (every) physical linebreaks in your post (end of line characters created by the enter key) into HTML linebreaking tags (that's <*br /> tags, asterisk removed).

If, for readibility purpose (for example), a linebreak happens after (or before) a block-type elements (like divs, blockquotes or list elements), it does double duty with the clearing that occurs automatically due to the nature of the tag, both before and after (unless said tag's behaviour has been changed by CSS but that's another matter). And that's what make it appears as though there is an extra linebreak. It's because you actually intentionally put it there, and then asked the dw code processing your post to convert it to an actual linebreak.

If you break this pattern of behaviour, it WILL confuse part of the users, regardless of your own situation, it just won't be the same subset. I'm not really sure it's a desirable side effect of this modification.
kutsuwamushi: (Default)

[personal profile] kutsuwamushi 2010-10-27 02:33 pm (UTC)(link)
I understand HTML very well, but I think I might have trouble remembering which tags don't have automatic line breaks entered after them.

Right now the behavior is a little annoying, but totally predictable. I don't have to remember, "oh, no automatic line break after a list item" if I want my list double-spaced, for example.
poulpette: cropped picture of an illustrated octopus (Default)

[personal profile] poulpette 2010-10-27 02:52 pm (UTC)(link)
I think it might get confusing for me too, but I rarely use auto-formated posts nowadays, which may be why that case didn't came to mind at first. Sorry about that.

But in any case, that's exactly the point I was aiming to make. If the auto-linebreaking rules are changed, especially only a small subset of tags, it will cause confusion for the subset of user who are used to and expect this behaviour to occur. A behaviour which is as you point it, perfectly predictable, as well as logical.
zeborah: Map of New Zealand with a zebra salient (Default)

[personal profile] zeborah 2010-10-28 09:49 am (UTC)(link)
I get this argument except... I'm trying to work out what adverse effects there could be. If a user used to this continues with their normal formatting, there'll always be a linebreak of some kind, because these are div-level tags and they have to break (unless specifically styled as inline). I suppose a user might want two or three blank lines, but their text will still be clear without them; I can't see it causing as much of a mess as the current system does.

Predictability and logic is good, though. Would this make sufficient sense: make no change to how line-breaks around inline-level tags are treated; but strip line-breaks from around all block-level tags?

(For me, this seems ultimately little different than stripping my habitual double-spacing between sentences down to a single space. I can force the second space if I really want, but mostly I don't.)
turlough: castle on mountain top in winter, Burg Hohenzollern (Default)

[personal profile] turlough 2010-10-27 03:39 pm (UTC)(link)
Yes, this.

[personal profile] delladea 2010-10-27 01:39 pm (UTC)(link)
There is already an option to disable auto formatting for each individual entry and comment, as well as the <raw-code> tag for disabling formatting on portions of an entry. Maybe have an option where disable auto formatting is on by default for someone who likes to manually structure their line breaks?
sofiaviolet: drawing of three violets and three leaves (Default)

[personal profile] sofiaviolet 2010-10-27 01:47 pm (UTC)(link)
The "Disable auto-formatting" checkbox remembers its previous setting - it defaults to unchecked, but if you tick it, it'll still be ticked the next time you load the update page.

[personal profile] delladea 2010-10-27 02:21 pm (UTC)(link)
I never noticed that. Thanks for pointing that out.
matgb: Artwork of 19th century upper class anarchist, text: MatGB (Default)

[personal profile] matgb 2010-10-27 02:29 pm (UTC)(link)
Different issue though.

I like that I can hit return and get a linebreak, and wouldn't want to change that.

I dislike that if I use proper code for content, like headers, blockquotes and list items, that it adds in extra linebreaks I didn't ask for nor need.

I didn't actually realise it was doing this for awhile, and when teaching a friend how to format posts better got very confused when he had big problems getting it to look right.
jadelennox: Senora Sabasa Garcia, by Goya (Default)

[personal profile] jadelennox 2010-10-27 03:44 pm (UTC)(link)
OH PLEASE THIS.

I want my posts and comments to be auto formatted. I don't want them to be raw; I want linebreaks to be inserted. But not at the end of list elements!
Edited (taco) 2010-10-27 15:44 (UTC)
msilverstar: (Default)

[personal profile] msilverstar 2010-10-27 04:18 pm (UTC)(link)
I'm of two minds here, and I think there may be no good answer. I would use the feature and like it, but consistency in edit/format is a really really good thing and I'm reluctant to break it.
melannen: Commander Valentine of Alpha Squad Seven, a red-haired female Nick Fury in space, smoking contemplatively (Default)

[personal profile] melannen 2010-10-27 04:27 pm (UTC)(link)
I had somehow gotten the impression that this behavior varies by browser, which means it might be difficult to fix through DW. On the other hand, I could be wrong about that.

(Most of my lists and blockquotes lately have had cuts in among them, which causes other bugs that I really should get around to reporting already.)
aedifica: Silhouette of a girl sitting at a computer (Girl at computer)

[personal profile] aedifica 2010-10-27 04:40 pm (UTC)(link)
I voted "with changes" because I have a caveat: I think this sounds great, but only if it's consistent with how these tags behave on other websites.
pauamma: Cartooney crab wearing hot pink and acid green facemask holding drink with straw (Default)

[personal profile] pauamma 2010-10-27 05:02 pm (UTC)(link)
If that's implemented at all, I'd want it to insert the appropriate <lj-raw> (or whatever the DW equivalent is, I forgot) tags so that comment importing/crossposting/syndication/etc continues working correctly.
kerravonsen: (Default)

[personal profile] kerravonsen 2010-10-27 08:28 pm (UTC)(link)
+1
arethinn: glowing green spiral (Default)

[personal profile] arethinn 2010-10-27 07:37 pm (UTC)(link)
The WordPress HTML editor has exactly the behaviour I like here.

And here I always thought this was just an artifact of HTML parsing. Man, it'd be great if those extra spaces weren't there. I hate having to put everything all on one long line.

[personal profile] faithofone 2010-10-27 09:06 pm (UTC)(link)
Most emphatically agreeing with this suggestion. I'm so tired of writing up my posts and then having to go remove all the line breaks.
sky: Thera from Danger Gang (jrock - thera salute)

[personal profile] sky 2010-10-29 02:26 pm (UTC)(link)
Yes please!!! This is something that's driven me crazy for years... I really, really hate having to squish <ul> lists and stuff into a single line to make it look right, especially if I need to edit after.
ilyena_sylph: picture of Labyrinth!faerie with 'careful, i bite' as text (Default)

[personal profile] ilyena_sylph 2011-04-08 10:30 pm (UTC)(link)
Seriously, please?

I just want my lists to work!!!