Character Vault
Any Concept / Any System
Compendium
Your System Come To Life
Roll20 for Android
Streamlined for your Tablet
Roll20 for iPad
Streamlined for your Tablet

Personal tools

Difference between revisions of "Template:Code/doc"

From Roll20 Wiki

Jump to: navigation, search
(Created page with "{{documentation subpage|override=code/doc|Code}} Shorthand to more easily write code on the wiki. '''Example:''' {{code|/r d20+4}} <pre> {{code|/r d20+4}} </pre> <includ...")
 
(mention template limitations)
(7 intermediate revisions by one user not shown)
Line 1: Line 1:
 
{{documentation subpage|override=code/doc|Code}}
 
{{documentation subpage|override=code/doc|Code}}
  
Shorthand to more easily write code on the wiki.
+
{{tlx|ccode}} is a shorthand to more easily write inline code and highlight variables on the wiki. {{tlx|c}} is an even smaller shorthand. For more complex content you'll still likely need to use <code><nowiki>&#60;code&#62;</nowiki></code>+<code><nowiki>&#60;nowiki&#62;</nowiki></code>-elements, as some special characters causes problem with the template that doesn't happen when using <code><nowiki>&#60;code&#62;</nowiki></code>+<code><nowiki>&#60;nowiki&#62;</nowiki></code>.
  
'''Example:'''
+
See: [[Help:Contents#Displaying_Macros_and_Code|Displaying Macros and Code]] for details.
  
{{code|/r d20+4}}
+
'''Example 1.'''
  
<pre>
+
any words before {{code|/r 1d6+4}}, or words, {{code|/roll 1d6+4}}
{{code|/r d20+4}}  
+
</pre>
+
  
<includeonly>[[Category:Regular Grammar Templates]]</includeonly>
+
<pre>any words before {{code|/r 1d6+4}}, or words, {{code|/roll 1d6+4}}</pre>
 +
 
 +
'''Example 2.'''
 +
 
 +
You can even write code that include problematic elements that the wiki could mistake for wiki syntax, such as {{code|{{title=@{character_name} }}}} without the need of using nowiki element the code block. However, wiki links would still show up so nowiki is needed if inline rolls are present: {{code|<nowiki>Inline roll [[1d6+4]] would usually turn into a wiki link</nowiki> }}
 +
 
 +
<pre data-language="bash"  style="white-space: pre-wrap;">
 +
You can even write code that include problematic elements that the wiki could mistake for wiki syntax, such as {{code|{{title=@{character_name} }}}} without the need of using nowiki element the code block. However, wiki links would still show up so nowiki is needed if inline rolls are present: {{code|<nowiki>Inline roll [[1d6+4]] would usually turn into a wiki link</nowiki> }}</pre>
 +
 
 +
{{ex}}
 +
{{code|<input type="text" name="attr_class" value="fighter" >}}

Revision as of 07:40, 9 June 2024

{{ccode}} is a shorthand to more easily write inline code and highlight variables on the wiki. {{c}} is an even smaller shorthand. For more complex content you'll still likely need to use <code>+<nowiki>-elements, as some special characters causes problem with the template that doesn't happen when using <code>+<nowiki>.

See: Displaying Macros and Code for details.

Example 1.

any words before /r 1d6+4, or words, /roll 1d6+4

any words before {{code|/r 1d6+4}}, or words, {{code|/roll 1d6+4}}

Example 2.

You can even write code that include problematic elements that the wiki could mistake for wiki syntax, such as {{title=@{character_name} }} without the need of using nowiki element the code block. However, wiki links would still show up so nowiki is needed if inline rolls are present: Inline roll [[1d6+4]] would usually turn into a wiki link

You can even write code that include problematic elements that the wiki could mistake for wiki syntax, such as {{code|{{title=@{character_name} }}}} without the need of using nowiki element the code block. However, wiki links would still show up so nowiki is needed if inline rolls are present: {{code|Inline roll [[1d6+4]] would usually turn into a wiki link }}


Example:

{{{1}}}