19 lines
362 B
Lua
19 lines
362 B
Lua
-- If a file has front matter `part: true`, keep its headings as-is.
|
|
-- Otherwise, demote all headings by one level: # -> ##, ## -> ###, etc.
|
|
|
|
local is_part_doc = false
|
|
|
|
function Meta(m)
|
|
print(m)
|
|
if m.part == true then
|
|
is_part_doc = true
|
|
end
|
|
end
|
|
|
|
function Header(h)
|
|
if not is_part_doc then
|
|
h.level = math.min(h.level + 1, 6)
|
|
end
|
|
return h
|
|
end
|