Closed futuresoup closed 5 months ago
I believe that I have the component correct, I would like to collaborate with @Sugam Goel to see if we can iron this out in the docusaurus.config file
![That Image](/img/.jpg "figcaption here")
![That Image](/img/.jpg "A Tooltip is Created")
Is this relevant? https://github.com/facebook/docusaurus/discussions/4633
@Sugamgoel28 @MyBaBB - yes it looks like the right direction. Do you understand what they're saying about passing remark/rehype plugins so we can invent our own syntax?
The implementation example provided from @cmdcolin seems relevant.
The only issue with the way he did it is that:
A) it requires importing the component on each page which is cumbersome and not good for writers. I also don't know if it will be work out of the box with our Decap CMS system
B) The syntax does not look like markdown, it looks like jsx. That's more of a minor thing, but it is easy to forget the syntax the way he has it and perhaps incompatible with migrating to different systems if we decide to move away from Docusaurus.
That said, you're welcome to try his implementation as a backup if we can't make an official plugin that does this the proper way.
We need a way for images to have a nice caption formatting so writers can put in image captions using markdown syntax.
We'll be using @bl912 's design. The one with the right alignment
In HTML this is accomplished using the following syntax:
However, this is cumbersome. It would be better if we supported a simple Markdown syntax that replicate's Pandoc's format, which I believe is:
![alt text](image-url.jpg "This is the image caption")
According to phind.com this is the method:
You'll need to create a custom Remark plugin that recognizes your image caption syntax and transforms it into the
Once your plugin is created, you'll need to register it with Docusaurus so that it's used during the Markdown processing. This can be done by adding the plugin to the
remarkPlugins
array in yourdocusaurus.config.js
file.Example Plugin Implementation:
Below is a simplified example of what the plugin might look like. This example assumes you're familiar with creating Remark plugins and might need adjustments based on your specific requirements.