quarto-dev / quarto

Quarto open-source scientific and technical publishing system
https://quarto.org
GNU Affero General Public License v3.0
280 stars 19 forks source link

Revealjs preview (within VS Code) often does not go to current slide, most notably when `slide-level` is set in project- or directory- level YAML #374

Open connortwiegand opened 4 months ago

connortwiegand commented 4 months ago

Hi there, I have experienced quite a bit of trouble with getting Quarto in VS Code to navigate to the current revealjs slide. After a bit of testing, I believe I have identified the source of the problem. It is similar to issue #6409 in the quarto-dev/quarto-cli repo, but involves the slide-level YAML option. I am unsure if this persists to, say, RStudio.

I also found some other behavior which tripped me up in finding the root of the issue, which I have included at the end.

Primary Issue:

If

---
format: 
   revealjs:
      slide-level: 3
---

Is located in either _quarto.yml or _metadata.yml, the slide preview in VS Code reverts to a different slide than the one I am currently on (e.g. looking at, previously edited, or @ cursor position). I think it processes the heading tags (##) in a weird way, because it is hard to pin down the exact behavior for an ideal MRE.

If the slide-level: 3 is located in the document YAML, however, it seems that everything is (mostly) fine. The MRE at the end should work to reproduce this, provided that slide-level: 3 is removed from the document and placed in a _quarto.yml or _metadata.yml within the project. Of course, this is replaced at the document level with format: revealjs.


Software Info:

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.01
      Chromium: (not installed)

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

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

[✓] Checking Python 3 installation....OK
      Version: 3.11.6 (Conda)
      Path: /home/cwiegand/miniconda3/bin/python
      Jupyter: 5.5.0
      Kernels: python3

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

[✓] Checking R installation...........OK
      Version: 4.3.2
      Path: /usr/lib/R
      LibPaths:
        - /home/cwiegand/R/x86_64-pc-linux-gnu-library/4.3
        - /usr/local/lib/R/site-library
        - /usr/lib/R/site-library
        - /usr/lib/R/library
      knitr: 1.45
      rmarkdown: 2.25

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

Other Strange Behavior

Here is some other interesting behavior I found along the way. See MRE for reference. Some of these could be inferred from reading the pandoc manual, but I wanted to include them here for documentation's sake.

Default "issues":

  1. No YAML title, manual # <title-slide>,
    • Slide preview is one (1) slide ahead of cursor
  2. YAML title, no # <title-slide>, yes <!-- <html-comment> --> before first slide
    • Slide preview is one (1) slide behind cursor
  3. YAML title, manual # <title-slide>, <!-- <html-comment> --> before the title slide
    • Slide preview is one (1) slide behind cursor

slide-level: 3 (within document YAML) "issues":

  1. Without a YAML title, no html comments, optional # title slide or ## section slide
    • Slide preview is 1 slide ahead of cursor
  2. With a YAML title, no manual # title slide, but an html comment before first slide (even a section slide)
    • Slide preview is 1 slide behind cursor
  3. With a YAML title and manual # title slide, but an html comment before title slide
    • Slide preview is 1 slide ahead of cursor

MRE (document level):

---
format: 
    revealjs: 
        slide-level: 3
title: "test"
---

<!-- html-comment -->

# title

## section

### Slide 1

- content

### Slide 2
- list

### Slide 3
update

### Slide 4 
The end