New Code Macro

Plugin Versions 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 3.0
1.9.2                  
1.9.1                  
1.9.0                  
1.0.3  
Outstanding Issues
Before installing the New Code Macro, please review the outstanding issues. We do not recommend the use of this new code macro if you are affected by any of the outstanding issues as shown above.
1.9.2 released

The newest version of this plugin, 1.9.2, has been released. The major feature of this release is support for exporting pages (e.g. to PDF). Currently, this feature has two modes of operating: render the highlighted code as text or as an image in the export. The first way is preferable, however Confluence version 2.10.x are known to have a less than optimal PDF exporting functionality. This means that for this version of Confluence, the plugin will automatically fall back to rendering the code as an image. This has a lower performance as a result and in the export the original code cannot be extracted. For the upcomming version 3.0.0 of Confluence, text rendering is already supported.

Including exporting, the following changes have been made:

  • Code cleanup (e.g. with regards to comments)
  • Improved code for the transition to a version 2 plugin (OSGi).
  • Refactored the export code in a cleaner design which allows easier extension
  • Fixed NCODE-3: Exporting is supported, with the limitation described above.
  • Fixed NCODE-16: The none-brush should be supported now
  • Fixed NCODE-17: Upgrade to a new version of the SyntaxHighlighter library.
    The transition to the new SyntaxtHighlighter library (2.0.30) has the following changes:
  • Support for ActionScript 3, JavaFX
  • Powershell support in the main distribution
  • Performance improvements
  • Parameters added: no-wrap, stripBrs (not supported yet)
  • Parameter removed: font-size (it does not have to be set manually anymore.
  • Toolbar is shown on mouse over

The transition to a fully compliant OSGi plugin is hindered by CONF-15639

1.9.1 released
The 1.9.1 version of the plugin has been released. This release adds some new features to the plugin and fixes some annoying bugs user have been reporting.

Although export support has been planned for this release, only an initial version of this feature is complete. There are some issues with the export which will probably take some time to fix. I've decided to postpone these to the next release to be able to help users with the other bugs fixed. This means export isn't currently working.

The following things have changed:

  • Partial fix for NCODE-3. Infrastructure is in place, though the export itself is not 100% correct
  • Transition to Java 5. This is caused by the work on NCODE-3
  • Fixed NCODE-4: Errors in the special characters don't seem to occur, except for one case. However, this case is the same as the old code macro an may not be resolvable. A workaround is available
  • Fixed NCODE-5: The problem doesn't seem to show up, so I've closed this bug
  • Fixed NCODE-10: The firstline parameter is now working
  • Fixed NCODE-11: An option has been added to select which key to use, either {newcode} or {code}. This can be configured by en/disabling one of the macros. Using both is also an option
  • Fixed NCODE-12: An highlighter has been added for PowerShell
  • Expanded integration test: the integration-tests have been expaned to test the behaviour of the plugin in an actual confluence environment.
  • Various cleanups
1.9.0 released!
The 1.9.0 version of the plugin has been released. This release fixes a number of bugs in the old plugin and the editing experience should be the same as the original Code Macro. However, testing is off course needed, so please install this plugin and report:
  • Any other versions it works in besides 2.10.x
  • Any bugs or feature requests
New development started
Currently, new development on this plugin has started. This new development aims to solve the outstanding issues mentioned above. The old version will still be available for download in the meantime, however it will not be supported in the future. The new version is targeted at Confluence version 2.10 and up.
In Subversion the latest version of this plugin is tagged as 1.0.3. This page will be updated when a stable version can be released including any a description of the changes in that release.
Preliminary roadmap:
  • 1.9.2: Release candidate
    • Fixes PDF export
    • Add support for Confluence 2.8 and up
  • 2.0.0: Final release

Description/Features

This is the Newcode Macro plugin. A plugin developed to serve as a replacement
for the Code plugin delivered by Atlassian in the default installation of
Confluence. This plugin has to following goals:

  • Support the widely used programming languages, like Java, C#, C++ and PHP
  • Provide a better-looking result than the Code Macro
  • Leave the development of the source code highlighting to someone else, just
    provide the integration code to speed-up development.
    For live examples of the macro in action, see New Code Macro Examples!

Installation

  • Disable the original Code macro.
  • This plugin serves as a replacement and uses the same macro key.
  • Since 1.9.1 you can configure which macro key you want to use: {code} or {newcode}. The distributed jar defaults to {code}, thus serving as a replacement.
  • Install the distribution Jar-file using the Confluence Plugin Manager.

Configuration

If you want to use {newcode} as the macro key, disable and enable the appropiate plugins in the plugin administration.

As yet there are no other global configuration options which can be set.

Usage

This macro is almost a complete drop in replacement for the existing code block macro bundled with Confluence.

Parameter Since Required Description
language 1.0 no (default param) the language to highlight, see below for support
title 1.9 no Set a title for the code
collapse 1.0 no "true" will collapse the code fragment by default
linenumbers 1.0 no "true" will show line numbers in the left gutter (default: true)
firstline 1.0 no if showing line numbers, where to start numbering from (default 1)
controls 1.0 no "true" will show controls at the top of the code fragment to copy and print (default: true)
ruler 1.9 no "true" will show a ruler to indicate the columns (default: false)
theme 1.9 no If set, use the specified theme instead of the default
macro body 1.0 yes the code to format

The macros also has accompanying documentation in the Wiki Notation Guide.

Supported Languages

Currently these are the supported languages and the aliases for them:

Language Aliases Version
ActionScript3
actionscript3, as3
 
Bash/shell bash, shell 1.9
C Sharp csharp, c-sharp 1.0
C++ cpp, c 1.9
CSS css 1.9
Delphi delphi, pas, pascal 1.0
Diff diff, patch 1.9
Groovy groovy 1.9
Java java 1.0
JavaFX
javafx
1.9.2
Javascript js, jscript, javascript 1.0
Perl perl, pl 1.9
PHP php 1.0
Plain text plain, text, none (since 1.9.2) 1.9
Powershell powershell, ps 1.9.1
Python py, python 1.0
Ruby rails, ror, ruby 1.9.0
Scala scala 1.9.0
SQL sql 1.0
Visual Basic vb, vb.net 1.0
XML xml, xhtml, xslt, html, xhtml 1.0

Supported Themes

Currently these are the supported themes and aliases for them:

  • Default - default (since 1.9)
  • DJango - django (since 1.9)
  • Emacs - emacs (since 1.9)
  • FadeToGrey - fadetogrey (since 1.9)
  • Midnight - midnight (since 1.9)
  • RDark - rdark (since 1.9)

Adding New Languages

For version 1.9 and up:

The implementation of the Newcode macro is based on the 2.0 version of the JavaScript based SyntaxHighlighter by Alex Gorbatchev (http://alexgorbatchev.com/wiki/). To add support for new languages, follow the steps below:

  • Create the JavaScript brush file using the description on http://alexgorbatchev.com/wiki/SyntaxHighlighter:Brushes:Custom.
  • Store the brush in the appropriate location
    • Jar version: the "sh/scripts" directory within the JAR file
    • Development/SVN version: the "src/main/resources/sh/scripts" directory
  • Register the brush in the atlassian-plugin.xml.
    • This file is located in the root of the JAR file or in the "src/main/resources" directory of the development/svn version.
    • Within this XML file there is a list of default brushes and below that comments indicate where you can add your custom brushes. A brush entry always has the following format: <resource type="download" name="[brush filename]" location="[relative path]"/>
  • Submit a bug report within the Newcode JIRA, with type enhancement and attach the new brush file. (http://developer.atlassian.com/jira/browse/NCODE)
    • This way your new brush can be added to the list of supported languages
  • Submit the brush to the original author to get the brush included in the original distribution.

For version 1.0:

Adding new languages is very easy. If you open the plugin or look in Subversion you will see a series of Javascript files (ie shBrushCSharp.js) which have the settings for each language.

To add a new language:

  1. Create a new .js file for your language, including the aliases it should have
  2. Add your .js file to the atlassian-plugin.xml as a downloadable resource
  3. Add your .js file to the newcodemacro-jscss.vm file (which lists all the Javascript and CSS files to be sent the first time a code macro is used on a page)
  4. Tell us about it so we can include it here!

Version History

Version Date State License Price
Show description 1.9.2 (#83) 19 May 2009 Beta Freeware / Open Source (ASL) Free

Release Notes
The newest version of this plugin, 1.9.2, has been released. The major feature of this release is support for exporting pages (e.g. to PDF). Currently, this feature has two modes of operating: render the highlighted code as text or as an image in the export. The first way is preferable, however Confluence version 2.10.x are known to have a less than optimal PDF exporting functionality. This means that for this version of Confluence, the plugin will automatically fall back to rendering the code as an image. This has a lower performance as a result and in the export the original code cannot be extracted. For the upcomming version 3.0.0 of Confluence, text rendering is already supported. Including exporting, the following changes have been made: * Code cleanup (e.g. with regards to comments) * Improved code for the transition to a version 2 plugin (OSGi). * Refactored the export code in a cleaner design which allows easier extension * Fixed NCODE-3: Exporting is supported, with the limitation described above. * Fixed NCODE-16: The none-brush should be supported now * Fixed NCODE-17: Upgrade to a new version of the SyntaxHighlighter library. The transition to the new SyntaxtHighlighter library (2.0.30) has the following changes: * Support for ActionScript 3, JavaFX * Powershell support in the main distribution * Performance improvements * Parameters added: no-wrap, stripBrs (not supported yet) * Parameter removed: font-size (it does not have to be set manually anymore. * Toolbar is shown on mouse over The transition to a fully compliant OSGi plugin is hindered by CONF-15639

Contributors

Show description 1.9.1 (#45) 25 Apr 2009 Beta Freeware / Open Source (ASL) Free

Release Notes
The is a bugfix release towards Newcode version 2.0. Fixes Jira bugs NCODE-3 (partially), NCODE-4, NCODE-5, NCODE-10, NCODE-11, NCODE-12. Besides these bugfixes, the integration tests have been expanded and various code cleanups have been done. Since this version, a Java 5+ runtime environment is needed. This to support the export features. The export features themselves are not yet bugfree.

Contributors

Show description 1.9.0 (#20) 24 Mar 2009 Beta Freeware / Open Source (ASL) Free

Release Notes
The inital beta release of the redeveloped plugin, based on Confluence 2.1.0. Fixes Jira bugs NCODE-1, NCODE-2, NCODE-6, NCODE-7, NCODE-8

Contributors

Show description 1.0.3 (#1) 30 Jun 2006 Alpha Freeware / Open Source (BSD) Free

Release Notes
The 1.0.3 release of the plugin. The last version to support Confluence 2.2 up to 2.7.

Contributors

Development of the Newcode plugin was started by Agnes Ro and Mike Cannon-Brookes. This plugin (up to version 1.03) supported Confluence v2.2 and up. Although it provided some basic functionality, there were editing issues and the Macro was not on-par with the original Code plugin. Further development wasn't done due to time constraints.

In February 2009, redevelopment was started by Jeroen Benckhuijsen. This new plugin was development from the ground up - though heavily inspired by the old code. The main focus points of this initial development were:

  • Solve the outstanding bugs within the current code
  • Add support for a lot more languages
  • Upgrade to a new version of the SyntaxHighlighter library
  • Support export options wihtin Confluence (e.g. export to PDF)
  • Migrate the project to the latest Maven 2 infrastructure
  • Integrate the plugin within the Confluence Plugin Repository
  • Target the newest release of Confluence and use it's features
  • Migrate to the V2 renderer framework
  • Provide a complete set of test-cases (both unit and integration test) as suggested on the Atlassian Development Network.

Open Issues

Screenshots

Todo

The following improvements are scheduled to be added to the Newcode macro

  • Improve behaviour when switching between Wiki and WYSIWYG mode during editing
  • Add global configuration options to specify the default theme
  • Add support for Confluence 2.8+

Future Enhancements

  • Highlight attachments - it would be nice to be able to include attachments, highlighted, within a page (ie XML or Java snippets)
  • Show fragment of fragment - right now you can collapse the whole code, or show it all. It would be nice to be able to show the 'first 10 lines' by default or something

Labels

plugin plugin Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. May 31, 2006

    Mark Michaelis says:

    The examples for the new code macro really look nice, but: It seems as if unlik...

    The examples for the new code macro really look nice, but:

    It seems as if unlike the old code macro the rendered result is not put into divs. This will break the layout of many old pages. E. g. the following code:

    # Here my code:
    {code:none|title=somefile.txt}
    XYZ
    {code}
    

    will not be rendered anymore with the code-panel beeing on a second line but rather with a textfield just behind "code:" with the bottom line of the field aligned with the bottom line of the text.

    Please at least find a way to make legacy markup look nice. Otherwise enabling this plugin will surely break many carefully designed layouts.

    1. Jun 01, 2006

      Mike Cannon-Brookes says:

      Mark - thanks for the feedback. We discovered this too, as well as a few bugs wi...

      Mark - thanks for the feedback. We discovered this too, as well as a few bugs with the WYSIWYG editor and code macro combined. These are being patched (some live here already) and should be released today.

  2. Jun 14, 2006

    Glenn Stewart says:

    I completely agree with Mark above. I like many of the new features of the "New...

    I completely agree with Mark above.

    I like many of the new features of the "New Code Macro", but have reservations as to the lacking of features the original Code Macro included. For this reason I also wonder if the two can co-exist somehow.

    In my opinion, the feature that is lacking is the ability to include a title. This is very useful for documenting contents of files for example.

    The following code useable by the original, no longer works:

    # Here my code:
    {code:none|title=somefile.txt}
    XYZ
    {code}
    

    The result is as follows:

    somefile.txt
    XYZ
    
  3. Jun 23, 2006

    Andrew J Cosgriff says:

    Here's a very basic Cisco config highlighter Unable to find source-code format...

    Here's a very basic Cisco config highlighter

    Unable to find source-code formatter for language: js. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
    dp.sh.Brushes.Cisco = function()
    {
    	//
    	// 2006 by Andrew J Cosgriff, based on emacs font-lock keywords at http://www.emacswiki.org/cgi-bin/wiki/cisco-router-mode.el
    	//
    	var toplevel_keywords =	'access-list class-map controller crypto interface policy-map redundancy route-map router username';
    	var command_keywords = 'alias boot card diagnostic ^enable hostname logging service snmp-server version vtp';
    
    	this.regexList = [
    		{ regex: new RegExp('^!.*$', 'gm'),							css: 'comment' },			//  comments
    		{ regex: new RegExp('[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+', 'g'),				css: 'vars' },			// IP addresses
    		{ regex: new RegExp('no ', 'gm'),						css: 'preprocessor' },		// "no" something
    		{ regex: new RegExp(this.GetKeywords(toplevel_keywords), 'gm'),		css: 'keyword' },	// cisco toplevel keywords
    		{ regex: new RegExp(this.GetKeywords(command_keywords), 'gm'),		css: 'keyword' }		// cisco command keywords
    		];
    
    	this.CssClass = 'dp-c';
    }
    
    dp.sh.Brushes.Cisco.prototype	= new dp.sh.Highlighter();
    dp.sh.Brushes.Cisco.Aliases	= ['cisco'];
    
  4. Jul 14, 2006

    Agnes Ro says:

    Note: this macro cannot be exported to PDF. This is a known bug, please use the...

    Note: this macro cannot be exported to PDF. This is a known bug, please use the original code macro if exports are required.

    Agnes.

    1. May 15, 2007

      Ulrich Trampe says:

      Here is a simple workaround for the PDF export bug, until it is fixed : Create a...

      Here is a simple workaround for the PDF export bug, until it is fixed : Create a user macro newcode with the following content and use it instead of code.

      ##check the request URI (if available) for doexport or exportword
      #if(!($req.getRequestURI().length() > 0) || ($req.getRequestURI().indexOf("doexport") == -1 && $req.getRequestURI().indexOf("exportword")== -1))
          ##not exporting, render code macro
          #set($globalHelper=$action.getGlobalHelper())
          #set($renderer=$globalHelper.getWikiStyleRenderer())
          #set($context=$content.toPageContext())
          #if($param0)
              #set($newContent="{code:${param0}}${body}{code}")
          #else
              #set($newContent="{code}${body}{code}")
          #end
          #set($renderedContent=$renderer.convertWikiToXHtml($context, $newContent))
          ${renderedContent}
      #else
          ##exporting, render simple code panel
          ${body}
      #end
      
  5. Jul 18, 2006

    Thomas Wendel says:

    Nifty macro! The only drawback is: Long pieces of code do not work well with th...

    Nifty macro!

    The only drawback is: Long pieces of code do not work well with the macro. The browser pops up a warning:

    Unable to render embedded object: File (unresponsive script.jpg) not found.

    If you click continue, the browser might show the code in the macro. If the code is really long, it takes ages and many continue-clicks.

    Would be awesome if you could fix that problem!

    Cheers
    Thomas

  6. Jul 27, 2006

    David Ruddock says:

    We tries out v1.3 and it but the Rich Text editor lost all the carrage returns i...

    We tries out v1.3 and it but the Rich Text editor lost all the carrage returns in the code, making it hard to edit. (WikiMarkup was fine - but not if you looked at the Rich Text first and then clicked on wiki markup)

    1. Aug 08, 2006

      daren desjardins says:

      We are having the same issue. Any time you switch to the Rich editor, the macros...

      We are having the same issue. Any time you switch to the Rich editor, the macros looses all formatting and becomes a single line.

      1. Aug 09, 2006

        Ivan Benko says:

        Hi Daren and David, What version of Confluence are you using? Could you raise a...

        Hi Daren and David,

        What version of Confluence are you using? Could you raise a support issue please?

        Thanks,
        Ivan

        1. Sep 01, 2006

          David Ruddock says:

          We're on 2.2.5 There's an outstanding issue here: http://jira.atlassian.com/bro...

          We're on 2.2.5

          There's an outstanding issue here: http://jira.atlassian.com/browse/CONF-6826

  7. Jul 28, 2006

    Tom Moore says:

    Thomas, that unresponsive script warning seems to be a bug with the way Firefox ...

    Thomas, that unresponsive script warning seems to be a bug with the way Firefox runs the javascript.  It seems to work fine in IE.  We've had to install IE Tab extension in firefox in order to use this, until the author can resolve this issue.

    1. Aug 02, 2006

      Thomas Wendel says:

      Tom, we also did experience this bug with IE or with the IE Tab extention for Fi...

      Tom, we also did experience this bug with IE or with the IE Tab extention for Firefox.

      Unable to render embedded object: File (unresponsive script IE.jpg) not found.

  8. Aug 02, 2006

    Tom Moore says:

    Oh ok.. Weird.. I stand corrected.  Seems to work fine for us in IE though.

    Oh ok.. Weird.. I stand corrected.  Seems to work fine for us in IE though.

  9. Aug 22, 2006

    David Aldrich says:

    I found that when I first inserted the new code macro and a code sample on a pag...

    I found that when I first inserted the new code macro and a code sample on a page and saved it, the code was displayed nicely. However, when I returned to edit the page, and viewed the Wiki markup and saved the page again, the code collapsed i.e. the line breaks were removed. Atlassian Support has recognised the problem and raised a bug: http://jira.atlassian.com/browse/CONF-6826

    Please vote for this issue to get it fixed.

  10. Sep 09, 2006

    Andrew J Cosgriff says:

    I've done a bit more work on the Cisco syntax highlighting. a diff against 1.0....

    I've done a bit more work on the Cisco syntax highlighting.

    a diff against 1.0.3 and a jar file are available via http://polydistortion.net/monkey/archives/2006/09/10/003819.html

  11. Sep 25, 2006

    Guy Fraser says:

    It would be super-useful to have a "wiki" language file for the syntax highlight...

    It would be super-useful to have a "wiki" language file for the syntax highlighter - there's loads of times when I've had to show chunks of wiki notation in user guides, etc., and having a wiki syntax would be a dream

  12. Oct 05, 2006

    Thomas Burkhart says:

    Hi, the plugin is great, but it would be even better if it would be possible to...

    Hi,

    the plugin is great, but it would be even better if it would be possible to display attached source files. Also a line range and not just a start would be great.

    If you expand a collapsed code fragment it should be possible to collapse them again.

    Best

    Thomas

  13. Oct 27, 2006

    Gary Pullis says:

    This would be a fantastic boon for my developers, but I'm concerned about using ...

    This would be a fantastic boon for my developers, but I'm concerned about using it until it's really stable. I think I'm going to go as far as to hold off until this moves from "New Code Macro" to "Standard Code Macro". When Atlassian trusts it enough to have it enabled, so will I.

  14. Dec 14, 2006

    John Price says:

    I just added a vote for fixing the bug that makes the RTF mode mess up code form...

    I just added a vote for fixing the bug that makes the RTF mode mess up code formatting. My team can't use this until that's fixed. Awesome macro though!

    1. Feb 23, 2007

      Pavlo Kasperskyi says:

      I am just wondering how this macro can have State = Stable.....

      I am just wondering how this macro can have State = Stable...

      1. Nov 07, 2007

        Matt Ryall (Atlassian) says:

        You're right. There are a number of significant bugs with this macro, so I've ch...

        You're right. There are a number of significant bugs with this macro, so I've changed its state to 'beta'.

        The bugs will also be moved from Confluence's issue tracker to the new project for this plugin:

        http://developer.atlassian.com/jira/browse/NCODE

  15. May 10, 2007

    Ric Parks says:

    Does anyone know if the issue with the rich test editor removing all the line br...

    Does anyone know if the issue with the rich test editor removing all the line breaks in code snippets has been resolved? Is there a work-around? This is an extremely, even fatal, problem for many of my existing pages.public void testThis {
    private static aTest;
    }
    Hm...looks like there's still a problem here, just a different one.

  16. May 15, 2007

    Ulrich Trampe says:

    Because of its unpredictable results and the loss of some features (title, borde...

    Because of its unpredictable results and the loss of some features (title, borderStyle, bgColor) the plugin should better not replace the original {code} macro. You can easily change the macros name by editing the atlassian-plugin.xml file within newcode-macro-plugin-1.0.3.jar.

    <macro name='newcode' class='com.atlassian.confluence.ext.code.NewCodeMacro' key='code'>

    After that, the macros name will be {newcode} and you can keep on using {code}.

    Hint for Windows Users: a jar is nothing else than a zip file, simply rename .jar to .zip and open it with windows explorer, rename it back to .jar before uploading it.

    1. May 15, 2007

      Ulrich Trampe says:

      In fact, I've changed the macros name to {newcodeorg}... <macro name='newcod...

      In fact, I've changed the macros name to {newcodeorg}...

      <macro name='newcodeorg' class='com.atlassian.confluence.ext.code.NewCodeMacro' key='code'>

      ...and access the {newcodeorg} macro not directly, but only via another user macro, I called {newcode} (to have a workaround for the PDF export bug, as described above):

      ##check the request URI (if available) for doexport or exportword
      #set($globalHelper=$action.getGlobalHelper())
      #set($renderer=$globalHelper.getWikiStyleRenderer())
      #set($context=$content.toPageContext())
      #if(!($req.getRequestURI().length() > 0) || ($req.getRequestURI().indexOf("doexport") == -1 && $req.getRequestURI().indexOf("exportword")== -1))
          ##not exporting, render new code macro
          #if($param0)
              #set($newContent="{newcodeorg:${param0}}${body}{newcodeorg}")
          #else
              #set($newContent="{newcodeorg}${body}{newcodeorg}")
          #end
      #else
          ##exporting, render simple code panel
          #if($param0 && ($param0 == 'actionscript' || $param0 == 'html' || $param0 == 'java' || $param0 == 'javascript' || $param0 == 'none' || $param0 == 'sql' || $param0 == 'xhtml' || $param0 == 'xml'))
              #set($newContent="{code:${param0}}${body}{code}")
          #else
              #set($newContent="{code}${body}{code}")
          #end
      #end
      #set($renderedContent=$renderer.convertWikiToXHtml($context, $newContent))
      ${renderedContent}
      
  17. Jul 11, 2008

    Treg Anderson says:

    Hi, I am having a problem using the New Code Macro on IE 7.0.  If I have on...

    Hi, I am having a problem using the New Code Macro on IE 7.0.  If I have one long line of text within the {code} tags the macro produces a scrollbar at the bottom of the code box but it covers up the single line of text. I am currently using IE 7.0 to enter this comment and when I shrink the width of the browser the scroll bar pops up over the text on the example below.

    This is some text that could cause a horizantal scroll bar with a narrow enough window

    With the window wide enough the scroll bar goes away and the text can be seen.

    Is this a bug that is known and is in the process of being fixed? I looked for the source code to take a look at it here but there doesn't seem to be any to download.

  18. Jul 23, 2008

    Crystal Johnson says:

    We have 2.8 installed and are trying to use C# with the code macro. I notice ...

    We have 2.8 installed and are trying to use C# with the code macro.

    I notice it is one of the supported languages, but come up with an error.

    Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml

    Please help.

    Thanks,

    Crystal Johnson

    1. Oct 02, 2008

      Erin Barschdorf says:

      We had the same problem. There was a Code macro that atlassian supports in ...

      We had the same problem. There was a Code macro that atlassian supports in the plugin list and enabled as well as the new code macro.  when we disabled the code macro we are able to use the C#  language.

  19. Sep 01, 2008

    Thomas Schmidt says:

    I found these two issues when using the new code macro: Highlightning for Pyth...

    I found these two issues when using the new code macro:

    • Highlightning for Python seems pretty poor.
    • the code inside the macro is messed up whenever you edit the page.

    Can we expect any improvements for this macro ?

  20. Mar 31

    Ben van Zanten says:

    I have some issues getting firstline to work. I use {NewCode:powershell|theme=...

    I have some issues getting firstline to work.
    I use {NewCode:powershell|theme=rdark|firstline=33} but it always starts counting from 01

    also a strong urge to leave the default {code} intact. If the new code macro keeps this name {NewCode} we don't have to disable the builtin {code} macro.

    And some remark about this page: the ruler is by default False, which is Ok. This page says incorrect it is True by default.

    PS. Where do you want my PowerShell formatter to be uploaded, or shall I send it by mail?

    1. Apr 08

      Jeroen Benckhuijsen says:

      Hi Ben, First of all, sorry about the late reply (been quite busy lately). Seco...

      Hi Ben,

      First of all, sorry about the late reply (been quite busy lately). Second, thanx for testing the new releases!

      About the issues you're facing and the PowerShell formatter, could you open (preferablly separate) JIRA issues for them. That's the easiest way to keep track of them. De formatter itself can then be attached to the bugreport. Given the impact of these issues (with the exception of the key for the macro, newcode vs. code) I expect to have them fixed by next release which I hope will be pretty soon. As for the key for the macro, I'm thinking about some ways to make this easily configurable. Some uses really want to keep the same key, as they would have to update a lot of pages otherwise. Looking into that!

    2. Apr 13

      Jeroen Benckhuijsen says:

      Ben, I've already added an issue for "firstline" (NCODE-10) and updated the pag...

      Ben,

      I've already added an issue for "firstline" (NCODE-10) and updated the page to reflect the correct default for ruler. If you could add JIRA issues for the other two, that would be great.

      1. Apr 15

        Ben van Zanten says:

        I've created Jira issue NCODE-12 ( http://developer.atlassian.com/jira/browse/NC...

        I've created Jira issue NCODE-12 ( http://developer.atlassian.com/jira/browse/NCODE-12 ) and attached my PowerShell / PS highlighter to it, have fun !

  21. Apr 10

    Fred Bunting says:

    (Filed in Jira: Description, in the Jira NCODE-9 .) When used with the {toc} m...

    (Filed in Jira: Description, in the Jira NCODE-9 .)

    When used with the {toc} macro on same page, and you click Save in the edit window, the first display of the page shrinks the code window.

    {toc}
    
    {code:python}
    # A tall but trivial code block.
    # Consisting of nothing but a few lines of comments.
    #
    #
    #
    #
    #
    #
    #
    #
    # End of code block
    {code} 
    
    

    Renders as:

  22. Apr 12

    Jeremy Thake says:

    I have disabled the Code Macro plugin and installed the jar package in the Plugi...

    I have disabled the Code Macro plugin and installed the jar package in the Plugins Manager and it states it is enabled. But when I go to any page with a {code} macro I get this error:

    Unknown macro: {code}

    I can enable the Code Macro plugin and it all works with standard {code} but I really want the csharp formatting!

    I am using Confluence 2.10 and have this set up in a Dev Environment so can try a few things if required to debug....

    1. Apr 13

      Jeroen Benckhuijsen says:

      Hi Jeremy, If you're runnign from a dev-environemnt, it might be the case that ...

      Hi Jeremy,

      If you're runnign from a dev-environemnt, it might be the case that the code is using{newcode} as the macro key instead of {code}. I've implemented this behaviour to be able to use the old code macro and this macro together for testing purposes. Could you check using this other macro key?

      1. Apr 14

        Jeremy Thake says:

        Yep Unknown macro: {NewCode} worked fine, but just doesn't work if I dis...

        Yep

        Unknown macro: {NewCode}

        worked fine, but

        
        

        just doesn't work if I disabled out of the box one.

        How else can I go through my site and do a global replace on these tags?

        Also it does'nt appear in Notation Guide...is there a way to get this to be added?

        1. Apr 14

          Jeroen Benckhuijsen says:

          Well, the original version you can download from here should be using {code} ins...

          Well, the original version you can download from here should be using {code} instead of {newcode}. If that's not the case, then that's a bug by the way.

          As for the notation guide: I expect that Atlassian determines the Notation Guide based on the default bundled plugins, which Newcode is not currently. Not sure if there is a way to add to it. Could you file a JIRA bug for this?

          1. Apr 14

            Jeremy Thake says:

            I'm goign to use JQuery to add the content, but adding a script to my space admi...

            I'm goign to use JQuery to add the content, but adding a script to my space admin layouts to check whether that content exists and tweak it slightly. Can see a .vm file in confluence folder, but don't really want to muck with that stuff...

        2. Apr 23

          Michael Milo says:

          Is there a quick fix for this?  We want to start using this plugin, but lik...

          Is there a quick fix for this?  We want to start using this plugin, but like others, we do not want to have to edit all of the pages that already contain the "code" macro.  Is it possible that if i rebuild this code myself it will work? I am not sure if you built it using debug properties.

          Great plugin though.  When we tested using the "newcode" macro our pages looked very nice.  Much better than the original atlassian macro.

          1. Apr 24

            Jeroen Benckhuijsen says:

            The quick fix is to edit the atlassian-plugin.xml in the jar-file. There is a &l...

            The quick fix is to edit the atlassian-plugin.xml in the jar-file. There is a <macro> tag in there. Change the "key" attribute from newcode to code and all should work fine.

            If you've got any other feedback about the plugin, just let me know

          2. Apr 25

            Jeroen Benckhuijsen says:

            Michael, Version 1.9.1 has been release which should fix this issue

            Michael,

            Version 1.9.1 has been release which should fix this issue

      2. Apr 14

        Fred Bunting says:

        This turned out to be my problem too (it installed using the {newcode} name, not...

        This turned out to be my problem too (it installed using the {newcode} name, not {{{code}
        }} ... testing under {newcode} works great.

        I don't want to do a global replace ... I would like the macro to continue to be called {{{code}
        }} ... which appears to be your intent.

  23. Apr 14

    Thom Pantazi says:

    Nice replacement for the code macro, but like others have noted it has it's bugs...

    Nice replacement for the code macro, but like others have noted it has it's bugs. Firstline doesn't work and since it doesn't I would suggest removing it as a viable parameter until it is fixed. I wasted 1/2 an hour trying to see what was wrong with my code before Is aw that there is a known bug.

    Also, I wonder why one of the languages isn't wiki/textile/velocity. Seems ironic that the native languages are omitted.

    As someone else observed the notation guide doe not have this macro at least in 2.10.

    One final note, I noticed that the controls tend to obscure the text underneath them rather then rendering a wider box to allow for both the code and the controls.

    1. Apr 15

      Jeroen Benckhuijsen says:

      Thanks for the feedback Thom. First, about the firstline bug: it's resolved in S...

      Thanks for the feedback Thom. First, about the firstline bug: it's resolved in SVN and will be included in the next release

      About the issues you mention, could you file Jira bugs for them. To go into specifics:

      • About the languages, true... Primary reason is that I'm using a third-party library which doesn't support these languages. I'll try to look into that.
      • Notation guide: looking into that, though it won't make it for the 1.9.1 release.
  24. Apr 25

    Jeremy Thake says:

    I tried installing 1.9.1, but I get an error: Error: There was a problem loadin...

    I tried installing 1.9.1, but I get an error:

    Error: There was a problem loading the descriptor for module 'code' in plugin 'New Code Macro Plugin'. Error retrieving dependency of class: com.atlassian.confluence.ext.code.NewCodeMacro. Missing class: org/lobobrowser/html/parser/InputSourceImpl

    I have disabled the Code plug-in...gone back to 1.9.0 for now.

    1. Apr 28

      Jeroen Benckhuijsen says:

      Hmm, very strange, it runs perfectly in the integration test, which should be a ...

      Hmm, very strange, it runs perfectly in the integration test, which should be a regulare confluence installation. I'll try to get a fix out asap, though I might need some help with testing it as I don't have a install of confluence running.

    2. Apr 28

      Ben van Zanten says:

      I had no problem installing this release, went without a problem. Ben

      I had no problem installing this release, went without a problem.
      Ben

    3. Apr 28

      Jeroen Benckhuijsen says:

      Jeremy, I've created NCODE-15 for this issue. Could you update it with the info...

      Jeremy,

      I've created NCODE-15 for this issue. Could you update it with the information about your environenment and such. I'll create some updated versions as prereleases which I'll attach to the bug. If you could test them and report and issues, that would be great.

      Ben, as you don't have any issues, could you add your environment as well so I can compare versions in which this problem arrises, tnx

  25. May 05

    J. Russell Noseworthy says:

    I see that you are planning on fixing the PDF export bug in 1.9.2. Do you have ...

    I see that you are planning on fixing the PDF export bug in 1.9.2. Do you have an estimate when that will be released? We really can't use this shiny new plugin until it works with PDF.

    1. May 05

      Jeroen Benckhuijsen says:

      I hope quite soon, the initial implementation is ready and tested. The current p...

      I hope quite soon, the initial implementation is ready and tested. The current problem is that the outputted HTML is not converted correctly to PDF, which unfortunately is not in my control. I'm in contact with the guys at Atlassian who work on the export module about this.

    2. May 19

      Jeroen Benckhuijsen says:

      Version 1.9.2. has been released, including export support. The code is quite ne...

      Version 1.9.2. has been released, including export support. The code is quite new off course, so I'm looking forward to people testing it.

  26. May 07

    Oliver Hüppe says:

    Hi, i like this Macro but when using the {code} makro the old highligther for ...

    Hi,

    i like this Macro but when using the {code}
    makro the old highligther for "none" does not work anymore. So I tried to add a new language us descripted above, actually I used a copy of plain and modified it, to bring back the none-brush. Still same problem when I open up a page with {code:none} the brush "none" is missing. How can I fix this?
    Oliver

    1. May 19

      Jeroen Benckhuijsen says:

      Oliver, This has been fixed in the latest release of the plugin, 1.9.2. The pro...

      Oliver,

      This has been fixed in the latest release of the plugin, 1.9.2. The problem itself has been recorded as NCODE-16 in Jira, some in case something is still wrong, please reopen the bug and state the problem there.

  27. May 22

    Stéphane Bourque says:

    We have a problem with the xml brush file. A bug has been opened at the bug trac...

    We have a problem with the xml brush file. A bug has been opened at the bug tracking tool of the SyntaxHighlighter web site.

    The problem is that semicolon are appearing within the closing element tag when a URL is the element content.

    For instance, using the code macro with the xml brush for the following:

    <some_element>http://my.website.com/</some_element>

    would produce:

    <some_element>http://my.website.com/<;/some_element>

    Notice the semicolon in the closing some_element tag. If you put a space between the content and the closing tag, the semicolon does not appear. If you use one / in the URL instead of two, no problem either. Since using URL is pretty common within XML, this problem is causing us some trouble. We are using version 1.9.2. which otherwise is a great replacement for the default code macro from Atlassian. Great job!

    Thanks

    Stephane

    1. May 22

      Jeroen Benckhuijsen says:

      Hi Stephane, I'm using the SyntaxHighlighter mainly as a black-box library, so ...

      Hi Stephane,

      I'm using the SyntaxHighlighter mainly as a black-box library, so I'm not really into bugs into the library itself. This plugin will off course keep track of any new versions of the library, so when this bug is solved you can expect it to be included in a new release. You might want to open a Jira issue here so we can use it to track any changes and to discuss when it will be included in a new release of the plugin.

      If you've got a fix in the form of a patch, that can off course be included.