Open mcanouil opened 2 months ago
In case it helps, I discovered this bug this morning too after updating from v.1.4
to v.1.5
(but also persists in v.1.6
). Took me quite some time to figure out that draft: true
was the problem.
I noticed that this happens for blogs but not standalone qmd-files. Also, it seems like the preview technically "works" the second time. It's just that the resulting HTML <body>
is empty. I can still navigate to the served file in my browser and it is not shown as "not found".
On Windows, I face the same issue with a blog in Quarto 1.5 and (pre-release of) 1.6. No issue with 1.4.
The suggestion of @AlbertRapp, namely, setting draft = false
, did not resolve the issue in my case.
@NicolasBoumal "draft" did not exist on 1.4.
@mcanouil The draft
yaml option existed already in 1.2 (not sure if before that though). Take for example this blog post from Tom Mock from 2022 that talks about using draft. In that post, Tom uses 1.2.242
Edit: No, it did not.
Tom used the _
prefix trick to create a draft mode as files prefixed with _
are not rendered and not included but still there.
Here we are talking about the website draft mode (which is a 1.5 feature) which allow preview and don't require de name/rename files with/without _
prefix.
The R function that is written in the blog post adds draft: true
to the YAML header if draft
R variable is true:
# add draft if draft
if(draft){
new_post_text <- [c](https://rdrr.io/r/base/c.html)(
new_post_core,
"draft: true",
"---\n"
)
} else {
new_post_text <- [c](https://rdrr.io/r/base/c.html)(
new_post_core,
"---\n"
)
}
As Tom comments, the _
prefix is redundant anyway to the YAML option. But this already acknowledges that draft: true
exists and does what one expects.
Anyway, I've used the draft: true
option for quite some time now on my blog (which I so far understood is a special case of a website due to the fact that my yaml file says project: type: website
). So I'm pretty sure that it's not a new 1.5
feature. After all, I only commented that the draft preview broke for me after updating from 1.4
. As far as I could tell, what's new is the cool draft
banner on top of a preview now and the special docs for draft mode but draft: true
has been there for some time now.
All in all, I don't really care what version this feature belongs to. Just wanted to add the information when things stopped working for me in case it helps to find out when/how that bug crept in.
I only meant to confirm that for me as well the issue with web preview appears in quarto v1.5+ (no issue in v1.4), while mentioning that (in my case) draft mode seems to have no effect on that issue.
Bug description
Quarto preview only works on first call/render on draft document.
Steps to reproduce
Add
draft: true
toposts/post-with-code/index.qmd
frontmatter.Preview the draft post
Expected behavior
Quarto should still preview a draft even when modified.
Actual behavior
https://github.com/quarto-dev/quarto-cli/assets/8896044/9f8e7efd-d97d-4bbd-9564-f1bc25dbc802
Quarto check output
9724c3dd403d4e723bcb0a7e7bef6e49d23a353a