blob: d206530e64fb2d1f3e989065d7a829b1da7cef6d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
--- Apply markup to a file
---@param content string
---@param args { bold: boolean, italic: boolean, fg: string, bg: string }
---@return string
return function(content, args)
args = args or {}
if args.bold then
content = "<b>" .. content .. "</b>"
end
if args.italic then
content = "<i>" .. content .. "</i>"
end
local span_content = ""
if args.fg or args.bg then
if args.fg then
span_content = "foreground='" .. args.fg .. "'"
end
if args.bg then
span_content = " background='" .. args.bg .. "'"
end
content = "<span " .. span_content .. ">" .. content .. "</span>"
end
return content
end
|