I have body of text in a Google Doc containing a large number of links. I need to get the text – and all the links – into my client's CMS.

I've tried "Download as" > "Web page (.html, zipped)" and uploading that file into Text Wrangler to clean it up, but the links are all scrambled – e.g something twitter.com/sree becomes:

<a href="https://www.google.com/url?q=https://twitter.com/sree&amp;sa=D&amp;ust=1465095908840000&amp;usg=AFQjCNHpFpNdY6Hsr5xrZZlF5vCGTGIt6w">Sree Sreenivasan</a>

Rather than go in and re-do all the links manually, is there any way to get the HTML code I need from the Google Doc?

2 Answers 2


You can use a regular expression like this in Text Wrangler :

<a href="https://www.google.com/url\?q=(.*)\&amp;sa(.*)">(.*)</a>

and replace by :

<a href="$1">$3</a>

If you want to convert links in Google Docs to HTML, give the gd2md-html add-on a try (full disclosure: I developed this): https://github.com/evbacher/gd2md-html/wiki

You can select a section of text from a Google Doc that includes links, and convert that to HTML. For example this section from a Google Doc:

enter image description here

converts to this relatively clean HTML:

<h2>Markdown syntax, standards information</h2>
<li>Basic Markdown syntax from John Gruber, the inventor of Markdown: 
<a href="https://daringfireball.net/projects/markdown/syntax">https://daringfireball.net/projects/markdown/syntax</a>
<li>CommonMark standard: <a href="http://commonmark.org/">http://commonmark.org/</a>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.