quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.79k stars 310 forks source link

Can't republish qmd files containing Graphviz or Mermaids diagrams on Confluence #9407

Open CormacKinsella opened 5 months ago

CormacKinsella commented 5 months ago

Bug description

When I republish qmd files containing mermaids or graphviz diagrams to confluence, I get an error.

Steps to reproduce

# Title

```{dot}
//| label: fig-simplegraph
//| fig-width: 3
//| fig-cap: |
//|   A simple graph

graph Graph {
  layout=neato
  TA -- AT ;
  AT -- TA;
  AT -- TT;
  TT -- TA;
  AA -- AT;
  TA -- AA;

}

### Expected behavior

Should render and publish as normal.

### Actual behavior

ERROR: API Error: 400 - Bad Request

Stack trace:
    at ConfluenceClient.handleResponse (file:///opt/quarto/bin/quarto.js:105438:19)
    at ConfluenceClient.fetch (file:///opt/quarto/bin/quarto.js:105243:25)
    at eventLoopTick (ext:core/01_core.js:183:11)
    at async ConfluenceClient.updateContent (file:///opt/quarto/bin/quarto.js:105376:25)
    at async updateContent (file:///opt/quarto/bin/quarto.js:105703:32)
    at async doOperation (file:///opt/quarto/bin/quarto.js:105817:33)
    at async withSpinner (file:///opt/quarto/bin/quarto.js:75270:16)
    at async doWithSpinner (file:///opt/quarto/bin/quarto.js:104791:12)
    at async publishDocument (file:///opt/quarto/bin/quarto.js:105828:13)
    at async Object.publish5 [as publish] (file:///opt/quarto/bin/quarto.js:105969:49

### Your environment

Quarto version: Quarto 1.4.549
OS: Ubuntu 22.04.4 LTS (via WSL2 for Windows 11)
IDE: VSCode 1.88.1 Windows

### Quarto check output

```bash
Quarto 1.4.549
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.11: OK
      Dart Sass version 1.69.5: OK
      Deno version 1.37.2: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.4.549
      Path: /opt/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: v2024.04
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /home/cormac/.TinyTeX/bin/x86_64-linux
      Version: 2024

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.10.13 (Conda)
      Path: /home/cormac/programs/mambaforge/bin/python
      Jupyter: 5.7.1
      Kernels: python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........(None)

      Unable to locate an installed version of R.
      Install R from https://cloud.r-project.org/
CormacKinsella commented 5 months ago

Update to this, found this in the quarto docs - perhaps this is the reason? Quarto was rendering these diagrams locally and storing as pngs rather than rendering the diagram code on Confluence.

"However, there is currently no support for Citations, Videos, Diagrams, Tabsets, or Equations. In the future, we may add these features if there is a Confluence equivalent that can support the functionality."

cscheid commented 5 months ago

rather than rendering the diagram code on Confluence.

What do you mean by "rendering the diagram code on Confluence"? Has Confluence added support for it? In general, you cannot run Javascript code in confluence sites, and so we're required to render them all locally ahead of time.

I don't have a Confluence installation readily available to check, but if anything, the bug here is that Quarto should always be rendering the diagrams locally before uploading, and so Confluence would never know it's not a simple image.

CormacKinsella commented 5 months ago

Apologies I worded this badly - no there is still no support for rendering on Confluence itself. Just wondering if this might be linked to the issue with updating the webpage if it contains a locally rendered diagram.

the bug here is that Quarto should always be rendering the diagrams locally before uploading, and so Confluence would never know it's not a simple image

Yes that sounds right to me. And as I said in the original post, it handles it fine on the first publication to Confluence, only when republishing an edit does this issue occur.

Steinthal commented 3 weeks ago

I'm trying out publishing to Confluence and get the same behavior (Quarto 1.6.9; Positron 2024.09.0).

Maybe this info from the error message is of relevance?

warning: '299 - "Deprecated API, will be removed on Mon, 2 Dec 2024 00:00:00 GMT"',

This is the complete message issued for each mermaid cell:

ERROR: 
[Confluence] [General] response.status !== 200 Response {
  body: ReadableStream { locked: false },
  bodyUsed: false,
  headers: Headers {
    "atl-confluence-via": "<redacted>",
    "atl-traceid": "<redacted>",
    "cache-control": "no-cache, no-store, must-revalidate",
    "content-type": "application/json",
    date: "Fri, 06 Sep 2024 15:33:26 GMT",
    deprecation: "Wed, 1 Mar 2023 00:00:00 GMT",
    expires: "Thu, 01 Jan 1970 00:00:00 GMT",
    link: '<https://developer.atlassian.com/cloud/confluence/changelog/#CHANGE-864>; rel="deprecation"',
    nel: '{"failure_fraction": 0.001, "include_subdomains": true, "max_age": 600, "report_to": "endpoint-1"}',
    "report-to": '{"endpoints": [{"url": "<redacted>"}], "group": "endpoint-1", "include_sub'... 31 more characters,
    server: "<redacted>",
    "strict-transport-security": "max-age=63072000; includeSubDomains; preload",
    vary: "Accept-Encoding",
    warning: '299 - "Deprecated API, will be removed on Mon, 2 Dec 2024 00:00:00 GMT"',
    "x-content-type-options": "nosniff",
    "x-xss-protection": "1; mode=block"
  },
  ok: false,
  redirected: false,
  status: 400,
  statusText: "Bad Request",
  url: "<redacted>" 
cderv commented 3 weeks ago

Maybe this info from the error message is of relevance?

Definitely ! Not explain a 400 error, but it points us to some warning regarding API deprecation 🙀 We have this link: https://developer.atlassian.com/cloud/confluence/changelog/#CHANGE-864

We need to review which endpoints gets changed and adapt.