notlmn / copy-as-markdown

🖱 Browser extension to copy hyperlinks, images, and selected text as Markdown with GFM support
MIT License
323 stars 48 forks source link

Support for LaTeX formula #19

Open hotarugali opened 2 years ago

hotarugali commented 2 years ago

Hope to support copying latex formula as markdown. When the web page contains latex formula, it seems that there is something incompatible when using copy-as-markdown. One example is shown as follows, the left is the web page while the right is the markdown text converted by copy-as-markdown.

image

notlmn commented 2 years ago

Can you provide a link to the page that you are testing this on for us to be able to reproduce?

hotarugali commented 2 years ago

The link to the page is https://codeforces.com/contest/1591/problem/D.

notlmn commented 2 years ago

I see a bit different behavior than you do, probably because I'm on Firefox. I suspect this is because of the nobr tag that MathJax uses, this is not pure MathML, the MathJax library handles the rendering in this case and adds/removes additional elements as needed.

It is realistically not possible to handle markup that is created by libraries out in the wild. I would have to say no for this as the effort put in would not make sense for me personally.

I'm open to PRs if anyone is willing to put in the effort to make this work. I'll leave it open for now.