mn-code

a component to display code with syntax highlight

Usage no npm install needed!

<script type="module">
  import mnCode from 'https://cdn.skypack.dev/mn-code';
</script>

README

npm version Dependency Status MIT Licence

mn-code

A component to display code with syntax highlight

See the demo

Install

npm install --save mn-code

And bundle dependencies and main files in dist/ with your preferred tool.

Usage

Use the tag mn-code and put your code

<mn-code class="js">
  // a hello world
  console.log('hello')
</mn-code>

the component automatically recognize the language, but if you want specify the language, using a css class. The following classes be available html, css, js, and sh (shell script).