diff --git a/luago.lua b/luago.lua
index be7605e..03880ad 100644
--- a/luago.lua
+++ b/luago.lua
@@ -124,31 +124,36 @@ for index, value in ipairs(markdownFiles) do
local content = indexFile
-- STYLING
- -- blockquote
- markdownFiles[index].content = markdownFiles[index].content:gsub(">%s*(.-)%s*\r?\n", "
%1
")
- -- line breaks
- markdownFiles[index].content = markdownFiles[index].content:gsub("\r?\n", "
")
- -- headers
- markdownFiles[index].content = markdownFiles[index].content:gsub("######%s*(.-)%s*
", "%1
")
- markdownFiles[index].content = markdownFiles[index].content:gsub("#####%s*(.-)%s*
", "%1
")
- markdownFiles[index].content = markdownFiles[index].content:gsub("####%s*(.-)%s*
", "%1
")
- markdownFiles[index].content = markdownFiles[index].content:gsub("###%s*(.-)%s*
", "%1
")
- markdownFiles[index].content = markdownFiles[index].content:gsub("##%s*(.-)%s*
", "%1
")
- markdownFiles[index].content = markdownFiles[index].content:gsub("#%s*(.-)%s*
", "%1
")
- -- TODO: h1 and h2 using == and --
- -- bold and italic text
- markdownFiles[index].content = markdownFiles[index].content:gsub("%*%*(.-)%*%*", "%1")
- markdownFiles[index].content = markdownFiles[index].content:gsub("%*(.-)%*", "%1")
- markdownFiles[index].content = markdownFiles[index].content:gsub("%_%_(.-)%_%_", "%1")
- markdownFiles[index].content = markdownFiles[index].content:gsub("%_(.-)%_", "%1")
- -- images
- markdownFiles[index].content = markdownFiles[index].content:gsub("!%[(.-)%]%((.-)%)", '
')
- -- links
- markdownFiles[index].content = markdownFiles[index].content:gsub("%[(.-)%]%((.-)%)", '%1')
- -- code
- markdownFiles[index].content = markdownFiles[index].content:gsub("`(.-)`", "%1")
- -- horizontal rule
- markdownFiles[index].content = markdownFiles[index].content:gsub("%-%-%-", "
")
+ local function styling(s)
+ -- blockquote
+ s = s:gsub(">%s*(.-)%s*\r?\n", "%1
")
+ -- line breaks
+ s = s:gsub("\r?\n", "
")
+ -- headers
+ s = s:gsub("######%s*(.-)%s*
", "%1
")
+ s = s:gsub("#####%s*(.-)%s*
", "%1
")
+ s = s:gsub("####%s*(.-)%s*
", "%1
")
+ s = s:gsub("###%s*(.-)%s*
", "%1
")
+ s = s:gsub("##%s*(.-)%s*
", "%1
")
+ s = s:gsub("#%s*(.-)%s*
", "%1
")
+ -- TODO: h1 and h2 using == and --
+ -- bold and italic text
+ s = s:gsub("%*%*(.-)%*%*", "%1")
+ s = s:gsub("%*(.-)%*", "%1")
+ s = s:gsub("%_%_(.-)%_%_", "%1")
+ s = s:gsub("%_(.-)%_", "%1")
+ -- images
+ s = s:gsub("!%[(.-)%]%((.-)%)", '
')
+ -- links
+ s = s:gsub("%[(.-)%]%((.-)%)", '%1')
+ -- code
+ s = s:gsub("`(.-)`", "%1")
+ -- horizontal rule
+ s = s:gsub("%-%-%-", "
")
+
+ return s
+ end
+ markdownFiles[index].content = styling(markdownFiles[index].content)
-- replace with markdown file content
local start_idx, end_idx = content:find("", 1, true)