quarto-dev / quarto-dev/quarto-cli
`format-links` should support `target` attributes, and in general same attributes option as `other-links`
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
Discussed in https://github.com/quarto-dev/quarto-cli/discussions/10729
Originally posted by aghaynes September 6, 2024
Description
In a quarto website, I'd like to provide PDF versions of the various pages, which works great by setting
format:
html: default
pdf: default
But I would like the PDF to open in a new window (or even appear as a download), which i would normally do with target="_blank". According to the quarto website, it's possible to use format-links to customise the links, including any of the options from [https://quarto.org/docs/output-formats/html-basics.html#code-links-and-other-links](the code links section).
Unfortunately, I've been unable to get the target option to work. I've tried all four variants that come to mind ("blank", "_blank", blank and _blank), but none seem to work for the PDF, nor generic links. I also don't see the target attribute in the generated HTML code...
Am I missing something, or is it ignoring the additional attributes? I don't see the target attribute in the generated HTML code...
The target does work with other-links though via target: _blank...
---
title: "x"
format:
html: default
typst: default
format-links:
- html
- format: typst
text: PDF
icon: file-pdf
target: _blank
- text: Other Link
href: https://quarto.org/
icon: hand-thumbs-down
target: _blank
other-links:
- text: Another Link
href: https://quarto.org/
icon: hand-thumbs-up
target: _blank
---
This is a Quarto website.
To learn more about Quarto websites visit <https://quarto.org/docs/websites>.
```{r}
1 + 1
```
Thanks for any suggestions!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the provided Quarto document, using format-links and other-links with target: _blank. Compare the generated HTML for both link types; done means format-links preserves the target attribute for PDF and generic links, with tests or output confirming the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100