Coder Social home page Coder Social logo

Comments (7)

treble37 avatar treble37 commented on June 22, 2024

The Amazon url's seem to redirect to the correct item even with the converted "&amp"... now I'm curious as to why Kramdown converts the ampersands in a URL instead of leaving them alone.

from kramdown.

 avatar commented on June 22, 2024

It is correct behavior for kramdown to encode ampersands.
ref

from kramdown.

treble37 avatar treble37 commented on June 22, 2024

svnpenn, now I'm a bit confused...the doc you pointed to says "When writing the same URL in a plain text email message or in the location bar of your browser, you would use "&" and not "&"."....Kramdown is converting it to the HTML "&amp" in the clickable URL....

from kramdown.

 avatar commented on June 22, 2024

No.

$ kramdown <<< '[some link](http://amazon.com?foo=111&bar=222)'
<p><a href="http://amazon.com?foo=111&amp;bar=222">some link</a></p>

from kramdown.

gettalong avatar gettalong commented on June 22, 2024

@svnpenn is correct.

Values of all attributes in (X)HTML must be correctly formatted so that no problems arise. Modern browsers are able to recover from basic errors but it is better to be on the safe side.

As stated on W3C's HTML documentation the href attribute of an <a> tag must contain a %URI string which is defined as containing CDATA. There you will find that character entities must be decoded, hence a lone ampersand must only occur as &amp;.

As a general rule: In HTML text and attribute values all <, > and & must only occur as entities (i.e. &lt;, &gt; and &amp;).

from kramdown.

treble37 avatar treble37 commented on June 22, 2024

Thanks gettalong and svnpenn I learned something new...I missed this part in svnpenn's ref: "With HTML, the browser translates "&" to "&" so the Web server would only see "&" and not "&" in the query string of the request." -- I saw the "&amp" in the Firefox browser bar but didn't realize that the webserver was seeing "&" as it should.

from kramdown.

gettalong avatar gettalong commented on June 22, 2024

You are welcome! It could have been a problem with kramdown, so better safe than sorry 😄

from kramdown.

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.