Jump to content

User:Davidgothberg/The br tag

From Wikipedia, the free encyclopedia

<br> or <br />?

[edit]

As far as I know <br> tags have been part of wikimarkup since long before any other HTML tags were allowed in MediaWiki. But MediaWiki was updated to also understand
some year ago so that it would be easier to copy and paste text from other free sources without having to modify each br tag in those texts. Remember that Wikipedia pages use wikimarkup, and then MediaWiki converts that to whatever happens to be the current standard for web page rendering. And today (2009) that happens to be XHTML 1.0 Transitional. Tomorrow it might be something totally different, like PDF. Oh wait, we already do render to PDF for those that want that!

But apart from the background, let's examine this step by step. Which should we use? <br> or <br />?


Which should we use? <br> or <br />?

Let's examine this step by step:

1: Writing the XHTML code <br/> without a blank is even against the recommendations of the World Wide Web Consortium, instead it should be written as <br /> since then HTML parsers can understand it too. HTML parsers will simply regard <br /> as a "br" with an unknown parameter "/", while they will regard "br/" as an unknown tag name. So we should definitely not teach people to write <br/>, but possibly <br />.

2: The "HTML" codes we use here at Wikipedia are not XHTML markup nor are they HTML markup, instead they are "HTML wikimarkup", since MediaWiki processes them just like wikimarkup.

3: Wikipedia mainly uses wikimarkup. The reason for that is simple: Most people that edit Wikipedia are people who never have made a web page, so they know nothing about HTML, XHTML or CSS. So for them (and even for us old webmaster geeks) it is easier to use wikimarkup.

4: As far as I have seen the documentation for MediaWiki talks about "HTML in wikitext" and never mentions "XHTML in wikitext". Also up until recently all documentation listed <br> as the code for forced line breaks. But some time ago some XHTML enthusiasts went around and edited a lot of the help pages to show the <br /> or even the <br/>.

So which should we use? <br> or <br />?

Well, let's first ask another question: Which markup should we use for bold text?

  • '''Bold'''
  • <b>Bold</b>
  • <span style="font-weight:bold;">Bold</span>

I think we all know that the wikimarkup '''Bold''' is the recommended one. Mainly because it is simpler to use, especially for the majority of editors that don't know HTML and CSS.

The same goes for <br> vs <br />. The HTML wikimarkup <br> is easier for the majority of editors to use, and it is shorter.

Sure, we have a "teaching opportunity" to teach people to use the <br />, but there is a very high risk that they instead will use the <br/> and that would be a bad thing. And believe it or not, many beginners have problems telling "/" and "\" apart. So they might even try to use the <br\>...

So again, the <br> is easier for the majority of editors to use, and it is shorter.

--David Göthberg (talk) 23:13, 14 March 2008 (UTC)


Well, <br> is the correct "HTML wikimarkup". But MediaWiki was updated to also understand <br /> some years ago so that it would be easier to copy and paste text from other free sources without having to modify each br tag in those texts.
Remember that wikimarkup should be as easy as possible so that normal people (non-webmasters) can edit Wikipedia. Wikipedia then parses and converts the wikimarkup to whatever is the current standard for web page rendering. And today (2009) that happens to be XHTML 1.0 Transitional. Tomorrow it might be something totally different, like PDF. Oh wait, we already do render to PDF for those that want that!
And note that the very similar <br \>, <br\>, </br>, </ br>, <\br> and <\ br> all are faulty variants. And the variant <br/> (without space) is not a recommended variant of the <br /> tag, according to the World Wide Web Consortium (W3C), since it breaks older web browsers.
So I suggest we stick to the simple wikimarkup <br> tag and not change all our 18 million pages every time the web standards change.
By the way, the "HTML tidy" function in MediaWiki's page rendering fixes some of the other faulty ways to write the br tag when it renders a page, that's why we get away with some variants like <br \>.
In April 2009 Brion Vibber, lead developer of MediaWiki, said:
In my experience XHTML 1.1 and later are a dead end; HTML 5 is where all the action is in browser support development.
There’s also no particular advantage for the “strict” DTD variants; good clean code can be written with or without it, but the “strict” deprecations are often arbitrary and require jumping through more hoops to replicate simple features.
So in a not too distant future the MediaWiki page renderer might be converting <br /> in wiki code to <br> in the rendered pages. Again, wikimarkup is not the same thing as rendered page code.
--David Göthberg (talk) 09:12, 25 August 2008 (UTC)
Updated --David Göthberg (talk) 16:19, 24 October 2009 (UTC)
[edit]

Hi X. Today you edited template {{example}}. You added "link=" which made it so that images fed to that template would not be linked. I had to revert your edit.

Most image licenses require author attribution and that the full license text is sent along or linked to. So we have to have links to the image pages where we state the authors name, type of license and link on to the full license text. We may only unlink images that are public domain and with some other licenses. Unlinking other images is illegal (copyright crime) and means the image authors can sue you and/or Wikimedia Foundation and win in most courts in most countries. Sorry about that, copyright is a hassle.

--David Göthberg (talk) 16:56, 28 January 2010 (UTC)

"Free" Software licenses like GPL usually don't require that the attribution and license is showed to every end user, but instead only to those that install and run the software. And you might have noticed that during installation such software often show a lot of stuff.
In books we know we can first look around the image, if the attribution isn't there, then we look at the first and last pages of the book. Also, the images in books usually are not GFDL or CS-BY-SA, instead the publishers have commercial agreements with the image owners, agreements that allow the books and newspapers etc to use less attribution.
The same goes for most commercial web sites: They have (or are at least required by law to have) agreements with the image owners that let them use the images the way they do.
While here at Wikipedia we mostly use images with GFDL and CS-BY-SA licenses or similar. We don't have special commercial agreements with the authors who made the images. We don't pay the image authors anything. So we have to obey by the requirement to attribute those authors and make the licenses readily available. If we don't link to the image page it takes specialised technical knowledge to find the image page. Thus that means we are hiding away the attribution and license. Copyright law says we must abide by what the image license says, even if it says we should jump on one leg and scream "I am a monkey", or we may not use the image. So if we don't like the license, then our only other option is to not use the image at all.
--David Göthberg (talk) 18:26, 28 January 2010 (UTC)