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

generated figures with specified output file and directory are not found with html output #10963

Open
anielsen001 opened this issue Oct 3, 2024 · 1 comment
Labels
bug Something isn't working computations

Comments

@anielsen001
Copy link

Bug description

I'm trying to generate an html output with figures generated by python and specify the name of the output file and directory. When I do this, the html is broken and the image files do not link correctly.

For some background I would like to use quarto parameters with python to generate a series of web pages in a sub-directory for my project, which is a website. I'm trying to use the --output and --output-dir flags on the cli to specify the name of the output file instead of the template .qmd file that I created.

Steps to reproduce

See the following github repo: https://github.com/anielsen001/quarto-output-dir-files

Run this command:

quarto render demo/demo.qmd --output new_demo.html --output-dir _site/

view the output html in _site/new_demo.html in a browser.

If you do a simple quarto render on the entire project, then _site/demo/demo.html views properly in a browser.

I tried a second alternative:

quarto render demo/demo.qmd --output new_demo.html --output-dir _site/new_demo

This version generates an entire new website at _site/new_demo and the resulting _site/new_demo/new_demo.html is also broken.

Expected behavior

I expect to specify the name of an output file and directory for an html page and have the generated figures link correctly to the html page.

Actual behavior

The generated html does not link correctly to the figures and the additional css formatting is missing.

Your environment

editing in emacs, using cli to generate output, chrome to view html output

Quarto check output

Quarto 1.5.57
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.2.0: OK
Dart Sass version 1.70.0: OK
Deno version 1.41.0: OK
Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.5.57
Path: /opt/quarto/bin

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

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

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

[✓] Checking Python 3 installation....OK
Version: 3.12.1
Path: /home/apn/temp/output-name-test/venv/bin/python3
Jupyter: 5.7.2
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/
@anielsen001 anielsen001 added the bug Something isn't working label Oct 3, 2024
@mcanouil
Copy link
Collaborator

mcanouil commented Oct 7, 2024

I don't think that's really a bug.
See:

You are breaking the link because you change the structure of the file path without accounting for the "demo" directory.

That's not an approach that is supported (at least for now).

In a scenario, where I would use parameterised website page, I would have _template.qmd leaving "outside" the project and take a pre-render script to render the template into other qmd files which would be integrated in the website.
Or even use include shortcode to have the logic in several documents which could have different default parameters / YAML.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working computations
Projects
None yet
Development

No branches or pull requests

2 participants