Template:Hbc-hl: Difference between revisions
(Add todo note) |
(Comment out the templatestyles tag. Need to undo this change after TemplateStyles extension is installed.) |
||
Line 1: | Line 1: | ||
<templatestyles src="Template:Hc-hl/styles.css" /><noinclude>{{DISPLAYTITLE:Template:hc-hl}} | <!--templatestyles src="Template:Hc-hl/styles.css" /--><noinclude>{{DISPLAYTITLE:Template:hc-hl}} | ||
{{Template}} | {{Template}} | ||
Line 32: | Line 32: | ||
Waiting for TemplateStyles extension to be installed: https://bugs.kde.org/show_bug.cgi?id=474964 | 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''. | 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. | |||
</noinclude><includeonly>{{#tag:pre|{{{head|{{{2|{{META Error}}}}}}}}|style="margin-bottom: 0; border-bottom:none; padding-bottom:0.8em;"}}<!-- The line break is needed, otherwise the wiki will generate extraneous paragraphs inside the 2nd pre block --> | </noinclude><includeonly>{{#tag:pre|{{{head|{{{2|{{META Error}}}}}}}}|style="margin-bottom: 0; border-bottom:none; padding-bottom:0.8em;"}}<!-- The line break is needed, otherwise the wiki will generate extraneous paragraphs inside the 2nd pre block --> |
Revision as of 07:28, 28 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.
- Use Template:hc for block code with header without highlighted sintax.
- Use Template:bc for block code without header.
- Use Template:ic for inline code.
Usage
1
orlang
: the language of code block, to apply highlighting2
orhead
: the code in the top pane3
oroutput
: the code in the bottom pane
{{hc-hl|lang=python|script.py| def quick_sort(arr): less = []}}
{{hc-hl|python|head=script.py|output=output= def quick_sort(arr): less = []}}
See here for supported values for lang
.
Example
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.