The question has come up many times over the years.
I can say with confidence, that I have personally tested this, and I have multiple witnesses.
Now this is going to be a bit of a lame article, as I can’t show you the results. You’re going to have to take my word for it, but that should be fine since I have thousands of articles around the web going back over 20 years.
My most recent test was on a page which pulled content from an external site and displayed it on their page using the document.write method.
As soon as the page was crawled the content was indexed and showed up in SERPs.
Within a week or two, links to the target site showed up in Google Search Console.
Testing was performed in November 2016.
There are multiple articles around the web which state content and links can not be crawled or indexed. That information is wrong.