Extension talk:HTML Tags

Whe I try to dowload HTML Tags, I get the "Semantic DrillDown" extension... Bad download link ?
At the end of the sentence : You can download the HTML Tags code, in .tgz format, here.

Thanks Nicolas NALLET (talk) 16:24, 4 November 2012 (UTC)


 * Oops! That was a copy/paste error. Thanks for pointing that out; it's fixed now. Yaron Koren (talk) 17:22, 4 November 2012 (UTC)

Ok thanks it works great ! both download and extension !

Nicolas NALLET (talk) 11:47, 5 November 2012 (UTC)


 * It's great to hear that the extension is working for you! Yaron Koren (talk) 13:22, 5 November 2012 (UTC)

Application example : displaying a web site screenshot thumbnail
This extension allows to easily display a website screenshot thumnail with the help of a website screenshot provider.

You can see an exemple here


 * Cool! Yes, I guess there's no way right now in MediaWiki to have an external image that links to another URL. Yaron Koren (talk) 19:54, 5 November 2012 (UTC)

About Microdata
I originally figured that it might be an idea to add this reference since the intro already referred to some kind of Metadata. However I was indeed not telling the whole story. Most Microdata may be added without using this extension, but I think one is lost when trying to add Breadcrumbs data without using this extension. Cheers --&#91;&#91;kgh&#93;&#93; (talk) 06:54, 22 May 2014 (UTC)


 * Oh, okay - I really don't know that much about microdata stuff. I just added in a modified version of what you wrote - hopefully it make sense... Yaron Koren (talk) 00:17, 23 May 2014 (UTC)


 * That's great and thank you for improving the note. I think this will also increase the overall usage of this extension. No worries about microdata. I just started to dig in into it. It's another way to help search engines to grab content more meaningful way. Cheers --&#91;&#91;kgh&#93;&#93; (talk) 08:38, 23 May 2014 (UTC)

Doesn't work with nested tags
When you use nested tags, the first closes the first opened tag, and not the last opened one. As a second point, the inner doesn't close, instead the is written in the document Example: &lt;htmltag tagname="x"&gt; &lt;htmltag tagname="y"&gt; &lt;/htmltag&gt; &lt;/htmltag&gt; results in &lt;x&gt; &lt;y&gt; &lt;/y&gt; &lt;/htmltag&gt; &lt;--written, not as a html tag


 * That's too bad... I never thought about the nested thing. I can't think of any way to that get working easily, unfortunately; you may have to use some other method, like the Widgets extension. Yaron Koren (talk) 01:32, 8 July 2014 (UTC)
 * You can always use the wiki tag parser function:
 * Wess (talk) 19:36, 16 March 2017 (UTC)
 * Wess (talk) 19:36, 16 March 2017 (UTC)

Specific Pattern in Attributes
Hello,

Is it possible to allow a certain pattern for attributes? E.g if I wanted to allow a specific domain to be in iframe tag's src attribute.--194.150.65.139 09:11, 5 November 2016 (UTC)


 * No, unfortunately. Yaron Koren (talk) 02:36, 8 November 2016 (UTC)


 * Any plans on including the feature? --Id508317 (talk) 12:29, 8 December 2016 (UTC)


 * No - although I'd be happy to accept a patch that does this. Yaron Koren (talk) 13:52, 8 December 2016 (UTC)

how should do to add  ?
how should do to add  ?
 * Consider using Manual:Hooks/OutputPageBodyAttributes. Here's what I did to add support to Extension:BreadCrumbs2 to make it a WebPage.

$wgHooks['OutputPageBodyAttributes'][] = 'addBreadcrumbSchemaBodyAttributes';

function addBreadcrumbSchemaBodyAttributes( OutputPage $out, Skin $skin, &$bodyAttrs ) { $bodyAttrs['itemscope'] = ''; $bodyAttrs['itemtype'] = 'http://schema.org/WebPage';

return true; } ... $breadcrumbHTML = Xml::openElement( 'div', array ( 'id' => 'breadcrumbs2', 'itemprop' => 'breadcrumb' ) ). $breadcrumb. Xml::closeElement( 'div' );
 * You seem to need to use the empty string and be happy with  as a result, it doesn't accept null or false - this shows up OK on Google's structured data tester, though it didn't seem to work so well on the Rich Results Tool. GreenReaper (talk) 21:43, 22 February 2021 (UTC)

