Drupal 6 syntaxhighlighter module

in

This Drupal 6 module does program code list syntax highlighting like this:

class Person(ln : String, fn : String, s : Person)
{
    def lastName = ln;
    def firstName = fn;
    def spouse = s;
    
    def this(ln : String, fn : String) = { this(ln, fn, null); }

    def introduction() : String = 
        return "Hi, my name is " + firstName + " " + lastName +
            (if (spouse != null) " and this is my spouse, " + spouse.firstName + " " + spouse.lastName + "." 
             else ".");
}

It uses the Syntax Highlighter Javascript library to perform the highlighting on the client browser.

The module is at the Drupal Syntaxhighlighter module project page. Before installing the module, first download the latest Syntax Highlighter Javascript Library. Unzip the entire content into a sub-directory inside sites/all/libraries. You can use any directory name, in any level of nesting or even no directory. You can delete the 'src' directory from the extracted files if you want. It's not needed for normal usage. Refer to the README.txt file for details. Then install the module.

Module configuration

Go to 'admin/settings/syntaxhighlighter' to make configuration change:

(The checkboxes and radio buttons are displayed in columns above with the Multi-column checkboxes radios module. If you install and enable that module to get it display like it's here. Otherwise, the checkboxes and radio buttons are in single long column.)

The first set of checkboxes allow you to selectively enable languages. You may want to enable only the languages you need to avoid loading unnecessary Javascript files. However, choosing all should not be any problem in any case because browses cache Javascript files.

The theme radio buttons let you choose the stylesheet used by the Syntax highlighter display.

The "Tag name" setting lets you change the code markup tag to some other legal html tag if <pre> for some reason cannot be used. For example, you can use the <code> tag instead.

Enable "Legacy mode" to support old style markup format. For most users this should just be disabled. This is provided in case you have contents that use the old style Syntax highlighter markup.

Use the "Turn off Syntax Highlighter on these pages" setting to disable the Syntax highlighter to avoid compatibility problem.

The "Default expressions" setting let you enter Javascript statements to initialize the Syntax highlighter to some site wide defaults.

Visit the 'admin/help/syntaxhighlighter' page for module help.

Content markup

Markup your program listing like this:

{syntaxhighlighter OPTIONS}
// paste your code verbatim in between the markup
#include <iostream>
// etc etc etc
{/syntaxhighlighter}

where OPTIONS is a syntax highlighter options string. See the Syntax Highlighter Javascript library page for details. To highlight some C++ code:

{syntaxhighlighter brush: cpp}
// paste your code verbatim in between the markup
#include <iostream>
// etc etc etc
{/syntaxhighlighter}

and that becomes:

// paste your code verbatim in between the markup
#include <iostream>
// etc etc etc

Click to see a sample of all syntax highlighted languages.

TinyMCE Wysiwyg editor integration: see the this module's project page

The GeSHi Filter module also does syntax highlight. It is a server side filter, so processing is done using PHP inside Drupal on the web server. Whereas this module off loads the processing entirely to the client browser.

// paste your code verbatim

Anonymous의 이미지
// paste your code verbatim in between the markup
#include <iostream>
// etc etc etc

<h3>hahah</h3>

Friend의 이미지

<h3>hahah</h3>

toggle line numbers missing ;(

elmuchacho의 이미지

works like described ...
ty ...
but the menu in the upper right corner on my site shows "view source","copy to clipboard","print" and "help" ...

"toggle line numbers" is missing ;(

actually i've installed version 2.1.364 of the SyntaxHighlighter ...

any ideas ?

I'm using a customized version

Alpha Epsilon Delta의 이미지

of syntax highlighter javascript library. The one from Alex doesn't have this feature.

Drupal Issue: wysiwyg

Visitor의 이미지

Hi I'm triying to install tinymce o fckeditor over Drupal 6 an d wysiwyg, the problem is that i cant see de toolbar in Chrome or IExplorer 8. I get a javascript error in wysiwyg.js.

So when I have arrive to your page I've seen that you have the same problem, i can't see the toobar in IExplorer and Chrome on your page. Do you know something about it?

Dan
(Sorry my disgusting English)

Please update to the latest version...

Alpha Epsilon Delta의 이미지

of syntaxhighlighter js lib  (2.1.364 as of today)

 

see http://drupal.org/node/652586

Thanks for that link, it

bed &amp; breakfast barcelona의 이미지

Thanks for that link, it helped me a lot.

The available Drupal add-on

SEO의 이미지

The available Drupal add-on modules and extensions make it possible to
integrate numerous features and functions such as: Ecommerce, news
feeds, event calendars, photo galleries, blogs, forums, social
networking, SEO, and many more. Drupal can even be integrated with
other software programs, such as a Customer Relationship Management
(CRM) system.

 

 

SEO

The available Drupal add-on

SEO의 이미지

The available Drupal add-on modules and extensions make it possible to
integrate numerous features and functions such as: Ecommerce, news
feeds, event calendars, photo galleries, blogs, forums, social
networking, SEO, and many more. Drupal can even be integrated with
other software programs, such as a Customer Relationship Management
(CRM) system.

A Drupal video course is the

utah photography의 이미지

A Drupal video course is the easiest way to learn, and once mastered you can design forms, ecommerce stores, polls, survey and blogs with ease. Manuals are fine, but most people learn best by video, where they can pause and follow exactly what is being done by carrying out the same actions on their own computer.

Thank you very much for the

alışveriş의 이미지

Thank you very much for the excellent and useful subject.

UGG Sundance Grab

UGG Sundance Grab의 이미지

Domenech oversaw a stuttering,
<a href="http://www.uggs-outlet.org"> uggs outlet</a>
but ultimately successful World Cup qualifying campaign,
<a href="http://www.discount-ugg-boots.org">discount ugg</a>
and the France Football Federation (FFF) confirmed last week there would be no change of coach.
<a href="http://www.shoesucn.com">nike outlet</a>
However, the idea of bringing in a general managerwholesale shoes and a director of sport was discussed at a meeting last Thursday by Club France - an organisation created as an advisory board by the FFF.
<a href="http://www.discount-ugg-boots.org/UGG_Sundance_Grab.html">UGG Sundance Grab</a> And reports suggest Club France will recommend installing Lens chairman Gervais Martel as general manager and former Liverpool ,
<a href="http://www.shoesucn.com/news/nike-outlet/nike-outlet.html">nike outlet</a>
Lyon and France manager Gerard Houllier as director of sport when the FFF meet on 29th January.

i want add the syntaxhighlighter button to CKEditor.

song의 이미지

I want known , if i want add the syntaxhighlighter button to CKEditor. how can i do?

댓글 쓰기

이 필드의 내용은 비밀로 유지되며, 공개되지 않습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
  • Syntax highlight code surrounded by the {syntaxhighlighter OPTIONS}...{/syntaxhighlighter} tags.
  • 사용할 수 있는 HTML 태그: <a> <p> <span> <div> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <embed> <object> <param> <strike> <caption>
  • Insert Google Map macro.
  • Use [toc list: ol; title: Table of Contents; minlevel: 2; maxlevel: 3; attachments: yes;] to insert a mediawiki style collapsible table of contents. All the arguments are optional.

포맷팅 옵션에 대한 추가 정보