GithubHelp home page GithubHelp logo

Malformed output of links about html2text HOT 16 CLOSED

alir3z4 avatar alir3z4 commented on August 31, 2024
Malformed output of links

from html2text.

Comments (16)

theSage21 avatar theSage21 commented on August 31, 2024

Just started using this. working on it.

from html2text.

theSage21 avatar theSage21 commented on August 31, 2024

@Alir3z4 @barsch Am I right in assuming that

<a href="http://www.test.com">http://www.test.com</a>

should give me
[http://www.test.com](http://www.test.com)

I am a little new to markdown.

from html2text.

Alir3z4 avatar Alir3z4 commented on August 31, 2024

@theSage21 That is correct, <a href="http://www.test.com">http://www.test.com</a> should give [http://www.test.com](http://www.test.com)

from html2text.

theSage21 avatar theSage21 commented on August 31, 2024

@Alir3z4 Also. Should I add some documentation? As a non English speaker this repo was very confusing to me initially. Docs would have helped.

from html2text.

Alir3z4 avatar Alir3z4 commented on August 31, 2024

@theSage21 Sure, that would be great.
You can have #39 this one as well if you like.

from html2text.

theSage21 avatar theSage21 commented on August 31, 2024

@Alir3z4 Al right. I will try to fix this then #39

from html2text.

Alir3z4 avatar Alir3z4 commented on August 31, 2024

Awesome ;)

On Sun, May 31, 2015 at 1:31 PM, arjoonn sharma [email protected]
wrote:

@Alir3z4 https://github.com/Alir3z4 Al right. I will try to fix this
then #39 #39


Reply to this email directly or view it on GitHub
#61 (comment).

from html2text.

theSage21 avatar theSage21 commented on August 31, 2024

This bug This is triggered whenever the text matches the url and it is an absolute url.
It seems this is deliberate. Lines 698 to 701

delibrate code

Removing that condition fixes it. I am not sure if this is a requirement of markdown or not. @Alir3z4 @barsch . Is this a bug or feature? Daring Fireball is silent on these types of links and nobody on IRC seems to know.

from html2text.

theSage21 avatar theSage21 commented on August 31, 2024

@Alir3z4 @barsch This is not a bug. The test/url-escaping.md specifically tests this functionality. I recommend that this issue be closed.

from html2text.

barsch avatar barsch commented on August 31, 2024

Is <http://www.test.com> a valid Markdown syntax for an inline link?

http://daringfireball.net/projects/markdown/syntax#link states:

Markdown supports two style of links: inline and reference.
In both styles, the link text is delimited by [square brackets].

However there is an example further down using angle brackets for a referenced link:

[id]: <http://example.com/>  "Optional Title Here"

from html2text.

theSage21 avatar theSage21 commented on August 31, 2024

@barsch I am not sure about the proper format. Daring Fireball says nothing about automatic links.
In the tests directory the url-escaping.md file has
* Use automatic links like <http://example.com/> when the URL is the label
Since this type of conversion has been specifically tested I think it was intended to be a feature.

Also notice that
<a href="http://www.test.com">http://www.test.com</a>
<a href="http://www.test.com/">http://www.test.com/</a>
both translate validly to:
<http://www.test.com>
<http://www.test.com/>

Hence whenever the href is absolute and is the same as the text the format of <http://text> is used.

from html2text.

theSage21 avatar theSage21 commented on August 31, 2024

@barsch @Alir3z4 How about we add a config parameter which is by default left to use automatic links but can be set to translate these types of links to normal Markdown? I think that is a good idea since people can configure as they wish then and people already depending on this module can go on undisturbed.

from html2text.

Alir3z4 avatar Alir3z4 commented on August 31, 2024

@theSage21 I like the idea of having config for those kind of link. is --reference-link option does it ?

from html2text.

theSage21 avatar theSage21 commented on August 31, 2024

@Alir3z4 Sorry, just noticed it. Yes --reference-link does it.

from html2text.

Alir3z4 avatar Alir3z4 commented on August 31, 2024

@theSage21 So this issue can be closed if we consider --reference-link as the solution ?

from html2text.

theSage21 avatar theSage21 commented on August 31, 2024

@Alir3z4 Yes. The issue can be closed. Automatic links are now optional via the --reference-link option.

from html2text.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.