Lua filter to match element and its parent #9658
Answered
by
jgm
johnmapeson
asked this question in
Q&A
-
|
I try to create a Lua filter to preserve videos while converting from HTML to GitHub Flavored Markdown (GFM). local function starts_with(start, str)
return str:sub(1, #start) == start
end
function RawBlock(el)
return starts_with('<source', el.text)
and pandoc.RawBlock('markdown', el.text)
or {}
endInput HTML: Output Markdown: As you can see, the problem is that it preserves Changing |
Beta Was this translation helpful? Give feedback.
Answered by
jgm
Apr 14, 2024
Replies: 1 comment
-
|
Why not something like: return ((starts_with('<source', el.text) or starts_with('<video',el.text))
and pandoc.RawBlock('markdown', el.text))
or {} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
johnmapeson
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why not something like: