The rules for punctuating dialogue
Questions in dialogue, with dialogue tag
Question mark is inside quotation marks. There is no comma. The tag doesn’t begin with a cap since it’s part of the same sentence, even though there’s a question mark in the middle of the sentence.
Use this same construction for the exclamation point.
“He loved you?” she asked, the loathing clear in her voice and posture.
“He loved you!” she said, pointing a finger at Sally.
Dialogue interrupted by action or thought but no dialogue tag
Characters can pause in their words to do something and then resume the dialogue. If there is no dialogue tag, special punctuation is required to set off the action or thought.
Enclose the first part of the dialogue in quotation marks but omit the comma. Follow the end quotation mark with an em dash and the action or thought and then another em dash. Resume the dialogue with another opening quotation mark, complete the dialogue, and end with a period and a closing quotation mark. There are no spaces between the quotation marks and the dashes or between the dashes and the action/thought.
Thus the spoken words are within quotation marks and the action or thought is set off by the dashes.
“He loved you”—she pounded the wall with a heavy fist—”but you never cared.” *
“He loved you”—at least she thought he had—”but you never cared.” *
Compare this to a similar construction without dialogue:
He’d forgotten all about me—my heart ached at the thought—but I’d never forgotten him.
* The quotation marks before but in both sentences should curl the other way. I’ve been unable to edit this to make them go the correct way.