Class ColorerSyntaxHighlighter


  • @NonNls
    public class ColorerSyntaxHighlighter
    extends Object
    Highlights source code using JHighlight library. JHighlight supports a rather limited set of languages, so many languages are highlighted on the client-side with a JS library.
    • Constructor Detail

      • ColorerSyntaxHighlighter

        public ColorerSyntaxHighlighter()
    • Method Detail

      • highlight

        @Nullable
        public static String highlight​(@NotNull
                                       String source,
                                       @NotNull
                                       String name)
                                throws IOException
        Highlight source and output as styled HTML
        Parameters:
        source - text
        name - source file name to help deduce language
        Returns:
        styled HTML, or null
        Throws:
        IOException - if I/O error occurs
      • getStyle

        @NotNull
        public static String getStyle​(@NotNull
                                      String name)
        Returns the style that needs to be embedded in result HTML. Currently needed only if JHighlight engine is turned on.
        Parameters:
        name - the file name to help deduce language
        Returns:
        the required style