ao3commentoftheday answered:

One of the AO3 translation volunteers (Min) created a Google Docs script to handle issues when copying from a doc into AO3. It’s really easy to use

create a copy of this google doc. It contains the script that will do all of the HTML formatting for you. Delete all of the text from the document. Write or paste your fic/chapter into the document. Go up to the top menu and click the new menu option Post to AO3, then choose Prepare for posting into the HTML editor

Note: because this is an apps script, you’ll need to give it permission to run the first time.

The script will automatically mark up your document with the required HTML that you can then paste into the AO3 composition window. \o/

To revert your text back to normal, just go back up to that menu and choose Remove HTML. It will look like regular text again.

Once you have the doc, you can make a new copy of it for each new fic you write and that way you’ll always have that script available when you need it :)

For other cool stuff, read this post from @ao3org - which is where I found this script in the first place ❤