quarto-dev / quarto-cli

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

mermaid gantt diagram not in compact mode #6971

Closed jonassmedegaard closed 9 months ago

jonassmedegaard commented 1 year ago

Bug description

Embedded gantt diagram always renders in "expanded" mode.

Steps to reproduce

---
displayMode: compact

format:
  html:
    mermaid:
      displayMode: compact
---
```{mermaid}
gantt
    title A Gantt Diagram
    dateFormat  YYYY-MM-DD

    section Section
    A task           :a1, 2014-01-01, 30d
    Another task     :a2, 2014-01-20, 25d
    Another one      :a3, 2014-02-10, 20d

### Expected behavior

A gantt diagram in two lines, as per the example at http://mermaid.js.org/syntax/gantt.html#output-in-compact-mode

### Actual behavior

A gantt diaram in 3 lines.

### Your environment

- IDE: none
- OS: Debian Linux

### Quarto check output

```bash
$ quarto check
Quarto 1.4.376
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.8: OK
      Dart Sass version 1.55.0: OK
      Deno version 1.33.4: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.4.376
      Path: /opt/quarto/bin

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

[✓] Checking LaTeX....................OK
      Using: Installation From Path
      Path: /usr/bin
      Version: 2023

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

[✓] Checking Python 3 installation....OK
      Version: 3.11.5
      Path: /usr/bin/python3
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with python3 -m pip install jupyter

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

      Unable to locate an installed version of R.
      Install R from https://cloud.r-project.org/
mcanouil commented 1 year ago

For short, there is no bug here.


displayMode is not a Quarto YAML option thus has no effect, see https://quarto.org/docs/authoring/diagrams.html.

Also note that the "frontmatter config" is only available in mermaid.js v10.4.0. While Quarto 1.4 pre-release embed mermaid.js v10.2.0-rc.2 and Quarto 1.3 embed mermaid.js v9.1.1.

When Quarto will embed mermaid.js v10.4.0 or above you will be able to write the following but now you can't.

---
title: "Mermaid Gantt Diagram"
---

```{mermaid}
---
displayMode: compact
---
gantt
  excludes weekends
  tickInterval 1month
  axisFormat %e. %b.

  section All
  Event: 2023-09-01, 2m
  Event: 2023-10-01, 2m
pajaro1966 commented 11 months ago

Do you know if Quarto will include displayMode: compact in the forseeable future? Thanks in advance A.

For short, there is no bug here.

displayMode is not a Quarto YAML option thus has no effect, see https://quarto.org/docs/authoring/diagrams.html.

Also note that the "frontmatter config" is only available in mermaid.js v10.4.0. While Quarto 1.4 pre-release embed mermaid.js v10.2.0-rc.2 and Quarto 1.3 embed mermaid.js v9.1.1.

When Quarto will embed mermaid.js v10.4.0 or above you will be able to write the following but now you can't.

---
title: "Mermaid Gantt Diagram"
---

```{mermaid}
---
displayMode: compact
---
gantt
  excludes weekends
  tickInterval 1month
  axisFormat %e. %b.

  section All
  Event: 2023-09-01, 2m
  Event: 2023-10-01, 2m
fredguth commented 10 months ago

Trying to run on quarto 1.4.549

---
title: "Mermaid Gantt Diagram"
---

```{mermaid}
---
displayMode: compact
---
gantt
  excludes weekends
  tickInterval 1month
  axisFormat %e. %b.

  section All
  Event: 2023-09-01, 2m
  Event: 2023-10-01, 2m
yield this error:

``` {bash}
Now using node v18.16.0 (npm v9.5.1)
❯ quarto preview /Users/fredguth/Library/CloudStorage/OneDrive-Personal/Projects/sus/1_Projects/Produto-1/mermaid.qmd --no-browser --no-watch-inputs
Rendering qmd embeds [mermaid.qmd]
FATAL (/Applications/quarto/share/filters/main.lua:2568) An error occurred:
inlinesToString: expected Inlines, got Inline
Error running filter /Applications/quarto/share/filters/main.lua:
/Applications/quarto/share/filters/main.lua:2232: attempt to call a nil value (global 'crash_with_stack_trace')
stack traceback:
        /Applications/quarto/share/filters/main.lua:1820: in function 'fail'
        /Applications/quarto/share/filters/main.lua:2568: in function 'inlinesToString'
        /Applications/quarto/share/filters/main.lua:10458: in function 'columnOption'
        /Applications/quarto/share/filters/main.lua:10438: in function 'computeClassesForScopedColumns'
        /Applications/quarto/share/filters/main.lua:10264: in function 'resolveColumnClassesForCodeCell'
        /Applications/quarto/share/filters/main.lua:10227: in function </Applications/quarto/share/filters/main.lua:10223>
        (...tail calls...)
        [C]: in ?
        [C]: in method 'walk'
        /Applications/quarto/share/filters/main.lua:224: in function </Applications/quarto/share/filters/main.lua:214>
        (...tail calls...)
        /Applications/quarto/share/filters/main.lua:936: in local 'callback'
        /Applications/quarto/share/filters/main.lua:954: in upvalue 'run_emulated_filter_chain'
        /Applications/quarto/share/filters/main.lua:990: in function </Applications/quarto/share/filters/main.lua:987>
stack traceback:
        /Applications/quarto/share/filters/main.lua:224: in function </Applications/quarto/share/filters/main.lua:214>
        (...tail calls...)
        /Applications/quarto/share/filters/main.lua:936: in local 'callback'
        /Applications/quarto/share/filters/main.lua:954: in upvalue 'run_emulated_filter_chain'
        /Applications/quarto/share/filters/main.lua:990: in function </Applications/quarto/share/filters/main.lua:987>

is this because of the version of Mermaid Quarto uses? Is there a way to add mermaid gantt charts to Quarto? Where can I see a gantt example?

mcanouil commented 10 months ago

@fredguth Don't post multiple times the same things across the repository, please.

FYI:

cscheid commented 10 months ago

The crash is fixed on main and the fix will be included in a v1.4 patch release soon.

cscheid commented 9 months ago

This will be handled as part of our upgrade chores.