Overview
Introduction
This page is an introduction to the code-example custom element. It provides a description of the library and acts as a reference for documentation and examples.
Custom Element
The <code-example> custom element renders code in a syntax-highlight text block and, if possible, the results of that code in a display frame.
The element is intended for use in documentation, tutorials, demos, or any other place where an example of code would be helpful.
To use the <code-example> custom element, add it to a page with at least one <code> element in its children.
Assign the code element a slot attribute to activate it as example code. Assign a class of language-js, language-html, or language-css to apply syntax highlighting for the respective language.
Installation
This library is available as a single file that can be referenced using a <script> element. It can also be installed using any of the javascript package managers below:
npm install @magnit-ce/code-example