Skip to content

Commit

Permalink
feat: Render ==text== (mark extension) with mark element in HTML5
Browse files Browse the repository at this point in the history
  • Loading branch information
Omikhleia authored and Didier Willis committed Sep 27, 2023
1 parent 1ce963e commit 96c05c8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lunamark/writer/html5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ function M.new(options)
options = options or {}
local Html5 = html.new(options)

local htmlSpan = Html5.span -- inherited, for overriding

Html5.container = "section"

Html5.template = [[
Expand All @@ -36,6 +38,14 @@ $body
return {"<del>", s, "</del>"}
end

function Html5.span(s, attr)
-- HTML5 has semantic <mark>
if attr.class == "mark" then
return {"<mark>", s, "</mark>"}
end
return htmlSpan(s, attr)
end

return Html5
end

Expand Down

0 comments on commit 96c05c8

Please sign in to comment.