rufuspollock/markdown2latex

Multiple link occurrences in text are always replaced with the first one

h4b4n3r0 opened this issue · 0 comments

import markdown
import mdx_latex
md = markdown.Markdown()
latex_mdx = mdx_latex.LaTeXExtension()
latex_mdx.extendMarkdown(md, markdown.__dict__)
out = md.convert("[The first url](https://www.google.de). Text in between. [The second url](https://www.bing.com)")
print(out)

leads to

<root>

\href{https://www.google.de}{The first url}. Text in between. \href{https://www.google.de}{The first url}


</root>

however, it should be converted to

<root>

\href{https://www.google.de}{The first url}. Text in between. \href{https://www.bing.com}{The second url}


</root>

Problem is in https://github.com/rufuspollock/markdown2latex/blob/master/mdx_latex.py#L534 as the one regex replaces all matches with the identical text.