Jump to content

Template:Hbc-hl: Difference between revisions

From KDE Community Wiki
Ashark (talk | contribs)
Fix to actually use hc-hl
Ashark (talk | contribs)
Do not use quotes in template parameter value
Line 14: Line 14:
* {{ic|3}} or {{ic|output}}: the code in the bottom pane
* {{ic|3}} or {{ic|output}}: the code in the bottom pane


  <nowiki>{{hc-hl|lang="c++"|main.h|#include <stdio.h>}}</nowiki>
  <nowiki>{{hc-hl|lang=c++|main.h|#include <stdio.h>}}</nowiki>


  <nowiki>{{hc-hl|c++|head=main.h|output=#include <stdio.h>}}</nowiki>
  <nowiki>{{hc-hl|c++|head=main.h|output=#include <stdio.h>}}</nowiki>
Line 22: Line 22:
== Example ==
== Example ==


{{hc-hl|lang="c++"|head=main.h|output=#include <stdio.h>}}</noinclude><includeonly><pre<noinclude></noinclude> style="margin-bottom: 0; border-bottom:none; padding-bottom:0.8em;">{{{head|{{{2|{{META Error}}}}}}}}</pre<noinclude></noinclude>><!-- The line break is needed, otherwise the wiki will generate extraneous paragraphs inside the 2nd pre block -->
{{hc-hl|lang=c++|head=main.h|output=#include <stdio.h>}}</noinclude><includeonly><pre<noinclude></noinclude> style="margin-bottom: 0; border-bottom:none; padding-bottom:0.8em;">{{{head|{{{2|{{META Error}}}}}}}}</pre<noinclude></noinclude>><!-- The line break is needed, otherwise the wiki will generate extraneous paragraphs inside the 2nd pre block -->
<syntaxhighlight<noinclude></noinclude> lang="{{{lang|{{{1|{{META Error}}}}}}}}" style="margin-top: 0; border-top-style:dashed; padding-top: 0.8em;">{{{output|{{{3|{{META Error}}}}}}}}</syntaxhighlight<noinclude></noinclude>></includeonly><noinclude><!-- The &lt;noinclude>&lt;/noinclude> hack is needed to allow wiki markup inside the pre tags; reference: http://www.gossamer-threads.com/lists/wiki/mediawiki/118688#118688 --></noinclude>
<syntaxhighlight<noinclude></noinclude> lang="{{{lang|{{{1|{{META Error}}}}}}}}" style="margin-top: 0; border-top-style:dashed; padding-top: 0.8em;">{{{output|{{{3|{{META Error}}}}}}}}</syntaxhighlight<noinclude></noinclude>></includeonly><noinclude><!-- The &lt;noinclude>&lt;/noinclude> hack is needed to allow wiki markup inside the pre tags; reference: http://www.gossamer-threads.com/lists/wiki/mediawiki/118688#118688 --></noinclude>

Revision as of 01:12, 28 September 2023

Page Template:Hc-hl/styles.css has no content.

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 output: the code in the bottom pane
{{hc-hl|lang=c++|main.h|#include <stdio.h>}}
{{hc-hl|c++|head=main.h|output=#include <stdio.h>}}

See here for supported values for lang.

Example

Template:Hc-hl