Closed sudodoki closed 10 years ago
Hey @sudodoki, can you indent by tabs? I'll merge this after.
Thanks.
@kates I think I can. :smile:
Didn't run the actual tests in window-less env, but ran the snippet in the node environment - seems legit, tell your thought on this. Even better way to do this would be by providing getBase() function and using it both in method and tests and just mocking it, but working with real window.location appeals more to me
It's just really bad way to hardcode the value. I did spend some time figuring out, why test on previous revision (the one you had normalizeUrl functionality) failed, and didn't notice the port thing (I was running on another one on localhost) at once. Don't think I'm trying to ruin tests or something, you did an awesome job I wanted to contribute to. Kthxbye
@sudodoki You did good man. It's just that, I think, it doesn't matter if it's run in the browser or in any other environment. The main thing is we shouldn't muck with the document data. We should be able to convert back to HTML without or, at the very least, have minimal lost of data. In you example, it will change the link to a full url given just a relative url. Converting it back to HTML will yield a full url since we have already lost context.
The use case I'm willing to cover is provided html2markup is ran in the context of, say, current html page and then markdown is being transfered to another host, I want it to be with actual images after reverse convertion (with images from another host) and not with 404s.
Should I modify this or just close the PR?
Adding feature to optionally normalize URL's.