Ignore HTML formatting when publishing articles with Confluence Cloud API - confluence

I am trying to publish article on Confluence using REST API.
When I am preparing the article in storage format, I indent the content as if I would HTML code, with newlines and spaces. The problem is that when article gets published all these newlines and spaces are preserved, as if I used <br/> and non-breaking space symbols.
For example, if I send content like this:
<p>First part of paragraph
<ac:link ac:anchor="4b14531b1624f2b">
<ri:page ri:content-title="Test Article"></ri:page>
<ac:plain-text-link-body><![CDATA[link caption]]></ac:plain-text-link-body>
</ac:link>
last part of paragraph.</p>
It is rendered like this on the page:
First part of paragraph
link caption
last part of paragraph.
But I expect this:
First part of paragraph link caption last part of paragraph.
Is it possible to tell confluence to ignore whitespaces as in normal HTML? Maybe there's some setting admins can change?
If I create the page normally through web editor and then get its content by API call, all returned content is on one line. This is stupid.
I never had this problem with previous Confluence servers I worked on.
I am using Confluence Cloud version.

Related

github issue comment received via email won't render code block

I have a GitHub issue comment here (the third comment down) that I'd like to edit so that it looks prettier, by rendering part of it as a code block.
But it doesn't work; the three backticks show up as literal text.
Anyone know why?
GitHub treats comments received via email differently from comments entered in the web UI. If you look at your comments you'll see that the third one displays an envelope icon beside your name with mouseover text saying, "This comment left via email reply."
In a blog post, GitHub suggests that Markdown formatting is not permitted in email replies:
We figured out early on in testing that we couldn't expect people to write Markdown. People are going to be dumping code or stacktraces, and will expect them to look nicely.
And later, gives this caveat:
Plain text email is vastly preferred. Essentially, we strip all HTML from HTML emails before formatting.
I can't find a better description of how formatting of emailed issue comments is handled, but I don't think you're going to be able to use Markdown if you reply by email.

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?
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
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.
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>
You have to create an enterprise account or you can update your own, it´s free.
Then you have to create the button in the button center and generate a donate button, this tool generates the html and you can get the hoted_button_id then you have to replace it and paste it in the README.md
[![](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=YOUR_OWN)
If you want to just use your email and a donate button you can do it by just filling in the blanks from their "donate email" example:
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif)](https://www.paypal.com/donate/?business=paypal#poleguy.com&no_recurring=0&item_name=Payment+for+Stackoverflow+Example&item_number=Suggested+Price:+$7.99+USD&currency_code=USD)
It renders like this:
Paypal warns that it's "not secure" and you should always use a "hosted email payment link to prevent malicious users from tampering with the code." So maybe okay on github, but not on a wiki or stackoverflow where the link could be edited to pay someone else.

Facebook open graph og:image escape whitespace characters

I have a page with user submitted photo galleries. I'm using the facebook API to share the photos. It shares the page with a query string. When the query string is present, it sets all the open graph properties on the page . This works great except when the image has white space characters on the file name.
I have tried replacing the whitespace characters with '%20' as so
http://example.com/gallery/images/large/this image.jpg
to
http://example.com/gallery/images/large/this%20image.jpg
But the facebook parser doesn't like that either.
Is there a way to scape these characters or am I going to have to go back and change it so that it replaces when the images get uploaded?
Answering your question (being it old), Now (in June-2017) Facebook parser works with whitespace characters when escaped with '%20', hope it would help someone looking for solution.
So, convert whitespace to %20 as depicted below:
http://example.com/gallery/images/large/this image.jpg
to
http://example.com/gallery/images/large/this%20image.jpg
Server side language has pre-defined function for that e.g. rawurlencode in PHP.
I don't think so. The facebook parser doesn't take whitespaces into account. Even if you use a redirect you will have issues later on. So it's better to just adjust your URLs now.

Preserving HTML Formating when posting a status update

I'm adding features to our in-house CMS, one of the requests is to be able to post content to the CMS and our Facebook page at the same time. I have the actual posting part working, however, the HTML tags that are embedded in the content do not render in the Facebook status.
I get something like:
<p>hello world</p> instead of the rendered text.
Is there a format that I can convert the html tags to that will preserve at least the line and paragraph breaks?
The API strips any and all HTML from status updates before rendering them. If you want to preserve line breaks, you encode them as you pass them, eg %0A for a line break
https://graph.facebook.com/me/feed?access_token=<ACCESS_TOKEN>&message=Hello%0AWorld!!!

Jeditable displays entire HTML document as replacement for the editable field after trigger/submit

I am using jeditable and had it working very weird.
after editing the editable field and submits it instead of printing the new content it displays the entire document window in the textbox(placeholder of editable content).
question: from the example where the author used save.php. what was the content of save.php?
is it necessary to send the result on a php file?? can't an HTML file work?
I believe within the comments box at the bottom of the author's main page - somebody has kindly provided a version of the save.php file for people to use and modify as needed.
The save.php file is used to actually save the values of the editable field/s. Without it, nothing would happen to the data and it would reset to the default text if the page is refreshed.
Options instead of a php file could be:
Saving the text/select changes to a Cookie
Using another server side methos such as asp, jsp, rails or .NET to process the saving of the changes.
an html page is a static page with no processing facility per say to communicate with the website server, so no.. html is not suitable for such a need.
Saving script must return the string you want to display on page after editing. You are now returning full html page.
Source of for all demofiles can be found from GitHub.