Manually render internal links #10216
Closed
champignoom
started this conversation in
General
Replies: 1 comment
-
Solved. function Link(elem)
if elem.target:sub(1,1) ~= '#' then return end
local span = pandoc.Span(elem.content)
span.attributes['custom-style'] = 'Hyperlink'
return {
pandoc.RawInline('openxml', [[<w:r><w:fldChar w:fldCharType="begin"/></w:r>]]),
pandoc.RawInline('openxml', [[<w:r><w:instrText xml:space="preserve"> HYPERLINK \l "]] .. elem.target:sub(2) .. [[" </w:instrText></w:r>]]),
pandoc.RawInline('openxml', [[<w:r><w:fldChar w:fldCharType="separate"/></w:r>]]),
span,
pandoc.RawInline('openxml', [[<w:r><w:fldChar w:fldCharType="end"/></w:r>]]),
}
end |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Internal links
[the link](#header1)
is currently rendered into docx as:Unfortunately, this doesn't work in wps, which accepts the following:
How to write a lua filter to render a Link in the second way above?
Beta Was this translation helpful? Give feedback.
All reactions