Support for Syntax Highlighting in Emails from JIRA

Issue #45 resolved
Mark Symons created an issue

Testing using JIRA Syntax Highlighter Plugin v1.9, "code" wiki markup not provide syntax highlighting in email notifications.

It would be useful for Syntax Highlighting to work in JIRA email notifications - it works fine for Atlassian's own "code" markup.

Tested using gherkin, CSS, and SQL code markup (although Atlassian only supports SQL).

Comments (15)

  1. Holger Schimanski repo owner

    This is currently not possible, because syntax highlighting is done on client side using JavaScript by the browser and this approach is not possible in emails.

    To make this possible a complete redesign and a switch to server side highlighting would be needed.

    I leave this ticket open to gather additional feedback.

  2. Mark Symons reporter

    Syntax Highlighting may be performed client-side. However it is done, the highlighting works when emails are generated from JIRA without using the Syntax Highlighting Plugin... ie, wiki markup done using Atlassian's built in wiki renderer.

    Attached screenshot shows that rendering works well when viewed in Firefox, and also within Microsoft Outlook client (which would use Internet Explorer to render).

    atlassian-wiki-render-email.JPG

  3. Holger Schimanski repo owner

    I am currently working on a major change switching from JavaScript/client side to Java/server side syntax highlighting. This will fix #42, #48 (problems with certain browser versions), #44 (syntax highlighting in activity streams) and #45 (syntax highlighting in emails), #46 and #47 (interference with other plugins like Links Hierarchy and JEMH using regex JS lib).

    Would you be able to test a beta release of this plugin?

  4. Holger Schimanski repo owner

    Version 2.0.0-beta1 is now available for download here.

    It contains implementation for

    • syntax highlighting in emails
    • syntax highlighting in activity streams
    • has support for collapse parameter
    • switches to line numbers not being shown by default
    • layout is now similar to Confluence

    Sample with all features of JIRA Syntax Highlighter Plugin incl. line numbers, first line, highlight and title. (Only collapse is not shown here).

    {code:java|linenumbers|firstline=5|highlight=7,8-9|title=Example for HelloWorld.java}
    // Hello World in Java
    class HelloWorld {
      static public void main( String args[] ) {
        System.out.println( "Hello World!" );
      }
    }
    {code}
    

    This will be rendered as shown in the following screenshot. example-layout.png

    Please raise an issue here, if you find any problems or bugs.

    Currently brushes for Objectiv-C, TCL, Gherkin and D are missing, but will be delivered as part of 2.0.0-beta2 resp. the final release.

    Best regards, Holger

  5. Holger Schimanski repo owner

    Would be great if you could provide a sceenshot from Outlook similar to the one above. Hopefully with correct syntax with this beta release. :-)

    Cheers, Holger

  6. Mark Symons reporter

    I am running 2.0.0-beta1 on JIRA v6.3.1. So far, everything seems great with syntax highlighting in the activity stream. However, things are not working in Outlook 2013 or in Office 365. I performed a couple of tests. One for SQL, and one for the example you gave above:

    Syntax-Highlighterv2-on-Outlook.png

  7. Holger Schimanski repo owner

    Can you check, how this is rendered, when JIRA Syntax Highlighter is disabled? Looks like plugin is not used at all in this screenshot. Maybe {code...} is escaped with \{code...} by accident? Or WikiRenderer disabled for comments? Also [~marks] is not rendered properly (should be replaced by user name - see screenshot from 2014-05-30).

  8. Mark Symons reporter

    I have done some digging and it seems that there seems to be a problem with issuecommentedited.vm. Thus, when Syntax Highlighter code module is disabled and the Atlassian Wiki Renderer plugin's code module is enabled then there is still a problem with the rendering in emails. It looks like my 2.0.0-beta1 screenshot above.

    When I add a comment (instead of editing an existing comment) then the email is rendered whether using either Syntax Highlighter plugin or the Atlassian plugin.

    Is this something that should be logged as a defect in JAC, and if so, do you want to do it or shall I?

    I have not yet iterated through the other templates: created, resolved, reopened, etc.

    Here is a screenshot for "issue commented". Note that things are looking pretty good - but the highlight has not worked & there's a spacing issue with the line numbering.

    Syntax-Highlighterv3-on-Outlook.png

  9. Holger Schimanski repo owner

    Many thanks for checking this issue. I put my vote on JRA-37674. :-)

    For other emails could you please check syntaxplugin-2.0.0-beta2.jar? I have changed some things in the HTML layout.

    Cheers, Holger

  10. Mark Symons reporter

    If background-color and font-color are fixed then margin and padding could probably be put aside for now and looked at later. That would allow a quicker release of v2.0 of the plugin... which is looking pretty darn good. I am looking forward to being able to deploy it on my production system when it's made available.

  11. Log in to comment