Template:Ic: Difference between revisions

From Bibliotheca Anonoma
(Created page with "<noinclude>{{Template}} {{DISPLAYTITLE:Template:ic}} '''Inline code.''' * Use Template:bc for block code without header. * Use Template:hc for block code with header...")
 
m (Protected "Template:Ic" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
 
(4 intermediate revisions by the same user not shown)
Line 6: Line 6:
* Use [[Template:hc]] for block code with header.
* Use [[Template:hc]] for block code with header.


==Usage==
== Usage ==


{{bc|<nowiki>{{ic|code}}</nowiki>}}
{{Note|By default, PHP highlighting is used, though it's pretty neutral.}}


{{Tip|When representing keyboard keys, you can use [[Wikipedia:List of XML and HTML character entity references|HTML entities]] {{ic|&amp;uarr;}}, {{ic|&amp;rarr;}}, {{ic|&amp;darr;}} and {{ic|&amp;larr;}} to depict arrow keys: {{ic|&uarr;}}, {{ic|&rarr;}}, {{ic|&darr;}}, {{ic|&larr;}}}}
<pre><nowiki>{{Ic|hello world}}</nowiki></pre>
<!-- ## Keep this comment hidden to prevent this feature from being abused ##
 
This syntax allows the user to select the whole code with a triple click. For long lines of code, however, the template will tend to behave like [[Template:bc]]. To prevent this from happening, append a {{ic|<nowiki>|</nowiki>}} to the code (this will suppress the triple click functionality):
{{Ic|hello world}}
 
=== Syntax Highlighting ===
 
By specifying the language to use, you can get syntax highlighting as well. Here's a [[mw:Extension:SyntaxHighlight#Supported_languages|long list of supported languages.]]
 
<pre><nowiki>{{Ic|print "hello world"|lang=python}}</nowiki></pre>


{{bc|<nowiki>{{ic|code|}}</nowiki>}}
{{Sandbox|print "hello world"|lang=python}}


{{Note|Please use the second argument only when strictly necessary, consider manually splitting the code in more parts instead.}}-->
{{Tip|When representing keyboard keys, you can use [[Wikipedia:List of XML and HTML character entity references|HTML entities]] {{ic|&amp;uarr;}}, {{ic|&amp;rarr;}}, {{ic|&amp;darr;}} and {{ic|&amp;larr;}} to depict arrow keys: {{ic|&uarr;}}, {{ic|&rarr;}}, {{ic|&darr;}}, {{ic|&larr;}}}}


==Example==
==Example==


{{ic|code}}</noinclude><includeonly><code>{{{code|{{{1|{{META Error}}}}}}}}</code></includeonly>
{{ic|code}}</noinclude><includeonly>{{#tag:syntaxhighlight|{{{1|input}}}|lang={{{lang|php}}}|enclose=none}}</includeonly>

Latest revision as of 12:33, 5 March 2017

This page is a template. It contains no Bibliotheca Anonoma-related information, but should be used as part of other articles. For more information, read Help:Template.

Please do not experiment with this template; you could ruin all pages using this template. If you want to edit this template, copy the text to Template:Sandbox, edit and test it there, and copy it back when it works.

Feel free to voice your opinion regarding this template.

Inline code.

Usage

Note: By default, PHP highlighting is used, though it's pretty neutral.
{{Ic|hello world}}

hello world

Syntax Highlighting

By specifying the language to use, you can get syntax highlighting as well. Here's a long list of supported languages.

{{Ic|print "hello world"|lang=python}}

print "hello world"

Tip: When representing keyboard keys, you can use HTML entities &amp;uarr;, &amp;rarr;, &amp;darr; and &amp;larr; to depict arrow keys: &uarr;, &rarr;, &darr;, &larr;

Example

code