This library contains functions for highlighting syntax of popular programming languages. 関連リンク: Extension Overview, DekiScript Overview, Extension Demos.
Assembly: mindtouch.deki.services
SID: http://services.mindtouch.com/deki/d...2007/06/syntax
This extension is based on the work done by Alex Gorbatchev on the syntaxhighlighter project.
Functions:
- syntax.cpp
- syntax.csharp
- syntax.css
- syntax.delphi
- syntax.html
- syntax.java
- syntax.javascript
- syntax.php
- syntax.python
- syntax.ruby
- syntax.sql
- syntax.vb
- syntax.xml
syntax.cpp(code : str, collapse : bool, firstline : num) : xml
Highlight C/C++ syntax.
Parameters:
| Name | Type | Description |
code
| str
| Source code to highlight. |
collapse
| bool
| Optional. Collapse code view (default: false) |
firstline
| num
| Optional. First line number (default: 1) |
Samples:
| Output |
| To embed highlighted C/C++:
#include <iostream.h>
main()
{
cout << "Hello World!" << endl;
return 0;
}
|  |
syntax.csharp(code : str, collapse : bool, firstline : num) : xml
Highlight C# syntax.
Parameters:
| Name | Type | Description |
code
| str
| Source code to highlight. |
collapse
| bool
| Optional. Collapse code view (default: false) |
firstline
| num
| Optional. First line number (default: 1) |
Samples:
| Output |
| To embed highlighted C#:
using System;
class HelloWorld
{
public static int Main(String[] args)
{
Console.WriteLine("Hello, World!");
return 0;
}
}
|  |
syntax.css(code : str, collapse : bool, firstline : num) : xml
Highlight CSS syntax.
Parameters:
| Name | Type | Description |
code
| str
| Source code to highlight. |
collapse
| bool
| Optional. Collapse code view (default: false) |
firstline
| num
| Optional. First line number (default: 1) |
Samples:
| Output |
| To embed highlighted CSS:
body:before {
content: "Hello World!";
}
|  |
syntax.delphi(code : str, collapse : bool, firstline : num) : xml
Highlight Delphi syntax.
Parameters:
| Name | Type | Description |
code
| str
| Source code to highlight. |
collapse
| bool
| Optional. Collapse code view (default: false) |
firstline
| num
| Optional. First line number (default: 1) |
Samples:
| Output |
| To embed highlighted Delphi:
Program Hello_World;
{$APPTYPE CONSOLE}
Begin
WriteLn('Hello World!');
End.
|  |
syntax.html(code : str, collapse : bool, firstline : num) : xml
Highlight HTML syntax.
Parameters:
| Name | Type | Description |
code
| str
| Source code to highlight. |
collapse
| bool
| Optional. Collapse code view (default: false) |
firstline
| num
| Optional. First line number (default: 1) |
Samples:
| Output |
| To embed highlighted HTML:
<HTML>
<HEAD>
<TITLE>Hello World!</TITLE>
</HEAD>
<BODY>
Hello World!
</BODY>
</HTML>
|  |
syntax.java(code : str, collapse : bool, firstline : num) : xml
Highlight Java syntax.
Parameters:
| Name | Type | Description |
code
| str
| Source code to highlight. |
collapse
| bool
| Optional. Collapse code view (default: false) |
firstline
| num
| Optional. First line number (default: 1) |
Samples:
| Outpu |
| To embed highlighted Java:
class HelloWorld {
static public void main( String args[] ) {
System.out.println( "Hello World!" );
}
}
|  |
syntax.javascript(code : str, collapse : bool, firstline : num) : xml
Highlight JavaScript syntax.
Parameters:
| Name | Type | Description |
code
| str
| Source code to highlight. |
collapse
| bool
| Optional. Collapse code view (default: false) |
firstline
| num
| Optional. First line number (default: 1) |
Samples:
| Outpu |
| To embed highlighted JavaScript:
function Hello () {
alert("Hello World!");
}
|  |
syntax.php(code : str, collapse : bool, firstline : num) : xml
Highlight PHP syntax.
Parameters:
| Name | Type | Description |
code
| str
| Source code to highlight. |
collapse
| bool
| Optional. Collapse code view (default: false) |
firstline
| num
| Optional. First line number (default: 1) |
Samples:
| Outpu |
| To embed highlighted PHP:
<?php
// Hello World in PHP
echo 'Hello World!';
?>
|  |
syntax.python(code : str, collapse : bool, firstline : num) : xml
Highlight Python syntax.
Parameters:
| Name | Type | Description |
code
| str
| Source code to highlight. |
collapse
| bool
| Optional. Collapse code view (default: false) |
firstline
| num
| Optional. First line number (default: 1) |
Samples:
| Outpu |
| To embed highlighted Python:
print "Hello World!"
|  |
syntax.ruby(code : str, collapse : bool, firstline : num) : xml
Highlight Ruby syntax.
Parameters:
| Name | Type | Description |
code
| str
| Source code to highlight. |
collapse
| bool
| Optional. Collapse code view (default: false) |
firstline
| num
| Optional. First line number (default: 1) |
Samples:
| Outpu |
| To embed highlighted Ruby:
puts "Hello World!"
|  |
syntax.sql(code : str, collapse : bool, firstline : num) : xml
Highlight SQL syntax.
Parameters:
| Name | Type | Description |
code
| str
| Source code to highlight. |
collapse
| bool
| Optional. Collapse code view (default: false) |
firstline
| num
| Optional. First line number (default: 1) |
Samples:
| Outpu |
| To embed highlighted SQL:
SELECT 'Hello World!';
|  |
syntax.vb(code : str, collapse : bool, firstline : num) : xml
Highlight Visual Basic syntax.
Parameters:
| Name | Type | Description |
code
| str
| Source code to highlight. |
collapse
| bool
| Optional. Collapse code view (default: false) |
firstline
| num
| Optional. First line number (default: 1) |
Samples:
| Outpu |
| To embed highlighted Visual Basic:
Private Sub Form_Load()
Print "Hello World!"
End Sub
|  |
syntax.xml(code : str, collapse : bool, firstline : num) : xml
Highlight XML syntax.
Parameters:
| Name | Type | Description |
code
| str
| Source code to highlight. |
collapse
| bool
| Optional. Collapse code view (default: false) |
firstline
| num
| Optional. First line number (default: 1) |
Samples:
| Outpu |
| To embed highlighted XML:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="HelloWorld.xsl" ?>
<text><string>Hello World!</string></text>
|  |