How can I parse a string to HTML in confluence?

304 Views Asked by At

I need to add some html code that is generated by a function through a browser page.

Basically I have the following function:

http://www.example.com/?.convert.HTML[]

that returns the following HTML code:

"<table><tbody><tr><th>functionView</th><th>cnt</th><th>lastRun</th><th>testVenue</th><th>status</th></tr><tr><td>venue_team</td><td>200</td><td>2020.04.03D10:29:33.998438000</td><td>venue_name</td><td style = \"color:#00b300; background-color: #ccffcc;\">PASS</td></tr><tr><td>venue_team</td><td>200</td><td>2020.04.03D10:29:33.998438000</td><td>venue_name</td><td style = \"color:#00b300; background-color: #ccffcc;\">PASS</td></tr></tbody></table>"

I need this to be parse in a HTML table in confluence.

1

There are 1 best solutions below

0
On

Depending on your requirements, this can either be somewhat easy, or quite difficult. The easy way to do it, it to create a user macro, that calls the function and inserts it via javascript into a div. This will lead to the page populating after load.

If you need to have it in the actual page source (statically), I'd suggest that you run a job to query the data and change the existing page using the REST api. Which will take more development effort.