Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listing YAML breaks headers when included with no newline #12066

Open
seragunn opened this issue Feb 12, 2025 · 6 comments
Open

Listing YAML breaks headers when included with no newline #12066

seragunn opened this issue Feb 12, 2025 · 6 comments
Labels
bug Something isn't working listings

Comments

@seragunn
Copy link

seragunn commented Feb 12, 2025

Bug description

I don't know if this is a regression or if it was never the intended behaviour to put a listing definition in an included file.

Starting in v1.7.4, if you have the listing YAML definition in an included file, it is echoed when it's included (but is still processed)

Steps to reproduce

_quarto.yml:

project:
  type: website
  title: "listing-issue"

index.qmd

# News
{{< include news.qmd >}}

news.qmd

---
listing:
  contents: news
  id: news
---

::: {#news}
:::

news/newsitem.qmd

---
title: sample news
---

# Test

News content

Expected behavior

v1.7.3:

Image

Actual behavior

v1.7.4:

Image

Your environment

No response

Quarto check output

`quarto check` output
Quarto 1.7.4
[✓] Checking environment information...
      Quarto cache location: /home/sera/.cache/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.4.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.46.3: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.7.4
      Path: /opt/quarto/bin

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

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

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

[✓] Checking Python 3 installation....OK
      Version: 3.13.1
      Path: /usr/bin/python3
      Jupyter: 5.7.2
      Kernels: julia-1.11, ir, python3, sagemath

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

[✓] Checking R installation...........OK
      Version: 4.4.2
      Path: /usr/lib64/R
      LibPaths:
        - /home/sera/.R
        - /home/sera/R/x86_64-pc-linux-gnu-library/4.4
        - /usr/lib/R/library
      knitr: 1.48
      rmarkdown: 2.28

[✓] Checking Knitr engine render......OK
@seragunn seragunn added the bug Something isn't working label Feb 12, 2025
@seragunn seragunn changed the title Listing yaml doesn't read correctly from include Listing yaml doesn't read correctly from include since v1.7.4 Feb 12, 2025
@seragunn seragunn changed the title Listing yaml doesn't read correctly from include since v1.7.4 Listing yaml is echoed after parsing when defined in an included file since v1.7.4 Feb 12, 2025
@mcanouil
Copy link
Collaborator

mcanouil commented Feb 12, 2025

Did you try the latest pre-release? When using pre-release, please always use the latest and avoid making comparisons with past versions before trying out the latest version first.

What's the use case where you need to include a file with a YAML frontmatter such as a listing to a page, instead of defining the listing directly in that page?
Beside the possible bug you are reporting, you put yourself in a position where metadata can be overwritten by each include you make.

@mcanouil
Copy link
Collaborator

I've created a default blog project and cannot reproduce the issue:

Image

@seragunn
Copy link
Author

Thanks for the response. I looked into this more and I narrowed down the issue:

It happens when you have a section heading directly above your include (with no line in between)

---
title: "demo"
---

# Blog content
{{< include _index.qmd >}}

Image

And sorry I should have specified. I noticed the issue on the latest pre-release (1.7.13) but I did a bifurcation to track the issue down to the 1.7.4 update. This screenshot is with 1.7.13.

Use case: me and my colleague are trying to rebuild our website in Quarto and to help modularize the homepage, he put the news listing in a subfile. It's easy enough to avoid this issue by either defining the listing in the main file or to, it appears, put a newline after the heading.

@mcanouil
Copy link
Collaborator

mcanouil commented Feb 12, 2025

Note that having empty lines surrounding headers, lists, and code blocks is one of the rule shared by all markdown linters to precisely avoid these issues.

Image

Because in your case you end up with a very weird markdown.

---
title: "demo"
---

# Blog content
---
listing:
  ...
---

Which obviously will confuse markdown readers, since "underlined" text is a header, and you can use both header syntax at the same time.

See GitHub for instance:

InputOutput
## Header using `#`

Header using `---` below
---

## Header using `#` AND `---` below
---

Header using #

Header using --- below

Header using # AND --- below


@seragunn
Copy link
Author

Gotcha, that makes sense. Thanks for your time. I'm going to close this issue now since everything is behaving as expected.

@mcanouil mcanouil reopened this Feb 12, 2025
@mcanouil
Copy link
Collaborator

mcanouil commented Feb 12, 2025

I'm reopening because the lead maintainer might want to either ensure empty lines are added by the "include shortcode" and/or keep this for future linting, etc.
CC @cscheid

@seragunn seragunn changed the title Listing yaml is echoed after parsing when defined in an included file since v1.7.4 Listing YAML breaks headers when included with no newline Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working listings
Projects
None yet
Development

No branches or pull requests

2 participants