Note: You are currently viewing documentation for Moodle 3.11. Up-to-date documentation for the latest stable version of Moodle may be available here: Code syntax highlighting.

Code syntax highlighting: Difference between revisions

From MoodleDocs
mNo edit summary
No edit summary
 
Line 1: Line 1:
You can color or highlight code snippets within Moodle resources, forum posts etc. To do so you must install the GeSHi (Generic Syntax Highlighter) Filter. This makes the power of GeSHi available in Moodle through the use of a pair of special tags.
There used to be [https://moodle.org/plugins/view.php?plugin=filter_geshi filter_geshi] available for the syntax highlighting but is was [https://tracker.moodle.org/browse/CONTRIB-8002 removed].
 
See [[MoodleDocs:Style_guide#PHP_syntax_highlighting]] that does not need any additional filter
== Installing ==
 
You can download the GeSHi filter from here:
 
https://moodle.org/plugins/view.php?plugin=filter_geshi
 
To install, unzip that archive into your filter/ directory and then enable it in the admin filter configuration screen.
 
== Instructions for use ==
 
Enclose your code in spans under the source of html editor like so:
 
<nowiki><span syntax="code">your code goes here</span></nowiki>
 
<nowiki><span syntax="code" linenumbers="yes">your code with line numbers</span></nowiki>
 
=== Supported languages ===
 
* asm,
* bash,
* cpp,
* [[CSS]]
* lisp
* matlab
* [[HTML in Moodle]]
* [[PHP]]
* pascal
* sql
* xml
 
and many others. See the GeSHi homepage for full details.
 
=== Options ===
 
See the examples above. This filter is still under development so things may change.
 
== Demo ==
 
The GeSHi homepage also has an interactive demo.
 
http://qbnz.com/highlighter/demo.php
 
== Development ==
 
The last development for this filter appears to have been in 2017. Bug reports are welcome, please post them in the [https://github.com/enovation/moodle-filter_geshi/issues github issues system].
 
== See also ==
 
* [http://qbnz.com/highlighter/ GeSHi homepage]
* [[MoodleDocs:Style_guide#PHP_syntax_highlighting]] that does not need any additional filter


[[Category:Administrator]]
[[Category:Administrator]]

Latest revision as of 09:03, 9 March 2020

There used to be filter_geshi available for the syntax highlighting but is was removed. See MoodleDocs:Style_guide#PHP_syntax_highlighting that does not need any additional filter