html-syntax-highlight

highlight code within an html file
Index Commits Files Refs README LICENSE
README.md (1111B)
   1 # Highlight code on a static html file
   2 
   3 This program parses an html file and adds
   4 [chroma](https://github.com/alecthomas/chroma) classes to code within pre and
   5 code tags. Then you can add chroma themes with css.
   6 
   7 ## Running
   8 
   9 Make sure you have [golang](https://go.dev/) installed (if not follow this
  10 [instructions](https://go.dev/doc/install))then run:
  11 
  12 ```shell
  13 $ go run main.go <test_file.html>
  14 ```
  15 
  16 with `<test_file.html>` being an html file containing some code to highlight.
  17 This is an example of a code snippet within an html file that this program
  18 should add css classes
  19 
  20 ```html
  21 (...)
  22 <pre><code class="language-c">
  23 #include <stdio.h>
  24 
  25 int main(void) {
  26     char *hw = "Hello, world!\n";
  27 
  28     printf("%s\n", hw);
  29     return 0;
  30 }
  31 </code></pre>
  32 (...)
  33 ```
  34 
  35 But it uses regular expression so it should be easier to adapt to other formats.
  36 
  37 ## Example
  38 The main purpose of this program was to highlight code snippets on my blog.
  39 Checkout [this post](https://kloeckner.com.ar/blog/testing-syntax-highlight/testing-syntax-highlight)
  40 that I made to test it.
  41 
  42 ## License
  43 [MIT](https://opensource.org/licenses/MIT)