lbeckman314 / mdbook-latex

An mdbook backend for generating LaTeX and PDF documents.
https://liambeckman.com/code/mdbook-latex/
Mozilla Public License 2.0
104 stars 12 forks source link

Fix images 2 #10

Closed enaut closed 4 years ago

enaut commented 4 years ago

This suggestion improves on the previous pullrequest.

If in any part of the book the url of an image had been written outside of an image tag or as part of another image or as part of something else. the replace would have replaced it with something else. Therefor the replace solution is not optimal.

In this version the markdown parser is actually used to change the parsed markdown. Then this parser is written back to the markdown string. The string is then processed the same as new_content before.

I also added the dependency to the branch in my git repository so this hopefully compiles in the CI.

A further thought would be to merge md2tex into the lib.rs of mdbook-latex as both are not complex and some parsing and reparsing and context could be handled much easier.

PS: I just read the rustbook and are new to rust too. So there might be things that I did weird or redundant. Happy if you spot anything.

obsoletes: #9 fixes: #5

enaut commented 4 years ago

Can you comment on this one? as you included my other proposal the new version of md2tex does not work with the unchanged mdbook-latex.

lbeckman314 commented 4 years ago

Thank you for your patience! I should've taken a bit more care to make sure the new versions worked together, but I will work to get your branch integrated with md2tex and pulled into master. I will update here and thanks again!