It’s not too complicated.
Paste this into an empty file that you can save out with a .css
extension. Give it a name you can easily remember or recognize next time you want to tweak it, put the file in the .obsidian/snippets folder of your vault and activate the snippet (here’s how).
.markdown-preview-view h1 {
padding-top: 30px;
padding-bottom: 30px;
}
.markdown-preview-view h2 {
padding-top: 30px;
}
.markdown-preview-view h3 {
padding-top: 30px;
}
.markdown-preview-view h4 {
padding-top: 30px;
}
.markdown-preview-view h5 {
padding-top: 20px;
}
.markdown-preview-view h6 {
padding-top: 20px;
}
/* DON'T NEED THESE; THEY ARE ONLY FOR LIVE PREVIEW */
/* .mod-cm6 .cm-editor .HyperMD-header-1 { */
/* padding-top: 20px; */
/* padding-bottom: 20px; */
}
/* .mod-cm6 .cm-editor .HyperMD-header-2 { */
/* padding-top: 20px; */
}
/* .mod-cm6 .cm-editor .HyperMD-header-3 { */
/* padding-top: 20px; */
}
/* .mod-cm6 .cm-editor .HyperMD-header-4 { */
/* padding-top: 20px; */
}
/* .mod-cm6 .cm-editor .HyperMD-header-5 { */
/* padding-top: 20px; */
}
/* .mod-cm6 .cm-editor .HyperMD-header-6 { */
/* padding-top: 20px; */
}
You can play around with the numbers to increase the padding. If you want to change it for Live Preview as well (I did not), remove the slash-star pairs around the code on the bottom.