Help talk:HTML in wikitext/Archive 1

  • 08:14, 6 August 2006 contribs)| (→Permitted HTML - * <ol>)
  • 07:03, 6 August 2006 User:72.174.171.125 (→Permitted HTML - Updated links to HTML article and made some more precise)
  • 13:26, 14 July 2006 contribs)| (→MediaWiki namespace - CSS and JS pages (see Help:User style) are not interpreted as wikitext, and therefore can have arbitrary HTML.)
  • 23:30, 8 July 2006 User:165.146.163.167 (→Permitted HTML - Correct formatting of the <a href="..."> example)
  • 17:09, 7 July 2006 contribs)| (In some pages in the MediaWiki namespace HTML does not work, and e.g. &lt;span id=abc&gt; produces the HTML &amp;lt;span id=abc&amp;gt; rendered by the browser as &lt;span id=abc&gt;.)
  • 15:13, 6 July 2006 contribs)| (changed link to be an actual link)
  • 14:38, 25 May 2006 contribs)| (→Permitted HTML - Logical > Structured link fix)
  • 02:04, 10 May 2006 contribs)| m (Reverted edits by 86.104.204.84 to last version by 68.48.7.17)
  • 00:59, 7 May 2006 contribs)| m (Reverted edits by 86.104.204.84 to last version by Solensean)
  • 22:10, 2 January 2006 User:69.180.129.156 (fixing an html link example that wouldn't have worked anyway)
  • 05:22, 9 December 2005 contribs)| (Modified interwiki links that don't work on Wikipedia itself.)
  • 03:29, 25 November 2005 contribs)| (Changed initial template.)
  • 12:12, 24 November 2005 contribs)| (Fixed hyperlinks that break when this page is copied to other projects.)
  • 08:01, 15 July 2005 contribs)| m (Reverted edits by 198.144.192.42 to last version by Patrick)
  • 08:53, 8 June 2005 contribs)| (rm sidebar, overlaps text)
  • 05:25, 27 May 2005 contribs)| m (Reverted edits by 68.75.176.214 to last version by Patrick)
  • 01:07, 11 March 2005 contribs)| (→Permitted HTML - re:Talk (provisional): In 1.4rc1, the removeHTMLtags function is located in Parser.php)
  • 20:19, 30 January 2005 contribs)| m (Added links to HTML element descriptions)
  • 17:50, 30 January 2005 User:68.5.79.90 (Added links to HTML element descriptions)
  • 17:11, 25 January 2005 contribs)| (update - span is allowed)
  • 12:23, 5 August 2004 contribs)| (→Font -.title {color: red; } to see which text has a hover box.)
  • 10:25, 5 August 2004 contribs)| (→Font - class="title")
  • 07:56, 5 August 2004 contribs)| (→Span -Note that the blank spaces at the end of and just after the styled part are removed; use &amp;nbsp; at the end:)
  • 07:43, 5 August 2004 contribs)| (→Span -The replacement &lt;div style="display:inline"> can be used, but, oddly, apparently only in a list:)
  • 05:42, 3 August 2004 contribs)| (→Span -The replacement &lt;div style="display:inline"> is effectively disabled: the code is retained, but with closure of the paragraph before it and starting a new one after it.)
  • 04:35, 3 August 2004 contribs)| (→Span - Note that many readers will not have their own css, specially adapted for such usage, so one cannot refer to "the red text above", etc.)
  • 04:30, 3 August 2004 contribs)| (→Span -correction; This is suitable if the color is specifically intended to be red; if it is just for emphasis a more general term for the class would be more appropriate, because css allows the u)
  • 04:10, 3 August 2004 contribs)| (→Span -E.g. to assign the class "red" to a text one can put &lt;div style="display:inline; class="red"/>example text</div> which gives)
  • 04:00, 3 August 2004 contribs)| (Span is also not allowed now, but this is being discussed, see w:Wikipedia:Span tags poll. It can be replaced by <div style="display:inline"/>.)
  • 08:38, 31 July 2004 contribs)| (E.g., element "a" is not allowed, and the wikitext)
  • 08:27, 31 July 2004 contribs)| (and allows the tag to be used as link target.)
  • 08:16, 31 July 2004 contribs)| (For many w:HTML elements more convenient wikitext code is available, see Help:Editing. However, HTML tags allow an id that can be referenced in css, to specify a user style.)
  • 08:10, 31 July 2004 contribs)| (The following excerpt from [http://cvs.sourceforge.net/viewcvs.py/wikipedia/phpwiki/newcodebase/OutputPage.php OutputPage.php] shows what HTML is allowed in wikitext.)

HTML 5

edit

Is anyone doing any work in preparedness for HTML5? These articles may be of use:

Andy Mabbett (User:Pigsonthewing); Andy's talk; Andy's edits 15:24, 22 August 2009 (UTC)Reply

HTML, or XHTML?

edit

Desirably or otherwise, the Doctype declaration at the top of every en:WP page announces that the page is not in HTML but in XHTML (specifically, 1.0 Transitional). HTML and XHTML aren't the same, and pointing out the difference isn't merely pedantic. As it is, this page prescribes such code as simple "<br>" for a line break, and of course this is not valid XHTML. I believe that the Mediawiki software (in its current state, at least) silently corrects this to "<br />" and thus that this particular difference between HTML and XHTML doesn't really matter in practice; but it hardly helps (or contributes toward the educational purpose of Wikipedia as a whole) that this page promulgates misunderstandings. Unless there's some plan that I haven't heard of to switch soon to HTML (e.g. HTML5), I suggest moving this page to "Help:XHTML in wikitext" and making changes within it toward XHTML. But perhaps I'm overlooking something. -- Hoary (talk) 00:13, 1 April 2011 (UTC)Reply

The example "<br>" seems to indicate that the current page title "Help:HTML in wikitext" is better, the slash is not needed in the wikitext.--Patrick (talk) 12:51, 1 April 2011 (UTC)Reply
Please see the first sentence of my comment above. -- Hoary (talk) 12:55, 1 April 2011 (UTC)Reply
That is about the code sent to the browser, not about the wikitext.--Patrick (talk) 12:57, 1 April 2011 (UTC)Reply

Wikipedia uses HTML Tidy to correct a lot of markup. Tags such as <br>, </br> and <br/> get transformed to a proper <br />.

The main issues occur when content is ported to another wiki that does not use HTML Tidy, resulting in invalid XHTML output. HTML Tidy does fix things it should not at times which results in some rather confusing output. ---— Gadget850 (Ed) talk 13:07, 1 April 2011 (UTC)Reply

So the result is XHTML 1.0 Transitional, or purports to be. The Doctype declaration aside, it's clearly XHTML, it doesn't use framesets, and in places it's clearly transitional rather than strict, so XHTML 1.0 Transitional it is. (I've a feeling that something happens after the HTML Tidy phase, because "un-Tidy" empty <ul></ul> pairs are common.) Knowing that the final product is going to be XHTML 1.0 Transitional (or thereabouts), what do you want going into Tidy: HTML elements, or XHTML elements? -- Hoary (talk) 14:25, 2 April 2011 (UTC)Reply
HTML Tidy is not enabled for editnotices or in the MediaWiki namespace. Using <br> will render invalid XHTML and will break tools such as Twinkle. ---— Gadget850 (Ed) talk 23:57, 2 April 2011 (UTC)Reply
Although what Tidy isn't enabled for arguably isn't "wikitext", the fact that Tidy isn't enabled there and the potential for irritation when [specifically] HTML is used in the wrong place seem to me additional reasons to emphasize that XHTML is what's used for this site. Two measures: (i) retitle the page "Help:HTML in wikitext", and (ii) edit the page accordingly. (Of course the latter sounds far more forbidding than it really is. The changes would be very few and very simple; I could effect them all in a few minutes, though as somebody who seems a lot more knowledgeable than I am, you'd be wise to give the results a quick look-over.) -- Hoary (talk) 04:34, 3 April 2011 (UTC)Reply

Multiple line breaks?

edit

br does not accept a parameter such as 2 or 3, does it?
It seems like such a natural thing. Varlaam (talk) 17:21, 16 May 2012 (UTC)Reply

No, the <br /> tag is not part of the wikicode but is built-in to XHTML, and the only attributes that it recognises are class=, clear=, id=, style=, and title=. See http://www.w3.org/TR/html4/struct/text.html#edef-BR
There is rarely a need to use more than one line break. Some people try to use them to force text to appear below an image instead of alongside it: but the effects vary between different screen resolutions, and even between browsers. The {{clear}} family of templates do this in a much more predictable manner. --Redrose64 (talk) 17:37, 16 May 2012 (UTC)Reply
I certainly agree with you that legitimate situations for it are rare.
In the interim though I have set up a multiple break at the head of one of my pages, List of World War II short films.
I am not able to test across multiple browsers.
Could you possibly have a look at my code and see what you think?
(I used to have a job where I had to do a code read for every programmer in the office, other than the guru. What a nightmare.)
Thanks, Varlaam (talk) 17:53, 16 May 2012 (UTC)Reply
It's not clear to me why any <br /> are necessary there - let alone three. The {{TOC left}}, {{clear right}} and {{-}} also seem superfluous to me: they serve to fix the formatting because the lead sentence has been mispositioned (it comes first but should be after the first image). If the lead sentence is moved after the image, this will allow those six items to be removed, so that the article then begins:
{{contains Cyrillic text}}
{{contains Japanese text}}
[[File:Education for Death.jpg|150px|thumb|School scene from Walt Disney's ''Education for Death'' (1943)]]
Below is an incomplete list of '''short films or''' animated '''cartoons''' that pertain to [[World War II]], or the years leading up to it.

==Restrictions==
This is not just shorter, but it also conforms to MOS:LEAD. --Redrose64 (talk) 19:16, 16 May 2012 (UTC)Reply

Commenting ("invisible" text)

edit

Came here from Wiki markup page where discussion referenced, this section indicated for proposed merge into HTML (XHTML) Help. I just think it would be best to have the same info in both pages, ie at Wiki markup AND Help:HTML. David_FLXD (Talk) 23:37, 6 July 2012 (UTC)Reply

Then why not merge both pages entirely? ---— Gadget850 (Ed) talk 11:36, 7 July 2012 (UTC)Reply
Took me a while to work this out, but at the top of Help:Wiki markup#Invisible text (comments) there is a {{merge to}} box. A matching {{merge from}} should have been placed at the top of Help:HTML in wikitext#Comments, and a discussion raised here as well. --Redrose64 (talk) 11:40, 7 July 2012 (UTC)Reply
Yeah. I think I got interrupted. Regardless, if you have this documented in two separate places, then you get two different sets of documentation. There is discussion at Help talk:Wiki markup#HTML v. wikimarkup. ---— Gadget850 (Ed) talk 12:18, 7 July 2012 (UTC)Reply
Oppose. HTML5 and Wikicode are similar, but not the same. I am removing the merge notice.Frmorrison (talk) 15:12, 9 July 2014 (UTC)Reply
OK. Help:Wiki markup#Invisible text (comments) documents HTML, but it matches the mish mash of that entire page. --  Gadget850 talk 16:36, 9 July 2014 (UTC)Reply

Cite id italics

edit

This is odd, there are a few pages I am familiar with that use <cite id = > in the references section to enable html linking of citations to books where multiple pages are used. The tag now seems to be italicizing the citations. See International_Society_for_the_Study_of_Trauma_and_Dissociation#References andSatanic_ritual_abuse#References. The italics seem to go past the references section and cause the external links section heading and actual links to italicize as well. What's up with that? WLU (t) (c) Wikipedia's rules:simple/complex 18:44, 18 July 2012 (UTC)Reply

I don't see the problem, but that usage is obsolete. <cite> should contain only the title of the work. You should consider using Shortened footnotes. ---— Gadget850 (Ed) talk 19:00, 18 July 2012 (UTC)Reply
Aw...that's a lot of work :(
It's weird, I see the italics in both pages, but they flow on to subsequent sections only in SRA. I'll switch 'em to SFN instead, thanks. WLU (t) (c) Wikipedia's rules:simple/complex 19:04, 18 July 2012 (UTC)Reply
(edit conflict)If you don't want to get into the technicalities of that, try {{wikicite}} which may be used as a drop-in replacement. That is to say, a ref formatted as
<cite id="Smith2012">details of 2012 book by Smith</cite>
may be amended to
{{wikicite|ref="Smith2012"|reference=details of 2012 book by Smith}}
This technique creates exactly the same anchor (and is compatible with a greater number of browsers), but does not format the text in any way. --Redrose64 (talk) 19:07, 18 July 2012 (UTC)Reply
I converted to {{sfn}} on both pages so it's fine now. That was a tedious task. But at least it bumped up the ol' edit count. WLU (t) (c) Wikipedia's rules:simple/complex 20:26, 18 July 2012 (UTC)Reply
I did a few fixes: You have to use |ref=harv in the long citations; you have to use |last= and |first=, not |author=. ---— Gadget850 (Ed) talk 22:22, 18 July 2012 (UTC)Reply

wbr

edit

<wbr> will be allowed with MediaWiki 1.22/wmf13.[1] --  Gadget850 talk 05:47, 17 August 2013 (UTC)Reply


<wbr> is a word break opportunity; that is, it specifies where it would be OK to add a line-break where a word is too long, or it is perceived that the browser will break a line at the wrong place.

Markup Renders as
Now is the time to become a power editor, by learning HyperText Markup Language

Now is the time to become a power editor, by learning HyperText Markup Language

Now is the time to become a power editor, by learning Hyper<wbr>Text Markup Language

Now is the time to become a power editor, by learning HyperText Markup Language

As you narrow your browser window, you will see that the second example wraps between Hyper and Text. — Preceding unsigned comment added by Gadget850 (talkcontribs) 02:01, 24 August 2013 (UTC)Reply

New markup

edit

I just noticed that Sanitizer.php now has some additional markup whitelisted.

--  Gadget850 talk 21:05, 9 July 2014 (UTC)Reply

I used <q>...</q> just over a week ago, don't recall where except that it was a discussion page. It definitely worked - I didn't actually realise that it wasn't supposed to. --Redrose64 (talk) 22:25, 9 July 2014 (UTC)Reply
<q> and <bdo> were not supported when I made major updates to this help page in May/June 2013. Took a bit of digging, but found it was added in MediaWiki 1.22/wmf9 on July 11, 2013. I have not found the changes for the table markup yet. --  Gadget850 talk 01:41, 10 July 2014 (UTC)Reply
<thead>, <tfoot> and <tbody> are either not whitelisted, or seem to be caught by something not recognizing them; they are converted to &lt;theader&gt;. The parser generates <tbody> for any wikitable, but that is also pretty useless. It should ideally generate <theader> for the top header row. -- [[User:Edokter]] {{talk}} 10:10, 10 July 2014 (UTC)Reply
These tags also appear to be whitelisted but don't work:
  • <colgroup>
  • <col>
  • <rtc> (what is this?)
--  Gadget850 talk 10:22, 10 July 2014 (UTC)Reply
<rtc> seems to be a deprecated Ruby tag. -- [[User:Edokter]] {{talk}} 11:22, 10 July 2014 (UTC)Reply
Finally found it— it wasn't in my usual HTML references.[2][3]; doesn't look deprecated.  Gadget850 talk 12:16, 10 July 2014 (UTC)Reply
HTML 5 seems to be still quite fluid (it dropped back from Candidate Recommendation to Working Draft on 17 June 2014 - less than four weeks ago). Some of the changes made at the previous revision concern the Text-level semantics subsection: the Candidate Recommendation 17 December 2012 does not have <rtc>...</rtc>, whereas the next version, the W3C Candidate Recommendation 29 April 2014 includes it at 4.5.24 The rtc element. --Redrose64 (talk) 13:30, 10 July 2014 (UTC)Reply
Regardless, there appear to be several tags that are whitelisted, but don't parse. Anyone know the reason?
<thead>, <tfoot>, <tbody>, <colgroup> and <col> are not listed in the section starting with '$htmlpairsStatic'. But <rtc> is listed there.
 Gadget850 talk 15:19, 10 July 2014 (UTC)Reply

table border

edit

I don't see that border on <table> is obsolete.[4] But I do get warnings and errors with the W3C validator:

  • border="": The border attribute on the table element is presentational markup. Consider using CSS instead.
  • border="1": The border attribute on the table element is presentational markup. Consider using CSS instead.
  • border="10": The border attribute on the table element is obsolete. Use CSS instead.

But http://www.w3.org/TR/html-markup/table.html shows that border "Indicates that its table element is not being used for layout purposes."

--  Gadget850 talk 14:23, 4 August 2014 (UTC)Reply

@Gadget850: See just after this entry, the paragraph beginning "The border attribute on the table element". --Redrose64 (talk) 15:37, 4 August 2014 (UTC)Reply

Nowiki

edit

What is the corresponding HTML tag for Wikipedia's "<nowiki>" Qwertyxp2000 (talk) 05:42, 5 June 2015 (UTC)Reply

@Qwertyxp2000: I'm not sure I know what you mean. What are you trying to do? --Redrose64 (talk) 10:42, 5 June 2015 (UTC)Reply
Okay, what I am saying is how to do Wikipedia's "nowiki" thing on an HTML document? Qwertyxp2000 (talk) 10:48, 5 June 2015 (UTC)Reply
HTML isn't Wikitext, so the term "nowiki" is meaningless. What specifically are you trying to achieve? --Redrose64 (talk) 11:02, 5 June 2015 (UTC)Reply
To stop HTML tag parsing in HTML documents is a little complex, and can involve the <pre> tag. See http://stackoverflow.com/questions/11673978/is-there-a-html-css-way-to-display-html-tags-without-parsing for an example. Obviously non-HTML wiki markup wouldn't be parsed in a HTML document, but might not be displayed if in the xml format (e.g. <nowiki> probably wouldn't be displayed) so you'd have to use a similar technique. --Jules (Mrjulesd) 11:21, 5 June 2015 (UTC)Reply
The current HTML5 spec says
Use pre and code instead, and escape "<" and "&" characters as "&lt;" and "&amp;" respectively.
The <XMP>...</XMP> element was last described in the HTML 3.2 spec, but a more complete explanation of its deprecation was given in the HTML 2.0 spec, paragraph beginning "Since CDATA declared content ...". --Redrose64 (talk) 11:54, 5 June 2015 (UTC)Reply

General anchors?

edit

The section Help:HTML in wikitext#Unsupported elements clarifies that <a> is not supported; well and good. However, it also claims that "<a> is for making links", and refers only to the [[]] and [] features, and to Help:Wiki_markup#Links_and_URLs for more details. That claim is not the whole truth.

In HTML, the <a name="..."> may be employed for creating anchors. I'd like to be able to refer and link directly to theorems in mathematical texts (e.g. in wikibooks); but I have found no way to create an anchor unrelated to a (sub)section head in the wiki markup. Is there any supported way to do this, either by wiki or HTML features? JoergenB (talk) 20:23, 23 August 2015 (UTC)Reply

@JoergenB: Since HTML 4.0, every element that is permissible in the body of a HTML document is allowed to have an id= attribute. This may be used as the anchor for a link, see HTML 4.10 section 7.5.2 and HTML 5 section 3.2.5.1. Essentially, where in HTML 3.2 (and earlier) you would write <a name="Foobar">Some text</a>, in HTML 4 (and later) the construct <span id="Foobar">Some text</span> may be used for the same purpose. See also the {{anchor}} template. --Redrose64 (talk) 20:33, 23 August 2015 (UTC)Reply
Thanks! JoergenB (talk) 21:19, 23 August 2015 (UTC)Reply

Extended Tags:Graph

edit

Not sure how to fix it, but it is linked to the wrong page. It should go here https://www.mediawiki.org/wiki/Extension:Graph 199.34.4.20 (talk) 01:44, 24 October 2015 (UTC)Reply

It's in Template:Xtag/doc. But since Help:Graph already has a link to mw:Extension:Graph, why is it wrong? --Redrose64 (talk) 07:13, 24 October 2015 (UTC)Reply

Cite tag does not render italics

edit

On my browser at least, the cite tag does not behave as described in the documentation. This page says "contains the title of a work and by default is formatted in italics", but the example given just below does not render italics. Does something need to be fixed? – Jonesey95 (talk) 17:26, 1 December 2016 (UTC)Reply

No italics for me either (Chrome 54.0.2840.99 m on Windows 10 Home). EEng 19:35, 1 December 2016 (UTC)Reply
I looked at the source code using Chrome's "inspect" function, and it appears that a style rule in the vector skin applies font-style: inherit; to the cite tag. I wonder why... — Eru·tuon 20:47, 1 December 2016 (UTC)Reply
The actual rule is
cite, dfn {
    font-style: inherit;
}
and it's the very first one in MediaWiki:Common.css, so it's not specific to Vector skin or to any particular browser. It's been present in that form since this edit by Edokter (talk · contribs) at 09:52, 12 September 2015. The relevant discussion is MediaWiki talk:Common.css/Archive 17#The cite element needs to not auto-italicize any longer. --Redrose64 (talk) 22:06, 1 December 2016 (UTC)Reply
In which case, it looks as if the documentation needs fixing. --David Biddulph (talk) 22:14, 1 December 2016 (UTC)Reply
That is helpful. I have removed the bit about italics. The documentation still doesn't really explain what the cite tag is for or why one would want to use it. That would be an improvement. I read the linked discussion, which was confusing (to me). – Jonesey95 (talk) 22:31, 1 December 2016 (UTC)Reply
Yes, why is <cite> even being documented here? Shouldn't this page be restricted to stuff there's at least some reason for editors to use? EEng 23:35, 1 December 2016 (UTC)Reply
It is used at least 1,700 times in article space. I've never seen a good explanation of what it is for. It is apparently sometimes used in the same way that {{anchor}} is used; see this VPT discussion. – Jonesey95 (talk) 00:42, 2 December 2016 (UTC)Reply
That's because there was a page - can't remember which - that actually recommended the use of an empty <cite>...</cite> to create anchors. Whatever page that was, it was amended around 2010 (2-3 years either way) so that the recommendation isn't there any more, but there are still a lot of bad uses out there. It may have been inspired by the {{wikicite}} template, which was devised for enclosing non-templated refs and giving them anchors, but which was altered in October 2009. --Redrose64 (talk) 10:00, 2 December 2016 (UTC)Reply
The <cite> tag is documented here because the page is intended to describe all HTML tags which are whitelisted, whether they are useful or not. The purpose of the tag has changed with the evolution of HTML; skipping the early definitions, HTML 4.01 recommended that it contain "a citation or a reference to other sources"; HTML5 specifies that it "represents a reference to a creative work. It must include the title of the work or the name of the author ... or an URL reference". In between those there was a draft version of HTML which permitted its use only for the title of the referenced work. --Redrose64 (talk) 10:00, 2 December 2016 (UTC)Reply
HTML5 suggests that browsers should apply the font-style: italic; declaration to <cite>...</cite> elements, so we can assume that that is what many browsers will do to these elements where the styling is not overridden locally (as it is here). References generated by the various Citation Style 1 and Citation Style 2 templates nowadays enclose the whole ref (except for the COinS metadata) in a <cite>...</cite> element, which is why we've overridden the italicisation by default: we don't want the whole ref to be italicised, just the title of the work or the name of the periodical. --Redrose64 (talk) 10:00, 2 December 2016 (UTC)Reply