Syntax.js - Documentation - Public Functions
Below is a list of all the public API functions that can be called from a Syntax.js service.
Download Now
Below is a list of all the public API functions that can be called from a Syntax.js service.
Download Now
Finds all new code elements and renders them.
Fires: onRenderComplete
Returns: Object - The Syntax.js class instance.
Renders a specific DOM element.
Fires: onRenderComplete
Parameter: name: Object - The element ID, or the element itself.
Returns: Object - The Syntax.js class instance.
Returns the elements that have been detected and rendered.
Returns: Object[] - An array containing the rendered DOM elements.
Returns the code inside a specific element (without rendering colors).
Parameter: elementId: string - The element ID.
Returns: string - The code in the element.
Reverts a Syntax element back to its original state (without render attributes).
Parameter: elementId: string - The ID of the DOM element to destroy.
Returns: Object - The Syntax.js class instance.
Reverts all rendered Syntax elements back to their original state (without render attributes).
Returns: Object - The Syntax.js class instance.
Adds a new language that can be rendered.
Fires: onRenderComplete
Parameter: name: string - The name of the language.
Parameter: languageDetails: Object - The language details (refer to "Language" documentation for properties).
Parameter: [triggerRender]: boolean - States if new language DOM elements available should be rendered.
Returns: boolean - States if the language has been added.
Removes a language that can be rendered.
Parameter: name: string - The name of the language.
Returns: boolean - States if the language has been removed.
Returns the language details (by name) that can be rendered.
Parameter: name: string - The name of the language.
Returns: Object - The language details.
Returns all the languages that can be rendered.
Returns: Object - The object that contains the languages.
Adds a new language alias.
Fires: onRenderComplete
Parameter: alias: string - The name of the alias.
Parameter: language: string - The name of the language.
Parameter: [triggerRender]: boolean - States if new language alias DOM elements available should be rendered.
Returns: boolean - States if the alias has been added.
Removes a language alias.
Parameter: alias: string - The name of the alias.
Returns: boolean - States if the alias has been removed.
Returns a language alias.
Parameter: alias: string - The name of the alias.
Returns: Object - The name of the language.
Returns all the language aliases.
Returns: Object - The object that contains the aliases.
Sets the specific configuration options that should be used.
Parameter: newOptions: Options - All the configuration options that should be set (refer to "Configuration Options" documentation for properties).
Returns: Object - The Syntax.js class instance.
Returns the version of Syntax.js.
Returns: string - The version number.