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

Handle links that have a blank or missing href #124

Merged
merged 1 commit into from
Feb 21, 2018

Conversation

h-lame
Copy link
Contributor

@h-lame h-lame commented Feb 20, 2018

For: https://trello.com/c/8mDzHj8g/84-1-links-without-href-break-whitehall

If the markdown contains an empty markdown link [foo]() or it contains
a tags with missing or empty href attributes we should strip them out
of the list of hrefs we return. They're not valid links so there's no
point in checking them. We use CSS selectors on the document to strip
out any links that have no href attribute (which means we ignore valid
a tags like <a name="table-of-contents">ToC</a>), but we use ruby to
filter out blank href attributes because it's more flexible.

If the markdown contains an empty markdown link `[foo]()` or it contains
`a` tags with missing or empty `href` attributes we should strip them out
of the list of hrefs we return.  They're not valid links so there's no
point in checking them.  We use CSS selectors on the document to strip
out any links that have no href attribute (which means we ignore valid
`a` tags like `<a name="table-of-contents">ToC</a>`), but we use ruby to
filter out blank `href` attributes because it's more flexible.
Copy link
Contributor

@suzannehamilton suzannehamilton left a comment

Choose a reason for hiding this comment

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

This looks good to me. 👍

@h-lame h-lame merged commit e84971b into master Feb 21, 2018
@h-lame h-lame deleted the handle-links-without-hrefs-when-extracting-links branch February 21, 2018 10:26
h-lame added a commit that referenced this pull request Feb 21, 2018
Includes:

* #124 - ignoring links with a blank or missing href when extracting links
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