11 Commits

Author SHA1 Message Date
murat f125640ace chore(styling): cleanup 2026-06-16 18:37:00 +03:00
murat 96f1eac252 fix(img): alt text 2026-06-16 18:32:57 +03:00
murat 67824a60b4 feat(styling): horizontal rule 2026-06-16 18:29:59 +03:00
murat 2b89ff29e2 bold and italic text alternative types 2026-06-16 18:18:29 +03:00
murat 74fe93a0ca feat(styling): images 2026-06-16 18:15:44 +03:00
murat 6a294583fa feat(styling): code 2026-06-16 18:15:30 +03:00
murat 60b91d159e feat(styling): blockquote 2026-06-16 18:11:52 +03:00
murat dd97b16890 fix(headers): added h4 h5 h6 2026-06-16 18:05:05 +03:00
murat b7ae3ca52a feat(styling): bold and italic texts 2026-06-16 17:53:00 +03:00
murat 4ca73d02ae feat(styling): headers 2026-06-16 17:46:26 +03:00
murat dbe8bcbb44 feat(styling): line breaks 2026-06-16 17:34:55 +03:00
+33
View File
@@ -122,6 +122,39 @@ for index, value in ipairs(markdownFiles) do
local htmlFile = io.open(workDir .. "/public/" .. markdownFiles[index].fileName .. ".html", 'w')
if htmlFile then
local content = indexFile
-- STYLING
local function styling(s)
-- blockquote
s = s:gsub(">%s*(.-)%s*\r?\n", "<blockquote>%1</blockquote>")
-- line breaks
s = s:gsub("\r?\n", "<br>")
-- headers
s = s:gsub("######%s*(.-)%s*<br>", "<h6>%1</h6>")
s = s:gsub("#####%s*(.-)%s*<br>", "<h5>%1</h5>")
s = s:gsub("####%s*(.-)%s*<br>", "<h4>%1</h4>")
s = s:gsub("###%s*(.-)%s*<br>", "<h3>%1</h3>")
s = s:gsub("##%s*(.-)%s*<br>", "<h2>%1</h2>")
s = s:gsub("#%s*(.-)%s*<br>", "<h1>%1</h1>")
-- TODO: h1 and h2 using == and --
-- bold and italic text
s = s:gsub("%*%*(.-)%*%*", "<b>%1</b>")
s = s:gsub("%*(.-)%*", "<i>%1</i>")
s = s:gsub("%_%_(.-)%_%_", "<b>%1</b>")
s = s:gsub("%_(.-)%_", "<i>%1</i>")
-- images
s = s:gsub("!%[(.-)%]%((.-)%)", '<img src="%2" alt="%1"></img>')
-- links
s = s:gsub("%[(.-)%]%((.-)%)", '<a href="%2">%1</a>')
-- code
s = s:gsub("`(.-)`", "<code>%1</code>")
-- horizontal rule
s = s:gsub("%-%-%-", "<hr>")
return s
end
markdownFiles[index].content = styling(markdownFiles[index].content)
-- replace <!-- sitecontents --> with markdown file content
local start_idx, end_idx = content:find("<!-- sitecontents -->", 1, true)
if start_idx and end_idx then