devel:geshi
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
devel:geshi [2013-05-04 18:16] – created Klap-in | devel:geshi [2023-09-16 00:44] (current) – Klap-in | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | |||
====== Syntax highlighting by Geshi ====== | ====== Syntax highlighting by Geshi ====== | ||
DokuWiki includes GeSHi - Generic Syntax Highlighter - for formatting '' | DokuWiki includes GeSHi - Generic Syntax Highlighter - for formatting '' | ||
Line 5: | Line 4: | ||
Please refer to the [[xref> | Please refer to the [[xref> | ||
+ | |||
===== Example usage ===== | ===== Example usage ===== | ||
- | Example how DokuWiki applies the highlighter for its code and file blocks. It is embedded in a wrapper method [[xref> | + | Example how DokuWiki applies the highlighter for its code and file blocks. It is embedded in a wrapper method [[xref> |
<code php> | <code php> | ||
- | $code = ' | + | $code = '... syntax to higlight ...'; |
- | $geshi = new GeSHi($code, | + | $geshi = new GeSHi($code, |
$geshi-> | $geshi-> | ||
$geshi-> | $geshi-> | ||
Line 17: | Line 16: | ||
$geshi-> | $geshi-> | ||
- | // when you like to use your own wrapper, remove GeSHi' | + | //when you like to use your own wrapper, remove GeSHi' |
- | // we need to use a GeSHi wrapper to avoid <BR> throughout the highlighted text | + | //we need to use a GeSHi wrapper to avoid <BR> throughout the highlighted text |
$highlighted_code = trim( | $highlighted_code = trim( | ||
- | preg_replace(' | + | preg_replace(' |
" | " | ||
); | ); | ||
Line 27: | Line 26: | ||
===See also=== | ===See also=== | ||
* [[wiki: | * [[wiki: | ||
+ | * [[tips: | ||
+ | * [[tips:code css|CSS to extend syntax highlighting ]] |
devel/geshi.1367684218.txt.gz · Last modified: 2013-05-04 18:16 by Klap-in