This CSS trims the spaces at the top & bottom of codeblocks in reading view.
.markdown-rendered pre {
padding-top: 0px;
padding-bottom: 0px;
}
You can inject your custom CSS class (say, your-plugin-code-block) to code blocks that your plugin targets, and then add the following to styles.css of your plugin: