html-syntax-highlight

highlight code within an html file
Index Commits Files Refs README LICENSE
commit cf28c767fbe820a61005a110507a32e8adfa55ea
parent 9131263432fae3e67f9a0d65ac4cf80962a252bd
Author: mjkloeckner <martin.cachari@gmail.com>
Date:   Tue, 17 Jan 2023 17:39:17 -0300

add README

Diffstat:
AREADME.md | 38++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+), 0 deletions(-)
diff --git a/README.md b/README.md
@@ -0,0 +1,38 @@
+# Highlight code on a static html file
+
+This program parses an html file and adds
+[chroma](https://github.com/alecthomas/chroma) classes to code within pre and
+code tags. Then you can add chroma themes with css.
+
+## Running
+
+Make sure you have [golang](https://go.dev/) installed (if not follow this
+[instructions](https://go.dev/doc/install))then run:
+
+```go
+$ go run main.go <test_file.html>
+```
+
+with `<test_file.html>` being an html file containing some code to highlight.
+This is an example of a code snippet within an html file that this program
+should add css classes
+
+```html
+(...)
+<pre><code class="language-c">
+#include <stdio.h>
+
+int main(void) {
+    char *hw = "Hello, world!\n";
+
+    printf("%s\n", hw);
+    return 0;
+}
+</code></pre>
+(...)
+```
+
+But it uses regular expression so it should be easier to adapt to other formats.
+
+## License
+[MIT](https://opensource.org/licenses/MIT)