I‘ve been using pandoc to extract texts next to my notes (both in Markdown) in order to add links between them. I haven’t extracted too many pages yet, but the results were reasonable so far, although sometimes lots of html tags remain. Also, none of them contained any math so far.