Template:Codeblock: Difference between revisions
Jump to navigation
Jump to search
reformatted! looks acceptable now. examples! |
m reformat (forgot lines being temp green) |
||
| Line 2: | Line 2: | ||
<onlyinclude><!-- | <onlyinclude><!-- | ||
--><div style="overflow:hidden;background-color:{{#switch:{{{style|}}}|1=rgba(241, 233, 203, 1)|rgba(241, 233, 203, 1)}};{{#switch:{{{style|}}}|1=border:1px solid rgba(48,48,48,1);|}}border-radius:4px; font-family:monospace,monospace; color: black; line-height:1. | --><div style="max-width:{{{width|unset}}}; overflow:hidden;background-color:{{#switch:{{{style|}}}|1=rgba(241, 233, 203, 1)|rgba(241, 233, 203, 1)}};{{#switch:{{{style|}}}|1=border:1px solid rgba(48,48,48,1);|}}border-radius:4px; font-family:monospace,monospace; color: black; line-height:1.52rem<!--lines-->; text-indent:0; white-space:pre-wrap; margin: {{{margin|.3em 0 .3em 0}}}"><!-- | ||
-->{{#if:{{{src|{{{lang|}}}}}}|<div style="display:flex;justify-content:space-between;background-color:rgba(88, 58, 49, 1); border-bottom:1px solid rgba( | -->{{#if:{{{src|{{{lang|}}}}}}|<div style="max-width:{{{width|unset}}}; display:flex;justify-content:space-between;background-color:rgba(88, 58, 49, 1); | ||
border-bottom:1px solid rgba(164, 145, 126, 1); font-family:monospace,monospace; color: white; line-height:1.125rem<!--header-->; text-indent:0; white-space:pre-wrap; padding:.5em"><!-- | |||
--><!-- | --><!-- | ||
--><div>{{{src|The source was not specified}}}</div><!-- | --><div>{{{src|The source was not specified}}}</div><!-- | ||
| Line 12: | Line 13: | ||
--><div style="width:100%"><!-- | --><div style="width:100%"><!-- | ||
--><div style="scrollbar-color:#f1e9cb #583a31; position:relative;width:100%;display:flex;max-height:{{{height|unset}}};overflow:auto"><!-- | --><div style="scrollbar-color:#f1e9cb #583a31; position:relative;width:100%;display:flex;max-height:{{{height|unset}}};overflow:auto"><!-- | ||
-->{{#if:{{{lines|}}}|<div style="z-index:1;display:flex;position:sticky;left:0;height:100%;padding:.45em .5em;color: white;background-color:{{#switch:{{{style|}}}|1=rgb( | -->{{#if:{{{lines|}}}|<div style="z-index:1;display:flex;position:sticky;left:0;height:100%;padding:.45em .5em;color: white;background-color:{{#switch:{{{style|}}}|1=rgb(88, 58, 49)|rgb(88, 58, 49);}};border-right:1px solid rgb(48,48,48)"><!-- | ||
--><ol start="{{{start|1}}}" style="text-align:right;pointer-events:none;white-space:nowrap;list-style-position:inside;margin-left:8px;margin-top:0;user-select:none;margin-right:-10px;text-indent:0"><!-- | --><ol start="{{{start|1}}}" style="text-align:right;pointer-events:none;white-space:nowrap;list-style-position:inside;margin-left:8px;margin-top:0;user-select:none;margin-right:-10px;text-indent:0"><!-- | ||
-->{{padright:|{{#expr:5 * {{{lines}}}}}|<li> }}{{#ifexpr:{{{lines}}} > 100<!-- | -->{{padright:|{{#expr:5 * {{{lines}}}}}|<li> }}{{#ifexpr:{{{lines}}} > 100<!-- | ||
| Line 45: | Line 46: | ||
</includeonly> | </includeonly> | ||
== Documentation == | |||
Just go to Valve Dev Community for their documentation, only difference is formatting (styling). | |||
Link: [https://developer.valvesoftware.com/w/index.php?title=Template:Code VDC Code Documentation] | |||
== Examples == | == Examples == | ||
=== With header === | |||
{{codeblock| | {{codeblock| | ||
lang=txt (file type)| | lang=txt (file type)| | ||
| Line 61: | Line 66: | ||
}} | }} | ||
=== Without header === | |||
{{codeblock| | {{codeblock| | ||
<nowiki>(code) | <nowiki>(code) | ||
| Line 69: | Line 74: | ||
</nowiki> | </nowiki> | ||
}} | }} | ||
=== With lines enabled + Locked Height/Width === | |||
'''Note''':It is not fully aligned and may break with lots of lines. Fast scrolling also breaks alignment but will refix. | |||
{{codeblock| | {{codeblock| | ||
lines=16| | lines=16| | ||
height= | height=250px| <!--cannot be percentage--> | ||
|<nowiki>A1 | width=25%| | ||
<nowiki>A1 | |||
B2 | B2 | ||
C3 | C3 | ||
D4 | D4 | ||
Start of Long Line ----------------- End of Long Line | |||
You can also leave gaps | |||
9 | |||
10 | |||
11 | |||
12 | |||
13 | |||
14 | |||
15 | |||
16</nowiki>}} | |||
[[Category:Layout templates]] | |||
Revision as of 22:41, 17 August 2025
Documentation
Just go to Valve Dev Community for their documentation, only difference is formatting (styling). Link: VDC Code Documentation
Examples
With header
Without header
With lines enabled + Locked Height/Width
Note:It is not fully aligned and may break with lots of lines. Fast scrolling also breaks alignment but will refix.