id is missing
Hi,

sadly it seems, that a set id attribute will not transfered trough the parser. Is there any way to provide this? --Gunnar.offel (talk) 00:47, 18 December 2019 (UTC)

ZIP Download Link
I have exchanged the ZIP-Download link to the GIT-Master Zip link. If it is not correct please change it to whatever is correct, but the version which was downloaded before that was not working at all. --DesignerThan (talk) 13:02, 6 January 2021 (UTC)
 * Indeed the link was outdated. However changing to master unconditionally is not a good idea either in case of possible breaking changes in the future. Thus I changed to the hash of current master. Cheers --&#91;&#91;kgh&#93;&#93; (talk) 22:25, 6 January 2021 (UTC)

Not restricted HTML Code as content
Hello, for a project I need to have a span inside of a button tag which is outputed with the HTMLTag Parser function. Is it possible to do that? That is the example code.

Thank's for helping me. --DesignerThan (talk) 21:51, 3 May 2021 (UTC)

The attribute "tagname" must be set for this tag.
Error

What does it mean. Wikedneeded (talk) 11:38, 12 June 2021 (UTC)

in case my contributions are delated A more detailed version is available here
https://www.mediawiki.org/w/index.php?title=Extension:HTML_Tags&oldid=4635947 Wikedneeded (talk) 12:00, 12 June 2021 (UTC)

=Rewriting the article here because admin called my edits "spam"=

[top]

The HTML Tags extension defines a tag,, that can be used to display HTML tags within wiki pages that may otherwise be disallowed by the MediaWiki parser.

HTML Tags was initially developed in order to allow support the use of LRMI(Learning Resource Metadata Initiative) tags within MediaWiki pages. See Implementing LRMI for how to implement such a thing using HTML Tags.

Another potential usage of HTML Tags is to embed microdata (especially the kind that can't be embedded already using ).

You can see a basic demonstration of this extension here.

Code and download
You can download the HTML Tags code, in .zip format, here.

You can also download the code directly via Git from the MediaWiki source code repository. From a command line, you can call the following:

To view the code online, including version history for each file, go here.

Installation
After you've obtained an 'HTMLTags' directory (either by extracting a compressed file or downloading via Git), place this directory within the main MediaWiki 'extensions' directory. Then, in the file 'LocalSettings.php' in the main MediaWiki directory, add the following line:

Step 2: Specify the allowed set of HTML tags
You then need to specify the allowed set of HTML tags, and the allowed set of attributes for each one, using the global variable $wgHTMLTagsAttributes. For instance, to allow the tag, and to allow only the attributes "href" and "class" for it, you would add the following to LocalSettings.php, after the inclusion of LocalSettings.php:

If you wanted to allow the tag, but without any allowed attributes, you would add the following:

Usage
Once a set of allowed tags and attributes are specified, you can use to place those tags on the page. You use the attribute "tagname" to specify the actual tag, and then add the other attributes exactly as you want them to appear. The "contents" of the tag become the contents of.

For instance, if:

and

... are added, and you want to add a link on some page using the tag, you could add something to the page like:

This will add the following to the page's HTML source:

Calling with a tag name that is not allowed will result in an error message:
 * "The attribute "tagname" must be set for this tag."

Calling  with an attribute that is not yet allowed will simply lead to the attribute being ignored.

See Implementing LRMI for a full description of how this extension, along with some templates, can be used to allow for easy adding of LRMI metadata to pages.

More examples
$wgHTMLTagsAttributes['script type'] = [ 'text/javascript'];

Authors
HTML Tags was written by Yaron Koren, reachable at yaron57 -at- gmail.com.

This extension was funded by Creative Commons as part of the LRMI project.

Version history
HTML Tags is currently at version 0.3.

The version history is:
 * 0.1 - November 1, 2012 - Initial version
 * 0.2 - May 27, 2014 - i18n messages moved into JSON files; various fixes
 * 0.3 - January 22, 2020 - converted to extension registration