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

Add support for figcaption "title" option and keepAlt flag #51

Merged

Conversation

ItsEricWoodward
Copy link

@ItsEricWoodward ItsEricWoodward commented Aug 6, 2023

Good day!

First off, thank you for the work that's been put into this excellent library.

This PR includes everything from #40, building off of Antonio-Laguna's excellent work, while also incorporating all of @arve0's suggestions and keeping backwards compatibility.

New Features

  • Updates figcaption flag to take one of the strings alt or title, in addition to a boolean value (as now).

    • The title option provides the feature that Antonio-Laguna's code introduced, creating the figcaption from the image's title attribute rather than the alt attribute.
    • The alt option is the same as true, and provides the existing behavior (creating the figcaption from the image's alt attribute).
  • Adds new keepAlt flag which takes a boolean value (defaults to false).

    • If set to true, and figcaption is set to true or alt, this keeps the alt attribute text in the img tag, rather than blanking it out (the existing / default behavior).

I also 8 new tests (and updated some existing ones) to cover the changes, and updated the README accordingly.

Fixes #20 & #39.

Please let me know if there's any changes I need to make. Thanks for your time!

@arve0 arve0 merged commit 93e7fef into arve0:master Aug 19, 2023
@arve0
Copy link
Owner

arve0 commented Aug 19, 2023

Hi! 👋
Thanks for your work. I'm not using this library actively anymore, so I'm a bit hesitant to changes.

Seem like you've covered all cases, both previous tests and current tests pass with your changes 👍

I've released this as 0.12.0.

Thanks again :octocat:

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

Successfully merging this pull request may close these issues.

Get caption from title
2 participants