alangrainger / obsidian-image-captions

Add captions to images with inline Markdown and link support. The caption format is compatible with the CommonMark spec and other Markdown applications.
GNU General Public License v3.0
98 stars 7 forks source link

image can't be centered #1

Closed Gavin-jy closed 1 year ago

Gavin-jy commented 1 year ago

I found a problem that my settings for centering the pics will lose their function if I use this plugin. here are my snippets for centering the image:

.center-image :is(.markdown-preview-view,.markdown-rendered) img:not([class*="emoji"]) {
  margin-left: auto;
  margin-right: auto;
}

.center-image .print :is(.markdown-preview-view,.markdown-rendered) img:not([class*="emoji"]) {
  display: block;
}

.center-image .view-content img:not([class*="emoji"]) {
  cursor: zoom-in;
  display: block;
  margin-left: auto !important;
  margin-right: auto !important;
}

I try to use the above snippet into your plugin's CSS but failed. I don't know how to make the setting for images keep working if I load your plugin into my obsidian. And I don't know whether or not it's a bug or limits of my knowledge.

alangrainger commented 1 year ago

You just need to target the new captioned image:

.image-captions-figure {
  margin-left: auto;
  margin-right: auto;
}