How to paste source code in Google docs without creating bunch of new paragraphs? – Despite Google Docs excellence, there can be problems in accessing the service. You may not be able to clear out storage space, share files, or are unable to access a document. Thankfully, many Google Docs problems are easy to fix. With Google Docs, specifically, whether you’re storing and managing your documents, there’s a decent chance you’ll run into some manner of murkiness along the way. We’re going to offer some typical Google Docs troubleshooting tips, then solve some specific Google Docs problems, like How to paste source code in Google docs without creating bunch of new paragraphs?, and how to fix it.
When I paste source code in Google docs document, every line of the source is on a new paragraph. That creates unnatural spacing between lines.
I can manually fix this by tediously removing each paragraph and then inserting new line with Shift+Enter. But is there a way to avoid having bunch of paragraphs for every new line?
It sounds as though formatting is being carried over from your source code editor. If you don’t mind removing all formatting (such as colors & fonts), this is what I’ve done on a PC:
- Copy the source code.
- Paste it into Notepad, which has no formatting features. It will strip away all existing formatting.
- “Select All” in Notepad, and copy the text.
- Paste that into the Google Document.
There is probably a similar Mac program that will strip away formatting, if you need it.
If you add in shift to your paste command (e.g. shift-control-P, or shift-command-P depending on your operating system) then it will paste the text without any formatting. As it seems that the paragraphs are due to some extra formatting being added, this should fix that issue.