Menu

Plugin: Highlight

2006-01-06
2012-11-14
  • André Simon

    André Simon - 2006-01-06

    Hi all,

    I just finished a new plugin which enables source code highlighting of the current file.
    The output file type may be HTML, LaTeX, TeX, RTF, XSL-FO or XML. The parser supports more than 100 programming languages.

    Download link:

    http://www.andre-simon.de/zip/NPPHighlightPlugin.zip

    The next step would be to add some options and save them in a file. Plugin development was smooth - good api :)

    Have fun
    André

     
    • Don HO

      Don HO - 2006-01-07

      It's pity that the generation is not dynamic.

      Don

       
      • André Simon

        André Simon - 2006-01-08

        I have uploaded a new version which highlights the current buffer (I assume this is what should be dynamic). The URL is the same as above.I also uploaded the source code:

        http://www.andre-simon.de/zip/NPPHighlightPluginSrc.zip

        André

         
        • Don HO

          Don HO - 2006-01-09

          André,
          >  I have uploaded a new version which highlights the current buffer (I assume this is what should be dynamic).

          When I said "the generation is not dynamic", I meant that the generated style (text color and font) in a html file doesn't come from Notepad++, but from your definition files.

          A dynamic generation should be, IMHO, generic. Therefore it should work with all supported languages without definition files.

          Don

           
          • André Simon

            André Simon - 2006-01-09

            OK, I see. I should get the style information from the scintilla control instead of applying a foreign parser which may produce output that differs from the editor view.

            Implementing this should be no big deal, I added the parser as is because I knew it would do the job ;)

            André

             
    • Nobody/Anonymous

      Very nice plugin, Andre.

      I've installed the new version but don't see a menu item for 'current buffer'.  I'm assuming that the new functionality is to reformat the contents of the current window, i.e. from ANSI C++ to KR C++ for example.  Am I misunderstanding you?

      Bahman

       
      • André Simon

        André Simon - 2006-01-09

        The original highlight tool is not a reformatter and indenter in the first place, although it includes the astyle functionality (reformatting). The main purpose is highlighting of code with a simple configuration.

        Unfortunately the astyle code is not very pleasant, and it contains some ugly bugs. It would be easy to provide a astyle plugin, but the project is dead as you can see on the astyle project site here on sf.net. So I see no future in this code.

        I will rename the plugin name "Highlight file" to "Highlight buffer", thanks for pointing that out.

        André

         
    • Nobody/Anonymous

      Andre,

      A couple of suggestions, then, if I may be so bold:

      1.  To implement a 'plain text' output format in order to use highlight as a reformatter/indenter.  I took a look at astyle, and it seems redundant to implement it as a separate plugin when yours already provides the full functionality except for the final step.

      2. To add a 'highlight dialog' menu item to call up the highlight win32 gui with the current file(s) ready to go.

      btw I tried to do this via the n++ Run shell, using

        'C:\Programs\WinHighlight\WinHighlight.exe "$(FULL_CURRENT_PATH)"'

      which resulted in the following errors

      18:53:26: Failed to load icon from the file 'C:\Documents and Settings\user\Application Data\Notepad++\WinHighlight.ico' (error 2: the system cannot find the file specified.)
      18:53:26: Can not enumerate files in directory 'C:\Documents and Settings\user\Application Data\Notepad++\i18n\' (error 3: the system cannot find the path specified.)

      (I found I couldn't get winhighlight to launch correctly from the command line except from within its home directory.  I guess a workaround would be to instead run a batch file which changes to this directory first and then passes the FULL_CURRENT_PATH parameter to winhighlight.)

      Only suggestions, the plugin is quite useful as-is :-)
      Bahman

       
      • André Simon

        André Simon - 2006-01-12

        This is a bug of the GUI ;(

         
    • Nobody/Anonymous

      thanks!
      Bahman

       
    • steakhacher

      steakhacher - 2007-03-05

      Hi,

      Your plugin is a verry good idea and is very interresting, nevertheless I try it on vhdl source file, and there are lots of keyword that are not properly highligh in exported file (even if thay are in vhdl.lang file). If you need some vhdl code language go to http://www.google.com/codesearch and check what I said.

      It is shade that it is not easier to find your plugin.

      By

       
      • André Simon

        André Simon - 2007-09-18

        Hi,

        I will try to finish the vhdl definition by inspecting the VIM file ;)

        André

         
    • Nobody/Anonymous

      Hello, very good idea but...
      What append in a code source .asp
      with html+javascript+vbscript, like in my project 'lutin' on accessibility ?
      How define 3 or more language in one file ?
      By, Philippe.

       
      • André Simon

        André Simon - 2007-09-18

        Hi Philippe,

        unfortunately the current highlight parser cannot switch to another mode while parsing a file.
        But this is on my todo list :)

        André

         
    • André Simon

      André Simon - 2007-09-18

      This plugin was updated to the current higlight code base, including many bugfixes and language parsing improvements.
      Download: http://www.andre-simon.de/zip/NPPHighlightPlugin.zip
      Source: http://www.andre-simon.de/zip/NPPHighlightPluginSrc.zip

       
MongoDB Logo MongoDB