-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to ignore converting certain figures #3
Comments
Hi Tim, makes sense. I would propose following solution:
What do you think? |
One more: We can control whether images without captions are converted or not via plugin config. |
While thinking more about this plugin I would propose a complete different approach:
|
Good idea, much cleaner! I would prefer a more explicit syntax, f.e.: While we're brainstorming, I also think the figure captions are rendered too big, and the whitespace underneath is too narrow. I think it would be a good idea to update the docs with some custom CSS styles for the |
So I also thought about this a bit more. What this plugin is doing is actually just extending the markdown syntax while parsing to HTML. So instead of being a mkdocs plugin, it could be a When you install @facelessuser have you ever considered the use case of adding an extension to automatically create HTML figcaptions from markdown? Would that fit the scope of pymdown-extensions? Any ideas/advice? EDIT: OK there are already lots of markdown extensions that do this. see https://github.com/Python-Markdown/markdown/wiki/Third-Party-Extensions#generic--structure. The syntax most commonly used is with the title attribute:
becomes
This meant also mean that this plugin is redundant and could be deprecated.. |
I will have a closer look on those markdown extensions. But it seems you are right and someone else has already solved the problem. |
I had a look, and:
So there is still an opportunity here to improve. So not using the
But adding the
@facelessuser would you be open to a PR to pymdown-extensions that adds a figure caption extension? I'd be happy to contribute! |
@timvink I have not yet considered adding a figure caption extension. It isn't something I've really need yet. With that said, I see a lot of custom syntax, but I imagine this could be done quite simply using the existing Basically, just attach some attribute via
Then you just look for images with that attribute in either your Python Markdown extension or MkDocs plugin, and wrap the image as required. |
Thanks for the input! @fstueber if you decide to do the implementation via the |
I'll see what I can do. Must also think whether the extension (and not plugin) approach is better. Will keep you informed. |
Cool, thanks! From the mkdocs-material docs on figure captions:
The section is about markdown extensions, so once there is a proper solution (and nice syntax), perhaps it could be promoted there as well. |
I have a feature request.
I would like the option to specify that some images in my page should not be converted to figures.
For example:
Should render as:
But renders as:
Proposal
I would suggest two updates:
![](<path>)
), do not convertimg2fig-ignore
, remove the text from the caption and do not convert to figureThe text was updated successfully, but these errors were encountered: