line / conflr

Post R Markdown documents to Confluence
https://line.github.io/conflr/
GNU General Public License v3.0
130 stars 28 forks source link

Publish pages in the new editor #125

Open stevenlockton-progenity opened 3 years ago

stevenlockton-progenity commented 3 years ago

I notice that conflr publishes pages in the old Confluence style/editor and there doesn't seem to be an option to select the new editor. A workaround is to immediately convert the just-conflr-published page to the new editor right away, but that breaks all the code hiding. Any subsequent updates to the same page retains the style in the new editor!

Is there any intention on catering to users of the new editor/confluence page style in the near future?

yutannihilation commented 3 years ago

Oh, I didn't know about the new editor. Sorry, I don't have any plans to implement it in the near future. As you noticed the new one seem to have an incompatible format to the old one, I'm afraid this will be a very tough job...

januz commented 3 years ago

We are still running a version of Confluence with the old editor so I can't test this, but maybe just adding the metadata information to the POST call as described in this Atlassian Community thread would work?! https://community.atlassian.com/t5/Confluence-questions/Creating-space-using-REST-API-creates-it-with-quot-old-quot/qaq-p/1275954#M185773

yutannihilation commented 3 years ago

Wow, thanks for the information! Hmm, I think this is a bug on Confluence's side so hope they fix this, but given that this is a year-old issue, it's unlikely to happen...

https://jira.atlassian.com/browse/CONFCLOUD-68057

januz commented 3 years ago

Yeah, I know it is a problem on their end but I thought it might be easy to implement this workaround in your package and have a user select the editor version when posting a page.

BenoitFayolle commented 2 years ago

Looks like Confluence recently fixed CONFCLOUD-68057 !

yutannihilation commented 2 years ago

Oh, thanks for sharing!

So..., while it's a cool news, the new editor's becoming default means now I need to think seriously about how to switch between new and old editors? As conflr converts .md into the syntax of the old editor and it's probably not completely compatible, I'm afraid the API returns an error in some cases :thinking:

https://jira.atlassian.com/browse/CONFCLOUD-68057?focusedCommentId=2873144&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-2873144

dpprdan commented 2 years ago

Not sure whether this helps, but this is an error I am getting after the document is rendered to markdown. The image upload seems to work fine, but the document seems to be the problem.

Checking the existing images...
Uploading the images...
Uploading the document...
Backtrace:
    x
 1. \-rmarkdown::render(...)
 2.   \-output_format$post_processor(...)
 3.     +-rlang::exec(...)
 4.     \-(function (title, space_key, type, parent_id, html_text, imgs, ...
 5.       \-conflr::confl_update_page(id = id, title = title, body = html_text)
 6.         \-conflr:::confl_verb(...)
 7.           \-rlang::abort(...)
 8.             \-rlang:::signal_abort(cnd)
Error: Error in paste(httr::http_condition(res, type = "error"), httr::content(res)): Bad Request (HTTP 400).
 400
* Error in paste(httr::http_condition(res, type = "error"), httr::content(res)): Bad Request (HTTP 400).
 list(authorized = FALSE, valid = TRUE, errors = list(), successful = FALSE)
* Error in paste(httr::http_condition(res, type = "error"), httr::content(res)): Bad Request (HTTP 400).
 com.atlassian.confluence.api.service.exceptions.BadRequestException: Content body cannot be converted to new editor format
Backtrace:
    x
 1. \-rmarkdown::render(...)
 2.   \-output_format$post_processor(...)
 3.     +-rlang::exec(...)
 4.     \-(function (title, space_key, type, parent_id, html_text, imgs, ...
 5.       \-conflr::confl_update_page(id = id, title = title, body = html_text)
 6.         \-conflr:::confl_verb(...)
Execution halted

Also, I have rendered documents successfully on this instance before, but they are without images. In fact they get updated weekly via CI. All pages with new editor, AFAICT.