Line breaks in page content

Hi there,

I am new to Confluence Cloud development, so I hope my question is not too basic.
I wrote a tool that creates a Confluence page on an old Confluence Server (on-premises), using the REST API.
I am porting it to our Cloud instance.

My biggest issue is that the ‘carriage return’ present in the HTML of the field are interpreted as ‘real’ carriage return in the page.
For example:

any text

Shows a bullet point and ‘any text’ on ANOTHER line in the page.
<li>any text</li>
Shows the bullet point and ‘any text’ on the same line.

I am adapting my code, but also wondering if I am doing anything wrong, or if there is some setting to adjust somewhere. Or some metadata to set.

Thank you.