The HTML element containing code to highlight
Highlighting options
Optionalcallback: FunctionOptional callback executed after highlighting is complete
Returns false if no valid mode is found, otherwise true
Transforms a given input code snippet into HTML using the given mode
Code snippet
String specifying the mode to load such as
ace/mode/javascript or, a mode loaded from /ace/mode
(use 'ServerSideHiglighter.getMode').
String specifying the theme to load such as
ace/theme/twilight or, a theme loaded from /ace/theme.
A number indicating the first line number. Defaults to 1.
Specifies whether or not to disable the gutter.
true disables the gutter, false enables the gutter. Defaults to false.
Optionalcallback: FunctionWhen specifying the mode or theme as a string,
this method has no return value and you must specify a callback function. The
callback will receive the rendered object containing the properties html
and css.
An object containing the properties html and css.
Transforms a given input code snippet into HTML using the given mode
Code snippet
Mode loaded from /ace/mode (use 'ServerSideHiglighter.getMode')
An object containing: html, css
Applies syntax highlighting to an HTML element containing code.
Automatically detects the language from CSS class names (e.g., 'lang-javascript') or uses the specified mode. Transforms the element's content into syntax-highlighted HTML with CSS styling and preserves any existing child elements by repositioning them after highlighting.