Template:CodeBlock: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
|  (removed empty span) | m (fixed width with src/lang) | ||
| (30 intermediate revisions by 6 users not shown) | |||
| Line 1: | Line 1: | ||
| See Also: [[Template:Code]] | |||
| {{Doc}} | |||
| <includeonly> | |||
| <onlyinclude><!-- | |||
|          --><div style="max-width:{{{width|unset}}}; overflow:hidden;background-color:{{#switch:{{{style|}}}|1=rgba(0,0,0,.1)|rgba(0,0,0,.4)}};{{#switch:{{{style|}}}|1=border:1px solid rgba(48,48,48,1);|}}border-radius:4px; font-family:monospace,monospace; line-height:1.125rem; text-indent:0; white-space:pre-wrap; margin: {{{margin|.3em 0 .3em 0}}}"><!-- | |||
|              -->{{#if:{{{src|{{{lang|}}}}}}|<div style="width=100%; display:flex;justify-content:space-between;background-color:rgba(0,0,0,.1); border-bottom:1px solid rgba(255,255,255,.1); font-family:monospace,monospace;line-height:1.125rem; text-indent:0; white-space:pre-wrap; padding:.5em"><!-- | |||
|          --><div style="overflow:hidden;background-color:{{#switch:{{{style|}}}|1=rgba(0,0,0,.1)|rgba(0,0,0,. | |||
|              -->{{#if:{{{src|{{{lang|}}}}}}|<div style="display:flex;justify-content:space-between;background-color:rgba(0,0,0,.1); border-bottom:1px solid rgba(255,255,255,.1); font-family:monospace,monospace;line-height:1.125rem; text-indent:0; white-space:pre-wrap; padding:.5em"><!-- | |||
| --><!-- | --><!-- | ||
|                  --><div>{{{src|The source was not specified}}} |                  --><div>{{{src|The source was not specified}}}</div><!-- | ||
|                  -->{{#if:{{{lang|}}}|<div>{{#switch:{{{lang}}}|plain=Plain |                  -->{{#if:{{{lang|}}}|<div>{{#switch:{{{lang}}}|plain=Plain text|html=HTML|css=CSS|scss=SCSS|less=LESS|js=JavaScript|json=JSON|php=PHP|c=C|csharp=C#|cpp=C++|pascal=Pascal|python=Python|java=Java|squirrel=Squirrel|lua=Lua|glua=gLua|fgd=Forge Game Data|{{{lang}}}}}</div>}}<!-- | ||
| --><!-- | --><!-- | ||
|              --></div>}}<!-- |              --></div>}}<!-- | ||
| --><!-- | --><!-- | ||
|              --><div style="width:100%"><!-- |              --><div style="width:100%"><!-- | ||
|                  --><div style="position:relative;width:100%;display:flex;max-height:{{{height|unset}}};overflow:auto"><!-- |                  --><div style="scrollbar-color:#373737 #101010; 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:.5em 0 .4em 0;background-color:{{#switch:{{{style|}}}|1=rgb(31,31,31)|rgb(24,24,24)}};border-right:1px solid rgb(48,48,48)"><!-- |                      -->{{#if:{{{lines|}}}|<div style="z-index:1;display:flex;position:sticky;left:0;height:100%;padding:.5em 0 .4em 0;background-color:{{#switch:{{{style|}}}|1=rgb(31,31,31)|rgb(24,24,24)}};border-right:1px solid rgb(48,48,48)"><!-- | ||
|                          --><ol start="{{{start|1}}}"  |                          --><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<!-- | ||
|                                  -->|{{padright:|{{#expr:5 * ({{{lines}}} - 100)}}|<!-- |                                  -->|{{padright:|{{#expr:5 * ({{{lines}}} - 100)}}|<!-- | ||
| Line 42: | Line 38: | ||
|                              --><div style="width:100%;background:rgba(255,128,0,0.1);margin-top:calc((1.6em * ({{{lightstart4|4}}} - 1)) + .45em);margin-bottom:.45em;height:calc(1.6em * {{{lightamount4|1}}});position:absolute;left:0;user-select:none;pointer-events:none"><!-- |                              --><div style="width:100%;background:rgba(255,128,0,0.1);margin-top:calc((1.6em * ({{{lightstart4|4}}} - 1)) + .45em);margin-bottom:.45em;height:calc(1.6em * {{{lightamount4|1}}});position:absolute;left:0;user-select:none;pointer-events:none"><!-- | ||
|                              --></div><!-- |                              --></div><!-- | ||
|                          --></div>}}<div style="padding:.45em .5em;position:relative">{{{1|}}}</div><!-- |                          --></div>}}<div style="padding:.45em .5em;position:relative">{{#if:{{{highlight|}}}|{{#tag:syntaxhighlight|{{{1|}}}|lang={{{highlight}}}|inline=1|style="background-color:transparent;"}}|{{{1|}}}}}</div><!-- | ||
|                      --></div><!-- |                      --></div><!-- | ||
| --><!-- | --><!-- | ||
| Line 48: | Line 44: | ||
|              --></div><!-- |              --></div><!-- | ||
| --><!-- | --><!-- | ||
|          --></div |          --></div></onlyinclude> | ||
| </includeonly> | |||
| [[Category:Formatting templates]] | |||
Latest revision as of 16:21, 17 August 2025
See Also: Template:Code
The above documentation is transcluded from Template:CodeBlock/doc. (Edit | Page history)
Editors can experiment in this template's sandbox (edit) and testcases (create) pages.
Editors can experiment in this template's sandbox (edit) and testcases (create) pages.
























 Available doc translations
 Available doc translations 
 
  
  
  
 
