Skip to content
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

feat(image): optionally add image captions from alt tags #618

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tlhunter
Copy link

This PR introduces a new option named extractImageCaptions to enable image captions.

Input

![An elephant at sunset](/elephant.jpg)

Output

(newlines added for PR readability, not included in code)

<p>
  <figure>
    <img src="/elephant.jpg" alt="An elephant at sunset" />
    <figcaption>An elephant at sunset</figcaption>
  </figure>
</p>

The inspiration for the output markup was taken from here:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/figcaption

Help Request: While the paragraph tags don't really hurt, they would ideally be removed. Any advice?

@tlhunter
Copy link
Author

FYI I'm using this PR on my personal site. Here's an example of a page rendered using this code:
https://thomashunter.name/posts/2016-02-03-microsoft-sculpt-ergonomic-keyboard-review

And here's a screenshot (grey text below image):
20181118182233

@tlhunter
Copy link
Author

tlhunter commented Dec 13, 2018

I will pay $10 via PayPal to get this merged and released via npm.

/cc @tivie

@tivie
Copy link
Member

tivie commented Dec 19, 2018

thank you for your contribution.

I've been swamped in work lately, but will use the xmas vacations to look into this.

One important thing though, version 2.0 will have templates, which will enable users to easily and completely change the HTML output.

@tlhunter
Copy link
Author

tlhunter commented Aug 2, 2019

PR has been updated to include the dist files.

@tivie tivie self-assigned this Feb 24, 2022
@marcelogp
Copy link

@tivie I'm interested in this feature. Is there an alternative way to get something equivalent now with 2.0? If not, can you get this merged?

@MarketingPip
Copy link

@marcelogp - this feature has already been added & is ready to use.

Tho - I don't know why this pull request was never merged from @tlhunter to implement it with his work done already! 😞

Hoping @tivie is willing to close this PR to avoiding causing any future confusion.

ps - @tivie let's clean up some of these issues etc - feel free to get in contact with me etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants