Skip to content

Instantly share code, notes, and snippets.

@lierdakil
Last active April 9, 2023 08:15
Show Gist options
  • Select an option

  • Save lierdakil/00d8143465a488e0b854a3b4bf355cf6 to your computer and use it in GitHub Desktop.

Select an option

Save lierdakil/00d8143465a488e0b854a3b4bf355cf6 to your computer and use it in GitHub Desktop.
Pandoc filter to parse GitLab math
function Math(el)
if el.mathtype == "InlineMath" then
if el.text:sub(1,1) == '`' and el.text:sub(#el.text) == '`' then
local text = el.text:sub(2,#el.text-1)
return pandoc.Math(el.mathtype, text)
else
local cont = pandoc.read(el.text)
return { pandoc.Str("$") } .. cont.blocks[1].content .. { pandoc.Str("$") }
end
end
end
function CodeBlock(el)
if el.classes[1] == "math" then
return pandoc.Para({ pandoc.Math("DisplayMath", el.text) })
end
end
@yfyf

yfyf commented Jun 19, 2020

Copy link
Copy Markdown

Thanks <3

@ziotom78

Copy link
Copy Markdown

Many thanks, this is exactly what I needed!

@stephanlachnit

Copy link
Copy Markdown

@lierdakil could you give a license for this so it can be safely copied?

@lierdakil

Copy link
Copy Markdown
Author

@stephanlachnit consider this published under WTHPL v1.0. Or if you insist on something less tongue-in-cheek, MIT.

@stephanlachnit

Copy link
Copy Markdown

Thanks!

@kei10007

kei10007 commented Apr 9, 2023

Copy link
Copy Markdown

thank you so much!!! Very usefull !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment