Difference between revisions of "Code highlighting"

From Second Life Wiki
Jump to navigation Jump to search
Line 1: Line 1:
{{TOCright}}
== wiki.secondlife.com ==
== wiki.secondlife.com ==


Line 30: Line 31:
When creating a post, from the editing toolbar, choose '''>>''' > '''Syntax Highlighting''' > '''Plain'''.
When creating a post, from the editing toolbar, choose '''>>''' > '''Syntax Highlighting''' > '''Plain'''.


This doesn't colorize code but it does isolate it and preserve line breaks.
[[File:Syntax_Highlighting_-_Plain.png]]
 
This doesn't colorize code but it does isolate it and preserves line breaks.

Revision as of 09:20, 3 May 2010

wiki.secondlife.com

If you're creating pages on this wiki using code examples, it's highly useful to embed the code between tags that retain formatting and other desirable attributes. Tags can also colorize syntax.

This is basically done by enclosing the code within the HTML tags. (See the Examples pages below.)

Tags

These tags are actively being used.

  • <tt> - Fixed-width text. Used in general-purpose scenarios, and when others are too restricting for whatever reason.
  • <lsl> - Widely used on the LSL Portal and other scripts that appear on-wiki.
  • <htmlstrict4> - Use it when you need to highlight HTML code snippets, such as for use with Shared Media.
  • <code> - Used not just for simpler, single-line code, but user input that needs highlighting, as described in the Knowledge Base Style Guide.

For more tags, see the Parser extension tags on Special:Version. Some tags are possible because of GeSHiHighlight.

Examples

These pages use code highlighting tags extensively.

  • Category:LSL Library - Click a script to see how it appears with the <lsl> tag.
  • Shared Media LSL Recipes - Becky Pippen mentioned a limitation of the <lsl> tags: namely, you seemingly can't highlight code inside, so she's using <tt> instead.
  • Shared Media wrapper - Torley Linden learned from Khepri Contractor that the <html4strict> tag works.

blogs.secondlife.com

While not as precise as the wiki, code can be called out on the forums and blogs, too. This is especially useful in the Scripting and Scripting Library forums where LSL scripts are shared.

When creating a post, from the editing toolbar, choose >> > Syntax Highlighting > Plain.

Syntax Highlighting - Plain.png

This doesn't colorize code but it does isolate it and preserves line breaks.