Image centring CSS broken as of v1.12.4

Can confirm that previous snippets for centering images in live preview aren’t working anymore.


With a quick look, it seems this default rule

.markdown-source-view.mod-cm6 .cm-content > * {
  margin: 0 !important;
  display: block;
}

is affecting internal image embeds now; previously it was only an issue for external image embeds in live preview.

So you could add a snippet of

.markdown-source-view.mod-cm6 .cm-content > * {
  margin: 0 auto !important;
}

but that will center all images in live preview. One option is using a cssclass to only center images in a note with that cssclass (both live preview and reading view)

.markdown-source-view.mod-cm6.centre .cm-content > * {
  margin: 0 auto !important;
}

.markdown-preview-view.centre img {
  display: block;
  margin-inline: auto;
}

CleanShot 2026-03-01 at 09.39.12


Had another look and this is working on my end using alt text:

img[alt*="center"],
.cm-content .image-embed[alt*="center"] {
  display: block;
  margin-inline: auto !important;
}

2 Likes