embed local files, but not URLs?

Is there any way to use rmarkdown::html_document() to yield an html file that has the local files embedded, but not URLs? I'd like to leave any URLs (to things like CDNs, etc) as they are. I tried self_contained=false, but that leaves the local files as links to local folders.

To prevent Pandoc for embeding some links, you need to add data-external attributes to them

See Pandoc - Pandoc User’s Guide