Template:Hbc-hl: Difference between revisions
m (Fix hbc template name) |
(Remove unneeded comment, it is not true what it says) |
||
Line 44: | Line 44: | ||
After that, template should work normally. | After that, template should work normally. | ||
</noinclude><includeonly>{{#tag:pre|{{{head|{{{2|{{META Error}}}}}}}}|style="margin-bottom: 0; border-bottom:none; padding-bottom:0.8em;"}} | </noinclude><includeonly>{{#tag:pre|{{{head|{{{2|{{META Error}}}}}}}}|style="margin-bottom: 0; border-bottom:none; padding-bottom:0.8em;"}} | ||
{{#tag:syntaxhighlight| | {{#tag:syntaxhighlight| | ||
{{{code|{{{3|{{META Error}}}}}}}} | {{{code|{{{3|{{META Error}}}}}}}} | ||
|lang="{{{lang|{{{1|{{META Error}}}}}}}}"|style="margin-bottom: 0; border-bottom:none; padding-bottom:0.8em;"}}</includeonly> | |lang="{{{lang|{{{1|{{META Error}}}}}}}}"|style="margin-bottom: 0; border-bottom:none; padding-bottom:0.8em;"}}</includeonly> |
Revision as of 23:15, 1 October 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.
- Use Template:hbc for block code with header without highlighted syntax.
- Use Template:bc for block code without header.
- Use Template:ic for inline code.
Parameters
1
orlang
: the language of code block2
orhead
: the code in the top pane3
orcode
: the code in the bottom pane
Usage examples
With full parameter names:
{{hbc-hl|lang=python|head=script.py|code= def quick_sort(arr): less = []}}
Without naming parameters:
{{hbc-hl|python|script.py| def quick_sort(arr): less = []}}
Result
script.py
def quick_sort(arr):
less = []
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:hbc-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.