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

Fix image linkify and alt attribute #2046

Merged
merged 1 commit into from
Dec 8, 2022
Merged

Conversation

tlylt
Copy link
Contributor

@tlylt tlylt commented Dec 4, 2022

What is the purpose of this pull request?

  • Documentation update
  • Bug fix
  • Feature addition or enhancement
  • Code maintenance
  • DevOps
  • Improve developer experience
  • Others, please explain:

Overview of changes:
Fixes #2045
Fixes #2028

Addressing two related issues on images

  • linkify
  • alt not captured
    • seems like due to outdated code, markdown-it-imsize does not correctly set the content of the image such that it can be passed into the "alt" attribute when rendered as HTML
    • I forked and published a patched version of it since the package has quite a bit of code and is not very convenient to patch within markbind (but can be done in the future if there's such a need)

Anything you'd like to highlight/discuss:
The default markdown image syntax seems to overlap with the features of the pic component, and some features exist on one and not the other. I think it is still important to support the default syntax since it's a very common usage. Further improvements can be done to the image support in the future.

Testing instructions:

Proposed commit message: (wrap lines at 72 characters)
Fix image linkify and alt attribute

Currently the image linkify feature is not documented and does
not account for already wrapped images. The image alternative
text is also not captured due to outdated markdown-it-imsize.

Let's document the linkify feature and update the relevant
packages to fix the issues. Let's also add tests to ensure the
functionalities are captured and verified.


Checklist: ☑️

  • Updated the documentation for feature additions and enhancements
  • Added tests for bug fixes or features
  • Linked all related issues
  • No unrelated changes

Copy link
Contributor

@jonahtanjz jonahtanjz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @tlylt

LGTM 👍

@jonahtanjz jonahtanjz added this to the 4.0.3 milestone Dec 6, 2022
@tlylt tlylt merged commit 3c6a763 into MarkBind:master Dec 8, 2022
@tlylt tlylt deleted the fix-img-linkify branch December 8, 2022 14:23
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.

image alt caption not working How to deal with hydration issues for markdown linked images?
2 participants