sinedied / backslide

:sweat_drops: CLI tool for making HTML presentations with Remark.js using Markdown
https://sinedied.github.io/backslide
MIT License
764 stars 50 forks source link

Escaping inlined image between backquotes (as code content) does not prevent its replacement by base64 data #66

Open vincent-ferotin opened 4 years ago

vincent-ferotin commented 4 years ago

When putting text for an inline image (![Alt text](/img/url)) between backtick quotes (`), for showing some MarkDown code (see reference), does not prevent image URL replacement by its base64 data counterpart -- at least for HTML and PDF exports (works well in browser via bs serve).

Medium via command Inserted or not
bs serve (in browser) ok, :-)
bs export (dist/HTML) ko, :-(
bs pdf (pdf/PDF) ko, :-(

See #64 for initial prospection and a demonstrating repository: https://github.com/vincent-ferotin/backslide-imageinpdf

vincent-ferotin commented 4 years ago

Same behavior seems to occur for background-image, where their URL (url(./img/Image.jpg), when escaped in a code content, are transformed with base64 data counterparts, when generating both HTML and PDF (works as expected in browser via bs serve). Of course, when URL does not exist (e.g. url(./img/Sunset....jpg)), URL is replaced by url(undefined) and an error is reported when generating output ("0% exporting file 1/2ENOENT: no such file or directory, open '/home/[...]/backslide/testimagepdf/./img/Sunset....jpg'").

See previous demo. repo. for demonstration.

sinedied commented 4 years ago

Yes, there was many updates to the image replacement regexp and there's some bug that got introduced I think :/

If you're willing to put up a PR to fix it for backticks inclusion, I'll gladly merge it but I don't have time to take a look at it myself anytime soon.

Thanks for the details and repro example BTW, this really helps with issues like this 👍

vincent-ferotin commented 4 years ago

I'm sorry to not have enough time soon too, to further explore the bug and search for some fix(es) :-( -- at least for this week! (Perhaps from next week? but could not be sure...)