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

Refactor _do_links and simplify link handling logic #610

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

Crozzers
Copy link
Contributor

This PR refactors _do_links, simplifying it and removing alot of duplicated code.

The main point of duplication was around differences in processing inline images/anchors vs reference images and anchors. Both have different ways of extracting the key components of a link: URL, title and end index. However, once these are extracted, they are processed in exactly the same way.

The problem was, the processing code was duplicated across both branches of the if/else statement. This refactor fixes that.

Hopefully this simplification can lay the ground work for potential future improvements

Removed a whole bunch of duplication and tried to make the function flow much easier to understand
@nicholasserra
Copy link
Collaborator

This one looked painful lol thank you!

@nicholasserra nicholasserra merged commit c2b7427 into trentm:master Nov 20, 2024
15 checks passed
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.

2 participants