SCodeExampleComponent
This CustomElement make use of related resource(s).This component represent a code example that make sure your passed code(s) is displayed well using under the hood the AMAZING highlightjs library.
Preview
Loading code example. Please wait...
Loading code example. Please wait...
Features
-
Can display out of the bos codes like
bash
,shell
,css
,js
,php
andhtml
-
Possibility to add some languages through the property
languages
-
Full support for sugar theming system for easy integration
Import
Install
Interface
-
activeString
Specify which "tab" is active in case of multiple languages examples
-
toolbar["copy"]
- copy
Array<String>Specify what you want in the toolbar. Currently available item is "copy"
-
toolbarPositionnav
- content
- nav
StringSpecify the toolbar position. Can be "content" or "nav"
-
languages{}Object
Specify some languages that you want to support. Must be "[key]: language" object syntax. See highlight.js doc for supported languages
-
items[]Object[]
Specify the items to put in your code example
-
lines15Number
Specify how many lines to display at max
-
moreLabelShow moreString
Specify the "show more" button label
-
lessLabelShow lessString
Specigy the "show less" button label
-
moreActiontoggle
- toggle
StringSpecify the action to execute when click on the "more" button. Currently available action is "toggle"
-
morefalseBoolean
Specify if you want to expand the more feature at start or not
-
scrollOnMoretrueBoolean
Specify if you want to scroll to the code when clicking on the "show more/less" button
-
scrollToSettings{}Object
Specify some scrollTo settings
Related resource(s)
highlight.js
197 languages and 248 styles automatic language detection multi-language code highlighting available for node.js works with any markup compatible with any js framework Get version 11.7.0 Usage