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

Option to convert relative links to absolute #520

Open
matthewpwatkins opened this issue Dec 17, 2019 · 0 comments
Open

Option to convert relative links to absolute #520

matthewpwatkins opened this issue Dec 17, 2019 · 0 comments

Comments

@matthewpwatkins
Copy link
Contributor

  • Platform: Linux
  • Mercury Parser Version: 2.2.0
  • Node Version (if a Node bug): 8.x

Current Behavior

Suppose I call the parser and pass in the URL of an article with relative links. For example, I'm calling the parser for a page on churchofjesuschrist.org and getting back unqualified links in the text like this:

See <a href="/study/scriptures/nt/matt/25">Matthew 25</a> for more details...

Right now, the parser returns the URLs exactly as they are specified on the source page-- as relative paths. The same to images and other content.

Expected Behavior

I would love to have the ability to pass in a command option that will fully-qualify all the URLs during render. Example desired output:

See <a href="https://www.churchofjesuschrist.org/study/scriptures/nt/matt/25">Matthew 25</a> for more details...

Currently I have to correct for these with Regex after parsing (fortunately I'm using Markdown mode so that's not too tricky at the moment).

Steps to Reproduce

  1. Call the parser for a web page with relative URLs in images, links, etc
  2. See the output preserves the relative URLs instead of fully qualifying them.

Possible Solution

It would be nice to have an option I can pass in to enable this feature

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

No branches or pull requests

1 participant