A challenge many new writers face is how to punctuate dialogue. Below I break down some of the basic grammar rules and reasons behind them for punctuating dialogue.
First, let's start with definitions: Dialogue is often marks with dialog tags that tell who is speaking or something about the quality of the speech. Dialogue is also interrupted by physical actions not related to speech or description. You need to know the difference between the two types of interruptions to punctuate dialogue well.
Each time someone new speaks, a new, tab indent paragraph is started.
Not everyone book will follow these rules. Cormac McCarthy doesn't follow these rules, but if you want to get to be someone as respected and famous as McCarthy, you increase your odds by submitting manuscripts for publication that are polished, professional, and adhere to standard grammar rules. When you get famous as a writer, people could see your grammar quirks as art; until then, they might make it so your work gets dismissed without being read by editors and agents.
"I love it here," says character A. (The comma is used after the person speaks because it is followed by a dialogue tag indicating who spoke.
"I love it here." Character A spun around with her arms open. (That dialogue is follow by a period because what follows is a sentence describing physical action. It is not a dialogue tag.
"I love it here," says character A. (Each time someone new speaks, it starts a new tab indented paragraph).
Character B sighs. "I don't." (Sighs is followed by a period because sighs isn't a dialogue tag; it is an action. Don't is followed by a period because it is the end of a sentence.)
"I love it here," says character A.
Character B sighs. "I don't."
Character A laughs. "You don't like anything, Henry. I can't believe you aren't able to love the South of France." Her face darkens. "Wait a minute, are you even able to love me? I die if you didn't," she says. (In this line, there is a period after laughs because it is a sentence describing an action--not a dialogue tag. Same with after darkens. There is a comma after didn't because it leads to a dialogue tag.)
"Precious." He takes two steps toward her and picks up her hand. "I've always been able to love you," he says. (Precious is followed by a period because it doesn't have a dialogue tag. Hand is followed by a period because it is a sentence of physical description. You is followed by a comma because it leads to a dialogue tag.)
Here are some links about this:
This article by Steve Almond is masterful: http://www.writersdigest.com/writing-articles/by-writing-goal/improve-my-writing/attributiveclauses