bapt auguie <auguieba-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
> I would like to walk the AST, and immediately after headers with a specific
> attribute, inject a \renewcommand{} based on the header's attributes, such
> as (dummy example),
>
> \renewcommand\subsection[1]{\textbf{#1}}
This is pretty easy. You would have a function
function Header(el)
local attr = el.attributes
-- you can do attr['foo'] to get the value of the 'foo' attribute
-- now create a string with the macro:
local macro = ...
return { el, pandoc.RawBlock("latex", macro) }
end
You can fill in the blanks.