Created
June 10, 2024 18:40
-
-
Save avidrucker/9c6e3fa13a36efadd45e0a6c48cbbabd to your computer and use it in GitHub Desktop.
Testing out highlight.js for the purpose of custom syntax highlighting LCC Assembly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css"> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script> | |
| <script src="https://unpkg.com/browse/@highlightjs/cdn-assets@11.9.0/languages/mipsasm.min.js"></script> | |
| <title>Document</title> | |
| </head> | |
| <body> | |
| <h1>Highlight.js Test 001</h1> | |
| <pre> | |
| <code class="language-c"> | |
| #include <stdio.h> | |
| int main() { | |
| printf("Hello, world!"); | |
| return 0; | |
| } | |
| </code> | |
| </pre> | |
| <pre> | |
| <code class="language-mips"> | |
| ; LCC Assembly Greetings Program | |
| lea r0, ask | |
| sout r0 | |
| sin r0 | |
| lea r1, hi | |
| sout r1 | |
| sout r0 | |
| lea r0, period | |
| sout r0 | |
| halt | |
| ask: .string "What's your name? " | |
| hi: .string "Hi, " | |
| period: .string "." | |
| </code> | |
| </pre> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', (event) => { | |
| document.querySelectorAll('pre code').forEach((el) => { | |
| hljs.highlightElement(el); | |
| }); | |
| }); | |
| </script> | |
| <script>hljs.highlightAll();</script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment