Closed hug-sch closed 9 months ago
Found a solution/work-around. Haven't noticed that you can also add a custom id to the figure e.g. ![testcaption](test.png){ #align-right}
. Seems that you can style the figure with that. Something like:
#align-right {
float: right;
margin-top: 0;
margin-left: 10px;
}
#align-right figcaption {
text-align: left;
}
Hey
Thanks for the issue.
You are right that I have not considered this use case. The attributes assigned to the image do not affect the figure.
Your solution with the custom ID is pretty neat and should work reasonably well. However, an id should be unique and a class can be reused. That's why I think a proper fix is needed.
I will prepare a change that enables the following:
Figure: Test Caption {class="TestClass" style="margin-left: 0px;"}
![](test.png){}
which should result in
<figure class="TestClass" style="margin-left: 0px;" id="_figure-1" >
<img alt="" src="test.png"></a>
<figcaption>Figure 1: Test Caption </figcaption>
</figure>
hi, your solution with a custom class is indeed the better solution. Three questions:
[testcaption](test.png){.myClass}
continu to work?class
. Another notation could be: Figure: Test Caption {.testclass #testID margin-left: 0px; float: right;}
Everything without . or # is a literal attribute.Thanks for the amazing plugin.
Figure:
notationFigure:
because this is what is also put in front of the caption text (minus the index 😉 ). But I agree that it might be confusing. I added a config parameter markdown_identifier
that can be used to change the default, e.g. Figure:
for figures.
At the current implementation, the figure and figcaption element is centered in the page (using the material template). You can add a class to the markdown code e.g.
![testcaption](test.png){ .myClass}
. This class however is assigned to the img element; not the parent figure element. This makes it hard to style the figure.I would like to have a choice between left, center or right aligned figure + figcaption. This could be done in CSS if there was a custom class assigned to the figure element.
There exists an extension called markdown-captions that does assign a custom class to the figure element. It uses the same syntax as the mkdocs-caption plugin.