Preheat oven to 350 degrees F (180 degrees C). Grease a 9-inch spring-form or loose-bottom cake pan. Set aside.
I chose not to peel my pears, as they were very ripe and quite thin-skinned, but you can peel yours if desired. Remove the core and dice into small pieces. Chop your chocolate as well and set aside.
I'd recommend using your stand mixer (I didn't and it was more whisking than I prefer). Whisk together the granulated sugar, oil, eggs, and cocoa powder for several minutes (this emulsifies and aerates).
Stir in the vanilla and almond extract, then gently stir in the baking powder, salt, cinnamon, and all-purpose flour (use gentle pulses on your mixer). Add the milk as well and mix until it's just incorporated.
Fold in the cubed pear and chopped chocolate, then pour the batter into the pan. Sprinkle with raw sugar and top with chocolate shavings.
Bake for 40-50 minutes, or until a toothpick inserted into the center comes out clean. Remove from the oven and let cool for 10-15 minutes, then run a knife around the edges and remove from the pan. Allow to cool fully before serving. You can eat it warm but I vastly prefer it once completely cool and set.