Difference between revisions of "Template:Admonition"

From ThresholdRPG Wiki
(Created page with "<includeonly>{{#switch: {{{type|note}}} | note = {{#vardefine: icon|πŸ“}}{{#vardefine: color|#448aff}}{{#vardefine: title|Note}} | warning = {{#vardefine: icon|⚠️}}{{...")
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
βˆ’
<includeonly>{{#switch: {{{type|note}}}
+
<includeonly>
βˆ’
  | note = {{#vardefine: icon|πŸ“}}{{#vardefine: color|#448aff}}{{#vardefine: title|Note}}
+
<div style="border-left: 4px solid {{#switch: {{{type|note}}}|note=#448aff|warning=#ff9100|tip=#00bfa5|important=#ff1744|stop=#ff0000|#default=#448aff}}; background: #444444; margin: 1em 0; border-radius: 3px; width: {{{width|100%}}};">
βˆ’
  | warning = {{#vardefine: icon|⚠️}}{{#vardefine: color|#ff9100}}{{#vardefine: title|Warning}}
+
<div style="background: {{#switch: {{{type|note}}}|note=#448aff33|warning=#ff910033|tip=#00bfa533|important=#ff174433|stop=#ff000033|#default=#448aff33}}; padding: 8px 12px; font-weight: bold; color: #ffffff;">{{#switch: {{{type|note}}}|note=πŸ“|warning=⚠️|tip=πŸ’‘|important=❗|stop=πŸ›‘|#default=πŸ“}} {{{title|{{#switch: {{{type|note}}}|note=Note|warning=Warning|tip=Tip|important=Important|stop=STOP|#default=Note}}}}}
βˆ’
  | tip = {{#vardefine: icon|πŸ’‘}}{{#vardefine: color|#00bfa5}}{{#vardefine: title|Tip}}
+
</div>
βˆ’
  | important = {{#vardefine: icon|❗}}{{#vardefine: color|#ff1744}}{{#vardefine: title|Important}}
+
<div style="padding: 12px; color: #ffffff;">{{{1}}}</div>
βˆ’
  | info = {{#vardefine: icon|ℹ️}}{{#vardefine: color|#2196f3}}{{#vardefine: title|Info}}
+
</div>
βˆ’
  | question = {{#vardefine: icon|❓}}{{#vardefine: color|#9c27b0}}{{#vardefine: title|Question}}
 
βˆ’
  | caution = {{#vardefine: icon|🚧}}{{#vardefine: color|#ff5722}}{{#vardefine: title|Caution}}
 
βˆ’
}}
 
βˆ’
{| style="margin: 1.5em 0; padding: 0; border-left: 4px solid {{#var: color}}; background-color: #f8f9fa; width: 100%;"
 
βˆ’
! style="padding: 8px 12px; background-color: {{#var: color}}15; font-weight: bold;" | {{#var: icon}} {{{title|{{#var: title}}}}}
 
βˆ’
|-
 
βˆ’
| style="padding: 12px;" | {{{1}}}
 
βˆ’
|}
 
 
</includeonly>
 
</includeonly>
 
<noinclude>
 
<noinclude>
 
== Usage ==
 
== Usage ==
βˆ’
This template creates admonition boxes (highlighted message boxes) with different styles based on type.
+
Create admonition boxes with different styles.
  
βˆ’
=== Syntax ===
+
=== Basic Usage ===
βˆ’
<pre>
+
<nowiki>
βˆ’
{{Admonition|type=TYPE|text}}
+
{{Admonition|Your message here}}
βˆ’
</pre>
+
</nowiki>
βˆ’
or
 
βˆ’
<pre>
 
βˆ’
{{Admonition|type=TYPE|title=CUSTOM TITLE|text}}
 
βˆ’
</pre>
 
  
βˆ’
=== Available Types ===
+
=== With Type ===
βˆ’
* note (default) - For general information
+
<nowiki>
βˆ’
* warning - For warning messages
+
{{Admonition|type=warning|Your warning message}}
βˆ’
* tip - For helpful tips
+
</nowiki>
βˆ’
* important - For crucial information
 
βˆ’
* info - For additional information
 
βˆ’
* question - For questions or FAQs
 
βˆ’
* caution - For careful consideration
 
  
βˆ’
=== Examples ===
+
=== With Custom Title ===
 
<nowiki>
 
<nowiki>
βˆ’
{{Admonition|This is a default note.}}
+
{{Admonition|type=tip|title=Pro Tip!|Your tip message}}
 +
</nowiki>
  
βˆ’
{{Admonition|type=warning|This is a warning message.}}
+
=== With Custom Width ===
 +
<nowiki>
 +
{{Admonition|width=50%|Your message here}}
 +
{{Admonition|type=warning|width=75%|Your warning message}}
 +
</nowiki>
  
βˆ’
{{Admonition|type=tip|title=Pro Tip!|This is a custom-titled tip.}}
+
=== Types Available ===
 +
* note (default) - For general information
 +
* warning - For cautionary notes
 +
* tip - For helpful tips
 +
* important - For crucial information
 +
* stop - For breaking changes or critical warnings
  
βˆ’
{{Admonition|type=important|This is important information.}}
+
=== Parameters ===
 +
* type - The type of admonition (optional, defaults to "note")
 +
* title - Custom title (optional, defaults based on type)
 +
* width - Custom width (optional, defaults to "100%")
 +
* message - The main content (required)
  
βˆ’
{{Admonition|type=info|This is additional information.}}
+
=== Live Examples ===
 +
{{Admonition|This is a default note at full width.}}
  
βˆ’
{{Admonition|type=question|Have you considered this?}}
+
{{Admonition|width=50%|This is a note at 50% width.}}
  
βˆ’
{{Admonition|type=caution|Proceed with caution.}}
+
{{Admonition|type=warning|width=75%|This is a warning message at 75% width.}}
βˆ’
</nowiki>
 
  
βˆ’
=== Live Examples ===
+
{{Admonition|type=tip|title=Pro Tip!|This is a custom-titled tip.}}
βˆ’
{{Admonition|This is a default note.}}
 
  
βˆ’
{{Admonition|type=warning|This is a warning message.}}
+
{{Admonition|type=stop|width=60%|This feature is being removed in the next version. Do not use it for new development.}}
βˆ’
 
 
βˆ’
{{Admonition|type=tip|title=Pro Tip!|This is a custom-titled tip.}}
 
 
</noinclude>
 
</noinclude>

Latest revision as of 19:24, 6 February 2025


Usage

Create admonition boxes with different styles.

Basic Usage

{{Admonition|Your message here}}

With Type

{{Admonition|type=warning|Your warning message}}

With Custom Title

{{Admonition|type=tip|title=Pro Tip!|Your tip message}}

With Custom Width

{{Admonition|width=50%|Your message here}} {{Admonition|type=warning|width=75%|Your warning message}}

Types Available

  • note (default) - For general information
  • warning - For cautionary notes
  • tip - For helpful tips
  • important - For crucial information
  • stop - For breaking changes or critical warnings

Parameters

  • type - The type of admonition (optional, defaults to "note")
  • title - Custom title (optional, defaults based on type)
  • width - Custom width (optional, defaults to "100%")
  • message - The main content (required)

Live Examples

πŸ“ Note
This is a default note at full width.



πŸ“ Note
This is a note at 50% width.



⚠️ Warning
This is a warning message at 75% width.



πŸ’‘ Pro Tip!
This is a custom-titled tip.



πŸ›‘ STOP
This feature is being removed in the next version. Do not use it for new development.