Origami Frontend Components & Services

JSDoc: o-syntax-highlight

new SyntaxHighlight(...)

Class constructor.

parameter type default description
syntaxEl (optional) HTMLElement | string The element to highlight in the DOM
options (optional) object {} An options object for configuring the message
options.language string The language to tokenise the code for




Instance Method

Tokenise string for highlighting


  • HTMLElement - tokenised code in the form of HTML elements


SyntaxHighlight.init(rootElement, options)

Static Method

Initialise syntax highlighting.

parameter type default description
rootElement HTMLElement | string The root element to intialise a message in, or a CSS selector for the root element
options (optional) object {} An options object for configuring the syntax highlighting


  • SyntaxHighlight | Array.<SyntaxHighlight> - - The SyntaxHighlight instance or instances


Switch component view

GitHub: o-syntax-highlight@4.2.3

Install o-syntax-highlight

If using the Build Service, add o-syntax-highlight@^4.2.3 to your script and link tags.

If using the npm package manager for a Manual Build, run npm install --save-peer "@financial-times/o-syntax-highlight@^4.2.3".

Help & Support

o-syntax-highlight is maintained directly by the Origami team. If you have any questions about o-syntax-highlight or Origami in general, we are happy to help. 😊

Slack: #origami-support
Email: origami.support@ft.com

Feedback / Issues

To report a bug or request features please create an issue on Github. For support or general feedback please get in touch 😊

Slack: #origami-support
Email: origami.support@ft.com