Commas and periods that are part of the overall sentence go inside the quotation marks, even though they aren’t part of the original quotation.
Correct: “The best investments today,” according to Smith, “are commodities and emerging-market stocks.”
Incorrect: “The best investments today”, according to Smith, “are commodities and emerging-market stocks”.
(The original text quoted above is as follows: “The best investments today are commodities and emerging-market stocks, not domestic stocks and bonds.”)
Unless they are part of the original quotation, all marks other than commas or periods are placed outside the quotation marks.
Correct: She provides a thorough list of problems in her most recent article, “Misery in Paradise”; she doesn’t provide a solution.
Incorrect: She provides a thorough list of problems in her most recent article, “Misery in Paradise;” she doesn’t provide a solution.
Correct: Wasn’t it Dickens who wrote, “It was the best of times, it was the worst of times”?
Incorrect: Wasn’t it Dickens who wrote, “It was the best of times, it was the worst of times?”
From the Punctuation Guide.