Both of these words can describe annoying behavior, and when they do, they can shade into each other. But something that is didactic also can be potentially helpful and instructive, while pedantry is almost always obnoxious.
*didactic: intended to teach, instructive, having the character or manner of a teacher
(when being didactic, it's possible to overdo it and to slip into pedantry)
*pedantic: excessively concerned with minutiae, and he's showing off his academic or technical knowledge.
-- pedant adj.
来源:May I Quote You On That