View Tutorial Metadata Edit Content Revision History Add to Watchlist Add New Tutorial Tutorialpedia Code Function

`code() Function

Pre-requisites

The Tutorialpedia section is part of the Tutorialpedia Syntax, helping you edit articles: How to understand the Tutorialpedia Syntax

What is it for?

The `code() function allows you to include source code examples inside the tutorials on Tutorialpedia, supporting syntax highlighting for an increasing number of languages.

Examples

Including a single line of code:

`code(language:'php' version:'5.2')
 print 'Hello World!';

This will display:

print 'Hello World!';

It's also possible to include more than one line, using the Escaping in CodePax tutorial syntax .

Parameters

language

Specifies the language. It must be lowercase. CodePax Code Function Supported Languages

version

Specifies the language version.

nowrap

By default, the code is wrapped to 80 characters width. If the line is longer than 80 characters, a newline character is added before the last word. Sometimes you need to display code which is wider than 80 characters. In this case, add the following parameter to the `code() call:

nowrap:'1'

Only plain text supported.

Optional

Required - will be kept private

Optional

 
 

Rating: (0+, 0-) In: Tutorialpedia