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: Code Highlighter

Author:Kasper Skårhøj
Created:2002-11-01T00:32:00
Changed by:Marc Hörsken
Changed:2010-06-08T15:37:47.470000000
Classification:mh_code_highlighter
Description:The keywords help with categorizing and tagging of the manuals. You can combine two or more keywords and add additional keywords yourself. Please use at least one keyword from both lists. If your manual is NOT in english, see next tab "language" ---- forEditors (use this for editors / german "Redakteure") forAdmins (use this for Administrators) forDevelopers (use this for Developers) forBeginners (manuals covering TYPO3 basics) forIntermediates (manuals going into more depth) forAdvanced (covering the most advanced TYPO3 topics) see more: http://wiki.typo3.org/doc_template#tags ----
Keywords:forAdmins
Author:Marc Hoersken
Email:info@marc-hoersken.de
Info 4:
Language:en

img-1 img-2 EXT: Code Highlighter - mh_code_highlighter

EXT: Code Highlighter

Extension Key: mh_code_highlighter

Language: en

Keywords: forAdmins

Copyright 2000-2010, Marc Hoersken, <info@marc-hoersken.de>

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.org

Table of Contents

EXT: Code Highlighter 1

`Introduction 3 <#1.1.Introduction|outline>`_

What does it do? 3

Screenshots 3

`Users manual 4 <#1.2.Users%20manual|outline>`_

FAQ 4

`Adminstration 5 <#1.3.Adminstration|outline>`_

`Configuration 6 <#1.4.Configuration|outline>`_

Example: Stylesheet and HTML configuration 6

Example: Usage of the extension from TypoScript 6

Reference 6

`Known problems 8 <#2.1.Known%20problems|outline>`_

`Changelog 9 <#2.2.Changelog|outline>`_

Introduction

What does it do?

- This extension adds a new content element to TYPO3 that can be used on any page. It allows you to highlight code with many different syntax highlighters. The extension can also contact the syntax repository and check for new or updated syntax highlighting files. The extension uses the popular GeSHi highlighter tool that has been tweaked to be included into it.

Screenshots

- Content Element in Page Module

img-3

- (German view) Content Element in Frontend with default styles and “Select All” and “Linenumbers on/off” link.

img-4

- Backend module.

img-5

Users manual

- To add a new code Content Element to any page, go to the “Page” module of your TYPO3 Backend.

- Click on the page you want to add the new element in and click on “New record”.

- Select the “Sourcecode” plugin from the “Insert plugin” item or click on “Sourcecode” from the “Plugins” section.

- You can now insert a title, the code itself and chosse a syntax for the code inside the formular.

- It also allows you to hide or show the “Select all” and “Linenumbering on/off” links.

- After you have filled in all information, click on one the save buttons.

FAQ

- A syntax I want to use is missing, what should I do? You can either check for new syntaxes in the “GeSHi Syntax” module or go to the official GeSHi webpage and check for syntaxes yourself. http://qbnz.com/highlighter/

Adminstration

- The “GeSHi Syntax” module in the TYPO3 Backend provides some very useful features. You can install, uninstall and update the syntaxes.

- It's also possible to export and import syntaxes, like you can do it with extensions or pages.

Configuration

- Default CSS Styles in “ext_typoscript_setup.txt”.

- Default HTML Template in “pi1/class.tx_mhcodehighlighter_pi1.tmpl”.

- You can change the CSS Styles and the path to the HTML Template with TypoScript.

Example: Stylesheet and HTML configuration

plugin.tx_mhcodehighlighter_pi1 {
        templateFile = EXT:mh_code_highlighter/pi1/class.tx_mhcodehighlighter_pi1.tmpl

        _CSS_DEFAULT_STYLE (
                /* GeSHi Highlighter */
                .tx-mhcodehighlighter-pi1 .geshi-box dl.codebox {
                        padding: 3px;
                        background-color: #FFFFFF;
                        border: 1px solid #D8D8D8;
                        font-size: 1em;
                        color: #000000;
                }
                .tx-mhcodehighlighter-pi1 .geshi-box ol {
                        padding-left: 0px;
                        margin-left: 40px;
                }
                .tx-mhcodehighlighter-pi1 .geshi-box dl.codebox dt {
                        text-transform: uppercase;
                        border-bottom: 1px solid #CCCCCC;
                        margin-bottom: 3px;
                        font-size: 0.8em;
                        font-weight: bold;
                        display: block;
                }
                .tx-mhcodehighlighter-pi1 .geshi-box dl.codebox dd {
                        margin-left: 0px;
                        padding-left: 0px;
                }
                .tx-mhcodehighlighter-pi1 .geshi-box dl.codebox code {
                        overflow: auto;
                        display: block;
                        height: auto;
                        max-height: 200px;
                        white-space: normal;
                        font: 0.9em Monaco, "Andale Mono","Courier New", Courier, mono;
                        line-height: 1.3em;
                        color: #8b8b8b;
                        margin: 2px 0px;
                }
         .tx-mhcodehighlighter-pi1 .geshi-box dl.codebox code pre {
                 font: 1.0em Monaco, "Andale Mono","Courier New", Courier, mono;
                 line-height: 1.3em;
                 color: #8b8b8b;
              }
        )
        _CSS_LINE_1_STYLE = padding: 0px 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;
        _CSS_LINE_2_STYLE = padding: 0px 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;
}

