updated docs

This commit is contained in:
2026-08-28 10:19:52 +01:00
parent df14c0ddcf
commit 7f5da09280
4 changed files with 40 additions and 17 deletions
+8
View File
@@ -15,6 +15,8 @@ MASTODON_PREFIX :: "<a rel=me href=https://linuxrocks.online/@simonkellet></a>\n
HIGHLIGHT_JS_PREFIX :: "<script type=\"text/javascript\" src=\"https://unpkg.com/@highlightjs/cdn-assets@11.11.1/highlight.min.js\"></script>\n<script type=\"text/javascript\" src=\"https://unpkg.com/highlightjs-odinlang@1.4.0/dist/odin.min.js\"></script>\n\n<script type=\"text/javascript\">\n hljs.highlightAll();\n</script>"
// Write important HTML prefixes to files. This includes:
// - css, utf8, favicon, mastadon and, conditionally, hljs
write_prefixs_to_html_file :: proc(file: ^os.File) {
file_info, err := os.fstat(file, context.temp_allocator)
if err != nil {
@@ -34,6 +36,7 @@ write_prefixs_to_html_file :: proc(file: ^os.File) {
}
}
// Walk the tree of the given path and build a string array of all valid .md files
walk_tree_and_get_md_names :: proc(path: string, allocator := context.allocator) -> [dynamic]string {
files := make([dynamic]string, allocator)
@@ -65,6 +68,8 @@ walk_tree_and_get_md_names :: proc(path: string, allocator := context.allocator)
return files
}
// sck: INFO: this is currently unused!
// Taken from: Odin doc from os
walk_tree :: proc(path: string) -> []u8 {
filename: string
md_file: []u8
@@ -88,6 +93,9 @@ walk_tree :: proc(path: string) -> []u8 {
return nil
}
// Simply parse all .md files into HTML files (basically where the magic happens)
// TODO: I think we leak memory here? Each node does not get free'd correctly
// according to mem's tracking allocator...
parse_file_md_to_html :: proc(filename: string, allocator := context.allocator, ) -> (parsed: string, err: os.Error) {
str := os.read_entire_file_from_path(filename, allocator) or_return
root := cm.parse_document_from_string(string(str), cm.DEFAULT_OPTIONS)