alpha
This commit is contained in:
@@ -121,39 +121,62 @@ function M:custom(str)
|
||||
return self
|
||||
end
|
||||
|
||||
function M:g(str)
|
||||
self:custom(str)
|
||||
return self
|
||||
end
|
||||
|
||||
function M:h1(str)
|
||||
str = str or ""
|
||||
table.insert(self.parts, "<h1>" .. str .. "</h1>")
|
||||
self:custom("<h1>" .. str .. "</h1>")
|
||||
return self
|
||||
end
|
||||
|
||||
function M:h2(str)
|
||||
str = str or ""
|
||||
table.insert(self.parts, "<h2>" .. str .. "</h2>")
|
||||
self:custom("<h2>" .. str .. "</h2>")
|
||||
return self
|
||||
end
|
||||
|
||||
function M:h3(str)
|
||||
str = str or ""
|
||||
table.insert(self.parts, "<h3>" .. str .. "</h3>")
|
||||
self:custom("<h3>" .. str .. "</h3>")
|
||||
return self
|
||||
end
|
||||
|
||||
function M:h4(str)
|
||||
str = str or ""
|
||||
table.insert(self.parts, "<h4>" .. str .. "</h4>")
|
||||
self:custom("<h4>" .. str .. "</h4>")
|
||||
return self
|
||||
end
|
||||
|
||||
function M:h5(str)
|
||||
str = str or ""
|
||||
table.insert(self.parts, "<h5>" .. str .. "</h5>")
|
||||
self:custom("<h5>" .. str .. "</h5>")
|
||||
return self
|
||||
end
|
||||
|
||||
function M:h6(str)
|
||||
str = str or ""
|
||||
table.insert(self.parts, "<h6>" .. str .. "</h6>")
|
||||
self:custom("<h6>" .. str .. "</h6>")
|
||||
return self
|
||||
end
|
||||
|
||||
function M:p(str)
|
||||
str = str or ""
|
||||
table.insert(self.parts, "<p>" .. str .. "</p>")
|
||||
return self
|
||||
end
|
||||
|
||||
function M:note(content)
|
||||
content = content or ""
|
||||
self:custom('<div class="note">' .. content .. '</div>')
|
||||
return self
|
||||
end
|
||||
|
||||
function M:a(link, str)
|
||||
str = str or ""
|
||||
table.insert(self.parts, "<a href=\"" .. link .. "\">" .. str .. "</a>")
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
19
core/markdown.lua
Normal file
19
core/markdown.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
local M = {}
|
||||
|
||||
-- Markdown to HTML conversion function
|
||||
-- Uses the Go backend markdown parser
|
||||
function M.to_html(markdown_text)
|
||||
markdown_text = markdown_text or ""
|
||||
|
||||
-- Get the fes module
|
||||
local fes_mod = package.loaded.fes
|
||||
if fes_mod and fes_mod.markdown_to_html then
|
||||
return fes_mod.markdown_to_html(markdown_text)
|
||||
end
|
||||
|
||||
-- Fallback: return error message if Go function not available
|
||||
return "<p>Error: markdown_to_html function not available</p>"
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@@ -16,4 +16,4 @@ function M.site_version()
|
||||
return ""
|
||||
end
|
||||
|
||||
return M
|
||||
return M
|
||||
Reference in New Issue
Block a user