Extension Wiki SyntaxHighlight

From Wiki de Caballero
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Forma de formatear código usando SyntaxHighlight

Para empezar

Para poder utilizar la extensión SyntaxHighlight se debe agregar las etiquetas con el mismo nombre y parámetros.

Parámetros

lang:

Define el lenguaje de programación que desea utilizar.Lenguajes Soportados

line:

Permite agregar números de líneas al contenido, opciones line="GESHI_NORMAL_LINE_NUMBERS" y line="GESHI_FANCY_LINE_NUMBERS"

line start:

Permite agregar números de líneas comenzando desde el lugar indicado.

highlight:

Permite destacar una o más líneas con un color diferente al contenido.

enclose:

Especifica que contenedor es usado para encerrar el código, opciones pre,div y none, el valor por defecto es div.

strict:

Parámetro para habilitar el modo estricto.

Ejemplo básico

Cuando la línea enumerada es agregada con line, serán encerrado las líneas de código. Vea el siguiente ejemplo. Cuando text es el lenguaje seleccionado y se utiliza la numeración, el comportamiento se asemeja al uso de pre, etiquetas con numeración y donde la etiqueta highlight destaca la línea indicada.

El siguiente ejemplo muestra como el colorear un listado de código HTML:

<syntaxhighlight lang="html4strict" line start="100" highlight="5" enclose="div">
modulo HTML va aquí...
</syntaxhighlight>

Un resultado típico es:

<!--This is a comment. Comments are not displayed in the browser-->
<table align=center style="background: ivory;color:maroon;font-style:italic;font-family:arial;font-weight:bold;font-size:10pt;"> 
<tr><th> Heading 1 </th><th> Heading 2 </th></tr>
<tr>
<td style="padding:10px;"> This is cell 1 text </td>
<td style="padding:10px;"> This is cell 2 text </td>
</tr>
</table>



fuente: Sitio Extensión SyntaxHighlight GeSHi