decaporg / decap-cms

A Git-based CMS for Static Site Generators
https://decapcms.org
MIT License
17.94k stars 3.04k forks source link

Add support for image captions #1058

Closed ragasirtahk closed 6 years ago

ragasirtahk commented 6 years ago

- Do you want to request a feature or report a bug? Feature

- What is the current behavior? There is no option to add image caption when we insert an image.

- If the current behavior is a bug, please provide the steps to reproduce.

- What is the expected behavior? There should be an option to add caption to images that a user inserts while writing a blog-post.

- Please mention your CMS, node.js, and operating system version.

- Please link or paste your config.yml below if applicable. https://github.com/ragasirtahk/The-ragasirtahk-Blog/blob/master/static/admin/config.yml

ragasirtahk commented 6 years ago

CMS: Hugo v0.33 + Netlify CMS hosted on Netlify and GitHub

tech4him1 commented 6 years ago

How would you want the caption saved into the markdown so that Hugo could use it?

ragasirtahk commented 6 years ago

Check this out: https://gohugo.io/content-management/shortcodes#figure The example there shows how Hugo uses markdown for figure caption

tech4him1 commented 6 years ago

To use shortcodes like that, you can use registerEditorComponent, docs here: https://www.netlifycms.org/docs/custom-widgets/#registereditorcomponent. If you need help, I can walk you through it.

ragasirtahk commented 6 years ago

Thanks for the info. I think I will be able to use the component without any requirement of help.

alxlion commented 6 years ago

Someone has created a custom component for figure ?

alxlion commented 6 years ago

Just made a "quick and dirty" custom component for Hugo figures being compatible with src, caption, link and width options.

https://gist.github.com/lnalex/2881c29649bc5d477954f79b3071e408

erquhart commented 6 years ago

Nice! You should consider packaging that up and publishing on npm.