Parentheses
If the text inside the parentheses is just an aside within or at the end of a sentence (like this one), then the punctuation goes after and outside the closing parenthesis.
If the text inside the parentheses is a complete sentence that starts with a capital letter and ends with a period (or other final mark), then the punctuation belongs inside the parentheses. (This is an example.)
There are no extra spaces surrounding parentheses, other than the normal word space before and after. There is no extra space between the closing parenthesis and any punctuation that might follow.
Meet me under the magnolia at twilight (without the wig), and we will waddle down the trail together.
Notice the comma is directly after the parenthesis, and ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access