Skip to content

Latest commit

 

History

History
50 lines (40 loc) · 1.11 KB

README.md

File metadata and controls

50 lines (40 loc) · 1.11 KB

highlightjs-riscvasm - RISC-V grammar for highlight.js

Usage

Static website

Simply load the grammar after loading Highlight.js:

<link rel="stylesheet" href="/path/to/styles/default.min.css">
<script src="/path/to/highlight.min.js"></script>
<script src="/path/to/riscvasm.min.js">
<script>hljs.highlightAll();</script>

You also can import it as a module:

<link rel="stylesheet" href="/path/to/styles/default.min.css">
<script type="module">
    import hljs from '/path/to/highlight.min.js';
    import riscvasm from '/path/to/riscvasm.es.min.js';
    hljs.registerLanguage('riscv', riscvasm); // register it.
    hljs.highlightAll();
</script>

Your html may look like:

<pre><code class="language-riscv">
    ...
</code></pre>

ES6 Module

It can be imported as a module, then register it. CommonJS also works in the same way.

import hljs from 'highlight.js';
import riscvasm from 'highlightjs-riscvasm';

hljs.registerLanguage("riscv", riscvasm);
hljs.highlightAll();

Your html may look like:

<pre><code class="language-riscv">
    ...
</code></pre>