In a medium saucepan (with the heat off), whisk together the sugar, cocoa powder, cornstarch, and salt.
2/3 cup sugar, 1/4 cup cocoa powder, 3 tablespoons cornstarch, 1/4 teaspoon salt
Turn the heat on low, and gradually whisk in the milk.
2 1/4 cups whole milk
Stir continuously while cooking the mixture over medium heat until it comes to a boil. It will take approximately 10 minutes. (See note.) Once it begins to boil, continue stirring and cooking for an additional minute. Remove it from the heat and whisk in the vanilla extract and butter.
2 tablespoons butter, 1 teaspoon vanilla extract
Transfer the pudding to a medium mixing bowl and press a piece of plastic wrap right up against the pudding to keep it from developing a skin on top. Cool in the refrigerator for at least 4 hours.
Top with whipped cream and chocolate shavings.