Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

creating a PayPal donation button in an md file

What I'm trying to do is displaying a PayPal donation button into a Github project README.md file. The markup I added is displayed as HTML rather than being properly rendered as donation button.

HTML // PayPal source here

Do you have any thought?

like image 714
user2475624 Avatar asked Jun 18 '15 12:06

user2475624


3 Answers

With Paypal.me , there is no more a security concern :

markdown

[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.me/AbdennourT/10)

markup

<p>
  <a href="https://www.paypal.me/AbdennourT/10">
      <img src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" alt="paypal">
  </a>
</p>
like image 196
Abdennour TOUMI Avatar answered Oct 07 '22 09:10

Abdennour TOUMI


The current code generated by paypal buttons is based on a FORM html tag with a POST method. Fortunately the values are always the same and paypal is supporting them to be passed by the GET method. So, you can safely read the form code and convert it to a direct link.

On my case I just made a link to my button like this:

[![](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=X6XHVCPMRQEL4)

I am using it on my project at http://github.com/ctodobom/OpenNoteScanner

like image 22
allgood Avatar answered Oct 07 '22 09:10

allgood


In all likelihood, it is not possible for security reasons (see CSFR and XSS for examples of potentially related security concerns). In other words, GitHub has intentionally not allowed forms within Markdown text and will strip them out if they are included.

For more general information about how to include a form in Markdown (outside of GitHub) see my previous answer below:


As the Markdown syntax rules state:

For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. There’s no need to preface it or delimit it to indicate that you’re switching from Markdown to HTML; you just use the tags.

The only restrictions are that block-level HTML elements — e.g. <div>, <table>, <pre>, <p>, etc. — must be separated from surrounding content by blank lines, and the start and end tags of the block should not be indented with tabs or spaces.

So just insert your raw HTML into the document. You probably should wrap the entire block in a <div> to make sure Markdown treats it properly as one block.

However, be aware that it is possible that GitHub may filter the content to not allow certain tags for security reasons, so you'll need to test it to find out if it will work.

Additionally, depending on how things are configured, the browser and/or the server you are posting to may not allow the form to post for security reasons.

For more on those issues see these questions and related answers.

like image 3
Waylan Avatar answered Oct 07 '22 10:10

Waylan