Skip to content

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