ForgeComponents
en

Components

j-HighlightSyntax

jComponent 20 · jcomponent@20 component Example loaded with jComponent 20

Simple syntax highlighter with help of Highlight.js.


Configuration:

  • type needs to contain a content-type for highlighting

Use it with <ui-component name="highlightsyntax">. When the component is not loaded yet, jComponent downloads it on first use from the address in DEF.fallback (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.

example.html
<ui-component name="highlightsyntax" path="exampleHTML" config="type:html"></ui-component>
<ui-component name="highlightsyntax" path="exampleJS" config="type:js"></ui-component>
<ui-component name="highlightsyntax" path="exampleCSS" config="type:css"></ui-component>

<script>
	var exampleHTML = "This is <b>HTML</b>";
	var exampleJS = "var a = 0;";
	var exampleCSS = "body { color: red; }";
</script>