Template:Ic-hl: Difference between revisions

From KDE Community Wiki
(Add ic-hl template)
 
(Fix parameter value and text location.)
 
Line 13: Line 13:
* {{ic|2}} or {{ic|code}}: the code that will be highlighted
* {{ic|2}} or {{ic|code}}: the code that will be highlighted


== Usage ==
== Usage example ==


{{bc|Some text <nowiki>{{ic-hl|python|def quick_sort(arr):}}</nowiki> text continues.}}
{{bc|Some text <nowiki>{{ic-hl|python|def quick_sort(arr):}}</nowiki> text continues.}}
Line 21: Line 21:
== Result ==
== Result ==


Some text {{ic-hl|lang=python|code=def quick_sort(arr):}}</noinclude><includeonly>{{#tag:syntaxhighlight|
Some text {{ic-hl|lang=python|code=def quick_sort(arr):}} text continues.</noinclude><includeonly>{{#tag:syntaxhighlight
{{{code|{{{2|{{META Error}}}}}}}}
|{{{code|{{{2|{{META Error}}}}}}}}
|lang="{{{lang|{{{1|{{META Error}}}}}}}}"|inline}} text continues.</includeonly>
|lang="{{{lang|{{{1|{{META Error}}}}}}}}"
|inline="True"
}}</includeonly>

Latest revision as of 00:51, 29 September 2023

This page is a template, editing it will affect all the pages that make use of it, so users should be especially careful when editing it. For more details on how to use templates see "A Quick Guide to Templates"

Inline code with highlighted syntax.

  • Use Template:hc-hl for headed block code with highlighted syntax.
  • Use Template:hc for headed block code (without syntax highlighting).
  • Use Template:ic for inline code (without syntax highlighting).

Parameters

  • 1 or lang: the language of code block, to apply highlighting
  • 2 or code: the code that will be highlighted

Usage example

Some text {{ic-hl|python|def quick_sort(arr):}} text continues.
Some text {{ic-hl|lang=python|code=def quick_sort(arr):}} text continues.

Result

Some text def quick_sort(arr): text continues.