Template:Codeblock: Difference between revisions

From TF2 Classified Wiki
Jump to navigation Jump to search
NinjaV (talk | contribs)
reformatted! looks acceptable now. examples!
NinjaV (talk | contribs)
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.5rem<!--lines-->; text-indent:0; white-space:pre-wrap; margin: {{{margin|.3em 0 .3em 0}}}"><!--
         --><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(0,255,0,.1); font-family:monospace,monospace; color: white; line-height:1.125rem<!--header-->; text-indent:0; white-space:pre-wrap; padding:.5em"><!--
             -->{{#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(0,0,255)|rgb(0, 255, 0)}};border-right:1px solid rgb(48,48,48)"><!--
                     -->{{#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
=== With header ===
{{codeblock|
{{codeblock|
lang=txt (file type)|
lang=txt (file type)|
Line 61: Line 66:
}}
}}


without header
=== Without header ===
{{codeblock|
{{codeblock|
<nowiki>(code)
<nowiki>(code)
Line 69: Line 74:
</nowiki>
</nowiki>
}}
}}
The line code is partially broke and isnt aligned fully
=== 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| <!--amount of number lines-->
lines=16|  
height=100px <!--height of it, if list is longer, scroll appears. Ignore to make it fully expand-->
height=250px| <!--cannot be percentage-->
|<nowiki>A1
width=25%|
<nowiki>A1
B2
B2
C3
C3
D4
D4
E5
Start of Long Line ----------------- End of Long Line
F6
 
G7
 
H8
You can also leave gaps
I9
9
J10
10
K11
11
L12
12
M13
13
N14
14
O15
15
P16</nowiki>}}
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

tf2classic/scripts/items/items_game.txt (directory)
txt (file type)
(code) This is a test! "Beep Boop!" - Soldier ''no italics'' - - - '''no bold''' <nowiki> tag makes formatting no format for code stuff!

yes italics - - - yes bold

Codey code code

Without header

(code) Hello, world! I'm headerless :( ''"blah blah blah"''

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.

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
A1 B2 C3 D4 Start of Long Line ----------------- End of Long Line You can also leave gaps 9 10 11 12 13 14 15 16