More actions
Created page with "<includeonly> <div class="mw-collapsible mw-collapsed" style="font-family: monospace;"> {{{1|}}} </div> </includeonly> <noinclude> A simple template to add a collapsible (and by default collapsed) bit of code to a wiki page {{CollapsibleCode|This is some test code text. It can have multiple lines and they should show up correctly.}} </noinclude>" |
No edit summary |
||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<includeonly> | <includeonly> | ||
<div class="mw-collapsible mw-collapsed" style="font-family: monospace;"> | <templatestyles src="Template:CollapsibleCode/styles.css"/> | ||
{{{1|}}} | <div id="collapsible-container" class="mw-collapsible {{#ifeq:{{{collapsed|true}}}|true|mw-collapsed}}" style="width: {{{width|100%}}};"> | ||
<div id="collapsible-container-header"><i class="fa-solid fa-chevron-down"></i><i class="fa-solid fa-chevron-up"></i> {{{heading|Code}}}</div> | |||
<div class="mw-collapsible-content" style="font-family: monospace;"> | |||
{{{code|{{{1|}}}}}} | |||
</div> | |||
</div> | </div> | ||
</includeonly> | </includeonly> | ||
Line 7: | Line 11: | ||
A simple template to add a collapsible (and by default collapsed) bit of code to a wiki page | A simple template to add a collapsible (and by default collapsed) bit of code to a wiki page | ||
{{CollapsibleCode|This is some test code text. | {{CollapsibleCode|heading=Something|This is some test code text.<br> | ||
It can have multiple lines | It can have multiple lines<br> | ||
and they should show up correctly.}} | and they should show up correctly.}} | ||
<templatedata> | |||
{ | |||
"params": { | |||
"collapsed": { | |||
"description": "Whether or not it is collapsed by default", | |||
"type": "boolean", | |||
"default": "true" | |||
}, | |||
"width": { | |||
"description": "The width of the entire code box", | |||
"type": "string", | |||
"default": "100%" | |||
}, | |||
"heading": { | |||
"description": "The heading/headline for the code box", | |||
"type": "string", | |||
"default": "Code" | |||
}, | |||
"code": { | |||
"description": "The actual content of the box. This can also be supplied as a unnamed parameter", | |||
"type": "content", | |||
"required": true | |||
} | |||
}, | |||
"format": "inline" | |||
} | |||
</templatedata> | |||
</noinclude> | </noinclude> |
Latest revision as of 00:56, 25 December 2024
A simple template to add a collapsible (and by default collapsed) bit of code to a wiki page
Something
This is some test code text.
It can have multiple lines
and they should show up correctly.
No description.
Parameter | Description | Type | Status | |
---|---|---|---|---|
collapsed | collapsed | Whether or not it is collapsed by default
| Boolean | optional |
width | width | The width of the entire code box
| String | optional |
heading | heading | The heading/headline for the code box
| String | optional |
code | code | The actual content of the box. This can also be supplied as a unnamed parameter | Content | required |