Jump to content

Template:Hbc-hl: Difference between revisions

From KDE Community Wiki
Ashark (talk | contribs)
Fix double output, replace parameter name output to code
Ashark (talk | contribs)
Move link to separate section to make it more visible
Line 21: Line 21:
def quick_sort(arr):
def quick_sort(arr):
less = []}}</nowiki>
less = []}}</nowiki>
See [https://pygments.org/languages/ here] for supported values for {{ic|lang}}.


== Example ==
== Example ==
Line 28: Line 26:
{{hc-hl|lang=python|head=script.py|code=def quick_sort(arr):
{{hc-hl|lang=python|head=script.py|code=def quick_sort(arr):
less = []}}
less = []}}
== See also ==
* [https://pygments.org/languages/ List of supported values for {{ic|lang}} parameter].


== ToDo ==
== ToDo ==

Revision as of 09:08, 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"

Block code with header. With highlighted syntax.

Usage

  • 1 or lang: the language of code block, to apply highlighting
  • 2 or head: the code in the top pane
  • 3 or code: the code in the bottom pane
{{hc-hl|lang=python|script.py|
def quick_sort(arr):
	less = []}}
{{hc-hl|python|head=script.py|code=
def quick_sort(arr):
	less = []}}

Example

Template:Hc-hl

See also

ToDo

Waiting for TemplateStyles extension to be installed: https://bugs.kde.org/show_bug.cgi?id=474964 After that, switch the content model of Template:Hc-hl/styles.css to Sanitized CSS. Uncomment templatestyles tag. (It was commented, so it is not shown literally until the extension setup is done). After that, template should work normally.