DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

EXT: Text Highlighter

Author:Spyker
Created:2006-05-21T15:02:16
Changed by:Michiel Roos
Changed:2007-05-23T23:27:44
Email:extensions@typofree.org
Info 2:
Info 3:
Info 4:

EXT: Text Highlighter

Extension Key: texthighlighter

Copyright 2007, Michiel Roos, <extensions@typofree.org>

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.com

Table of Contents

EXT: Text Highlighter 1

Introduction 1

What does it do? 1

Requirements 1

Screenshots 2

User manual 4

Reference 4

To-Do list 4

Introduction

What does it do?

It adds a new content element which you can use to create highlighted code snippets on your page. It uses CSS to do the highlighting.

Requirements

It uses the PEAR Text Highlighter package from http://pear.php.net/package/Text_Highlighter . I chose this package because it can highlight:

  • CPP
  • CSS
  • DTD
  • HTML
  • JAVA
  • JAVASCRIPT
  • MYSQL
  • PHP
  • PERL
  • PYTHON
  • RUBY
  • SQL
  • XML
  • DIFF

Screenshots

img-1 Illustration 1: Optionally add static template and default highlighting css

img-2 Illustration 2: Create new text element and choose 'Highlighted text'

img-3 Illustration 3: Choose format

img-4 Illustration 4: The result

User manual

Create a new page content element (text for example) and then change the TYPE to 'Highlighted Text'. The form will change and you will get a 'format' dropdown menu and a field to paste your code into.

Reference

tabWidth

Property

tabWidth

Data type

integer

Description

The amount of spaces used to represent a tab.

Default

2

numbering

Property

numbering

Data type

string

Description

Accepts three different values: HL_NUMBERS_LI instructs the class to number the lines using the <ol /> HTML tag, while HL_NUMBERS_TABLE uses a two-column table with the line numbers in the first and the source code in the second column. Setting the value to FALSE turns line numbering off.

Default

HL_NUMBERS_LI

example TypoScript constants section:

plugin.tx_texthighlighter_pi1.numbering = HL_NUMBERS_LI
plugin.tx_texthighlighter_pi1.tabWidth = 2

To-Do list

Make a nice backend module for cut and paste highlighting code. This could be used to paste highlighted code into a news article for example.

img-5 EXT: Text Highlighter - 4