Template:hbc-hl

From KDE Community Wiki
Revision as of 11:01, 29 September 2023 by Ashark (talk | contribs) (Replace display title after template renaming)
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.

Parameters

  • 1 or lang: the language of code block
  • 2 or head: the code in the top pane
  • 3 or code: the code in the bottom pane

Usage examples

Without naming parameters:

Some text

{{hbc-hl|python|script.py|
def quick_sort(arr):
	less = []}}

text continues.

With full parameter names:

Some text

{{hbc-hl|lang=python|head=script.py|code=
def quick_sort(arr):
	less = []}}

text continues.

Result

Some text

script.py
def quick_sort(arr):
	less = []

text continues.

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.