Closed hug-sch closed 9 months ago
Hey
Have you tested this with the latest master version? I stumbled upon this as well and thought I fixed this already. I pushed it a couple of minutes ago
Let me know if you have the same issue with the current master.
Very sorry that you encountered this issue ... I added a bunch of unit tests today to prevent this from happening again
Hallo,
I'm running mkdocs-caption == 0.0.8
. Is this the latest master-version?
Installed it with pip install mkdocs-caption
.
My requirements.txt is
mkdocs == 1.5.2
mkdocs-material == 9.1.21
mkdocs-caption == 0.0.8
No that is the latest release. You can install the latest master with
pip install git+https://github.com/tobiasah/mkdocs-caption.git
Hi Tobias, That works fine! Great! Should I change the requirements.txt or will the package be released in the near future. Maybe in the same context, will the mandatory blanc line between figcaption label and markdown remain or do you have plans to remove it? Thanks a lot for the beautifull plugin.
Happy to hear that. I plan to release a patch today or early tomorrow.
Do you have an example of the mandatory blanc line you are referring to? I can not quite follow 🙈
Hi Tobias,
For example Figure: Example of Deposit Accounts. {class="pp-figure"}
There must be a blanc line between Figure: and ![]…, otherwise the caption is displayed as <figure-caption identifier="Figure"class="pp-figure"}
From: Tobias Ahrens @.> Sent: zondag 24 september 2023 13:15 To: tobiasah/mkdocs-caption @.> Cc: hug-sch @.>; Author @.> Subject: Re: [tobiasah/mkdocs-caption] Caption of figure is displayed 2x in rendered text (Issue #5)
Happy to hear that. I plan to release a patch today or early tomorrow.
Do you have an example of the mandatory blanc line you are referring to? I can not quite follow 🙈
— Reply to this email directly, view it on GitHubhttps://github.com/tobiasah/mkdocs-caption/issues/5#issuecomment-1732547714, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A77OGSCPEGEWIOGDMQ4MR7LX4AI4NANCNFSM6AAAAAA5DQDVNM. You are receiving this because you authored the thread.Message ID: @.**@.>>
Right, now I get what you mean.
TBH the reason for this is the recommendation from the official markdown guideline.
It would be easy to support this in the plugin since the caption is parsed before the markdown is converted into HTML. The biggest downside of this would be that previews like the one in GitHub would not understand the caption identifier before the image and not render it at all. With the blank line one can view the image even without the caption plugin.
Let me think if I can support both without encouraging the non blank line option 😁
How about the following compromise?
An Image caption element can either be terminated by a blank line (as is already the case) or a closing curly bracket (as it is used to define the attributes of the caption.
This would mean the following would be the correct syntax:
Figure: Caption
![](image.png)
Figure: Caption
that has
multiple
lines
![](image.png)
Figure: Caption {}
![](image.png)
Figure: Caption {}
![](image.png)
But this would still be invalid
Figure: Caption
![](image.png)
The reason behind this is that it is quite hard to detect when the captions end and the element to be wrapped starts ... Multiline captions are not uncommon. A blank line is a clear indicator ...
What do you think is this a useful adaption or no helpful in your case?
Not sure about the curly brackets. It feels a little strange. The blank line is OK with me. Just mentioned it because I made the mistake a few times. and wasn't sure it was intentional. Maybe , it should be stressed a bit more in the docs.
Thanks for the feedback. In that case, I leave it as it is.
Just release version 0.0.9 which contains the fix for this issue.
Inserting the following markdown:
will add a (redundant but visible) paragraph before the figure with the caption e.g.
<p>This is my caption</p>
Apparently, there should also be a blanc line between the caption label and the image markdown.