This module functions pretty much like the image manager for popular WYSIWYG editors except that instead of working with images, this one works with codes (code browser). It stores code fragments that can be edited/created from the WYSIWYG editor. The code fragments are stored in the content using tags. These codes can also be reused on other nodes.

Codes fragments are syntax-highlighted using the Geshi filter module.

Installation

  1. Enable the Code Snippet module
  2. Enable the filter to use code snippets
  3. Configure TinyMCE to have the Code snippet button added

The <> button should appear on the TinyMCE editor.

Tag format

[snippet|type=drupal6|csid=13|tagstyle=block|lineNumbering=2|numberStart=301]

  • csid: The only required attribute (but untested if others are absent). The database ID
  • type : Only here for image styling inside TinyMCE, the filter uses the value stored in the database
  • tagstyle: Helps controls the formatting and this data is saved in the tag, see the GeSHi Filter docs for more details.
  • lineNumbering: See the GeSHi Filter docs.
  • numberStart : See the GeSHi Filter docs.

Dependencies

Release 1.1

This new release comes with an advanced code browser and editor.

You can now create code snippets when creating a new node as opposed to the previous version which worked when editing nodes only.

I do not see myself using any other editors, so if anyone wants to implement code snippet with another editor, please submit a patch.

Project Information

Downloads