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

footer icons need HTML, which prevents extensions from resolving assets #9473

Open
aronatkins opened this issue Apr 24, 2024 · 7 comments
Open
Labels
bug Something isn't working websites Issues creating websites

Comments

@aronatkins
Copy link
Contributor

aronatkins commented Apr 24, 2024

Bug description

An extension defining a custom project type wants to declare a shared footer and use some images as icons within that footer. For example:

website:
  page-footer:
    right:
      - text: "<img src='/images/posit-logo-black-TM.svg' id='footer-right-posit-logo'>"
        href: "https://posit.co"

If the page footer supported an image attribute and took an image path, the in-extension path could be resolved without resorting to HTML.

website:
  page-footer:
    right:
      - image: "/images/posit-logo-black-TM.svg"
        href: "https://posit.co"

My understanding is that Quarto does not attempt to resolve asset paths within text, but can do so for fields which are known to contain file references.

Steps to reproduce

No response

Expected behavior

No response

Actual behavior

No response

Your environment

No response

Quarto check output

Quarto 1.4.551
[✓] 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.551
      Path: /Users/aron/quarto/quarto-1.4.551-macos/bin

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

[✓] Checking LaTeX....................OK
      Using: Installation From Path
      Path: /Library/TeX/texbin
      Version: 2024

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

[✓] Checking Python 3 installation....OK
      Version: 3.12.2
      Path: /opt/homebrew/opt/python@3.12/bin/python3.12
      Jupyter: (None)

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

[✓] Checking R installation...........OK
      Version: 4.3.3
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library
      knitr: 1.45
      rmarkdown: 2.26

[✓] Checking Knitr engine render......OK
@aronatkins aronatkins added the bug Something isn't working label Apr 24, 2024
@mcanouil mcanouil added the websites Issues creating websites label Apr 24, 2024
@mcanouil
Copy link
Collaborator

mcanouil commented Apr 24, 2024

In the case of the addition of image, then image-alt and image-title should also be added.
Possibly other attributes (image-width) as done for the about page template: https://github.com/mcanouil/quarto-cli/blob/31d5390770394d678b737bdc2d135f54f7eb9684/src/resources/projects/website/about/_image.ejs.html

@mcanouil
Copy link
Collaborator

mcanouil commented Apr 24, 2024

FYI, markdown works in text (at least in 1.5).

  page-footer:
    right:
      - text: "![](/images/posit-logo-black-TM.svg){#footer-right-posit-logo width=100px}"
        href: "https://posit.co"

Although, Quarto will raise a warning:

WARNING (src/resources/filters/./quarto-pre/parsefiguredivs.lua:517) Figure with invalid crossref category: footer-right-posit-logo
Won't be able to cross-reference this figure.

@cscheid
Copy link
Collaborator

cscheid commented Apr 25, 2024

Although, Quarto will raise a warning

We're raising a warning because of the dashes being used here. (We've considered removing this warning because it causes too many false positives like that. I'll probably do it right now.)

@aronatkins
Copy link
Contributor Author

@mcanouil - I cannot replicate your text example. When an extension declares page-footer with an image like your example, the resulting HTML contains paths which are relative to the extension directory and not resolved.

@mcanouil
Copy link
Collaborator

The example was mostly about the statement saying that HTML is required.

The main issue with assets inside extension is how to tell Quarto how to find them, both when creating an extension and using them.
Currently, if you use some paths in a template.qmd at the root of your extension, the directory tree does not contains org/user account, while it will when quarto add/use.
One way to "solve" this is format-resources (https://quarto.org/docs/journals/formats.html#format-resources).
Unfortunately, it means to copy the assets from the extension into the main directory.

@mcanouil
Copy link
Collaborator

mcanouil commented Apr 26, 2024

It would be nice if Quarto could look for resources inside extensions without having to set "_extensions/account/ext-name" (path if installed using quarto add) for all resources.

@mcanouil
Copy link
Collaborator

For reference:

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

No branches or pull requests

3 participants