Preheat the oven to 350°F (175°C) and line a muffin tin with cupcake liners.
In a large bowl, whisk together the flour, cocoa powder, baking soda, and salt until well combined.
In another bowl, cream the softened butter and granulated sugar until light and fluffy, about 3–5 minutes.
Add the eggs one at a time, mixing well after each addition, then stir in the vanilla extract.
Alternate adding the dry ingredients and whole milk to the butter mixture, beginning and ending with the dry ingredients, mixing until just combined.
Gently fold in the fresh raspberries and chocolate chips if using, taking care to maintain the integrity of the berries.
Divide the batter evenly among the prepared cupcake liners, filling each about two-thirds full.
Bake for 18-20 minutes, or until a toothpick inserted in the center comes out clean or with a few moist crumbs.
Allow the cupcakes to cool in the tin for 5 minutes before transferring to a wire rack to cool completely.