Example: Usage of the extension from TypoScript

plugin.tx_mhcodehighlighter_pi1 {
        value = This is an example code
        config {
                lang = text.php
                selectall = 1
                linenumbering = 1
                tabwidth = 4
        }
}

Reference

templateFile

Property

templateFile

Data type

string

Description

Path to the HTML Template

Default

_CSS_DEFAULT_STYLE

Property

_CSS_DEFAULT_STYLE

Data type

string

Description

Default CSS Stylesheet

Default

_CSS_LINE_1_STYLE

Property

_CSS_LINE_1_STYLE

Data type

string

Description

Style for lines with style id 1 (Don't put a new line inside!)

Default

_CSS_LINE_2_STYLE

Property

_CSS_LINE_2_STYLE

Data type

string

Description

Style for lines with style id 2 (Don't put a new line inside!)

Default

value

Property

value

Data type

string

Description

The code that becomes highlighted by the Extension

Default

config.lang

Property

config.lang

Data type

string

Description

Filename of the syntax

Default

config.selectall

Property

config.selectall

Data type

boolean

Description

Show the “Select all” link

Default

0

config.linenumbering

Property

config.linenumbering

Data type

boolean

Description

Show the “Linenumbers on/off” link and show linenumbering

Default

0

config.tabwidth

Property

config.tabwidth

Data type

integer

Description

Width of tabs in spaces

Default

4

[tsref:plugin.tx_mhcodehighlighter_pi1]

((generated))
Example
page = PAGE
page.typeNum = 0
page.10 < plugin.tx_mhcodehighlighter_pi1
page.10.value = This is an example code
page.10.config {
        lang = text.php
        selectall = 1
        linenumbering = 1
        tabwidth = 4
}

Known problems

- Nothing yet, please inform me if you find something: info@marc- hoersken.de

Changelog

10-06-08 Marc Hoersken <info@marc-hoersken.de>

* Updated GeSHi to version 1.0.8.8

* Fixed empty class attribute (thanks Jan)

10-02-27 Marc Hoersken <info@marc-hoersken.de>

* Updated GeSHi to version 1.0.8.6

* Fixed language installation (thanks Jürgen and Maximilian)

* Updated path to language repository

08-12-01 Marc Hoersken <info@marc-hoersken.de>

* Updated GeSHi to version 1.0.8.1

* Updated GeSHi syntax files and fixed PHP syntax

* Updated manual to new layout.

* Removed database based caching.

08-06-08 Marc Hoersken <info@marc-hoersken.de>

* Fixed SYMBOL and REGEXP highlighting

* Updated GeSHi to version 1.0.7.21

* Updated GeSHi syntax files and fixed PHP syntax

08-04-06 Marc Hoersken <info@marc-hoersken.de>

* Fixed invalid <span> and <code> tag (thanks Cyrill)

* Updated JS to work without those tags

* Added missing XCLASS statements

07-11-27 Marc Hoersken <info@marc-hoersken.de>

* Renamed GeSHi class to 'tx_mhcodehighlighter_geshi'

07-11-25 Marc Hoersken <info@marc-hoersken.de>

* Fixed config.linenumbering overwriting config.tabwidth

* Made the TCA (Web->List module) view looking better and set 'readOnly' to 1

* Fixed screwed layout if linenumbering was disabled

* Added new CSS to the static TypoScript setup file

07-07-28 Marc Hoersken <info@marc-hoersken.de>

* Fixed manual

07-07-27 Marc Hoersken <info@marc-hoersken.de>

* Tuned and documented the GeSHi class

* Added plugin to "Create Content Element" list

* Added manual

07-07-27 Marc Hoersken <info@marc-hoersken.de>

* Initial release

10