it would be easier if u just change the bottom margin of the headers. in that way, it will affect only those of header and first para or first list. replace or add relevant h1-h6 to ur preference and adjust how much e.g. here using 0.5em
.markdown-preview-view h1,
.markdown-preview-view h2 {
margin-bottom: 0.5em;
}
if u really need very specific control, here is what i use to adjust margin between h4 and the first para. but this require mgmeyers’ Contextual Typography plugin which adds a number of css classes to identify the top level divs. so .el-h4
below is coming from the plugin’s addition
div.el-h4 + div.el-p > p {
margin-block-start: 0.6em;
}
anything else is up to ur creativity