Cacao beans, from which chocolate is made, do contain caffeine. Just like coffee beans. I think they're like, cousins, or something. LOL.
However, if you're eating Hershey bars, the cacao content is so diluted by sugar, milk, cream, etc., that you're getting only a tiny amount of caffeine. Even darker chocolates, eaten in moderation, will give you only a really small dose of caffeine. So relax. Unless you're eating pounds a day, you and your baby will be fine.
Coffee is fine in moderation too. I've joked that I have to keep drinking coffee because if I don't, my nurslings will get withdrawal headaches! I've drunk coffee during all my pregnancies and through over 10 combined years of breastfeeding. (I am an extended nurser. My babies nurse til they turn three.) And all my kids are smart and show no ill effects.
People make nursing way more complicated than it needs to be. For the record, unless it bothers your baby, you can eat all the garlic you want, spicy food, ethnic food, milk, nuts, etc. It does change the taste of the breastmilk, but this is nature's way of educating the baby's palate to his cultural diet. So that's a good thing!
*rolling eyes* Hotlama below just proved my point. Of course no one should smoke or use drugs. But one drink once in a while will not harm baby.