this is also cool
I found this here, but I'm not sure where it's originally from. I pasted the text in this blog to make it easier to read. And I changed a couple examples for clarity.
Punctating dialogue
"This is a sentence."
"This is a sentence with a dialogue tag at the end," she said.
"This," he said, "is a sentence split by a dialogue tag."
"This is a sentence," she said. "This is a new sentence. New sentences are capitalized."
"This is a sentence followed by an action." He sat down. "They are separate sentences because he did not speak by sitting."
She said, "Use a comma to introduce dialogue. The quote is capitalized when the dialogue tag is at the beginning."
"Use a comma when a dialogue tag follows a quote," he said.
"Unless there is a question mark?" she asked.
"Or an exclamation point!" he answered. "The dialogue tag still remains uncapitalized because it's not truly the end of the sentence."“Periods and commas should be inside closing quotations."
"Hey!" she shouted, "Sometimes exclamation points are inside quotations." However, if it's not dialogue exclamation points can also be "outside"!
“Does this apply to question marks too?" he asked.
If it's not dialogue, can question marks be "outside"? (Yes, they can.)“This applies to dashes too. Inside quotations dashes typically express–"
"–Interruption" — but there are situations where dashes may be outside.“My teacher said, 'Use single quotation marks when quoting within dialogue."
"Use paragraph breaks to indicate a new speaker," he said.
"The readers will know it's someone else speaking."“If it's the same speaker but different paragraph, keep the closing quotation off.
"This shows it's the same character continuing to speak."終