quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.7k stars 300 forks source link

Allow opting out extension name part in `format-link` text when customizing content #10273

Open cderv opened 1 month ago

cderv commented 1 month ago

It seems not possible today to really customize fully the text as the extension name will always be appended in parenthesis if the format comes from an extension

https://github.com/quarto-dev/quarto-cli/blob/9724c3dd403d4e723bcb0a7e7bef6e49d23a353a/src/format/html/format-html-links.ts#L95-L104

Should we add a new option to allow overriding this ?

Or should just an example showing the href form be used instead for those situation ? https://quarto.org/docs/output-formats/html-multi-format.html#specifying-formats-to-link

To think about.

Discussed in https://github.com/quarto-dev/quarto-cli/discussions/10270

Originally posted by **aaronschiff** July 11, 2024 ### Description This is pretty minor but ... I care about details 😅 I have a project that produces html and pdf output via a custom Typst template. I have used `format-link` in the project's `_quarto.yml` file to change the way the link to the Typst output is displayed in the html table of contents, but it still includes the template's name in brackets. Is there a way to remove the template name? Here is the relevant part of the project `_quarto.yml`, where my template is called "cheatsheet": ``` format: html: toc: true cheatsheet-typst: toc: false format-links: - html - format: cheatsheet-typst text: PDF icon: file-pdf ``` Here's link in the rendered html: Screenshot 2024-07-11 at 17 13 39 I'd like it to just say "PDF".
aaronschiff commented 1 month ago

Thanks for considering this. I’m not sure if you need to add another option for this case? If the user has specified the text parameter in format-links you can take that directly as what the user wants to be shown in the link output. That was how I assumed it would work based on the documentation.

mcanouil commented 1 month ago

I agree text value should be left untouched.

EirikTengesdal commented 3 weeks ago

I would also like it if this automatic addition of (kExtensionName) (yielding, e.g., PDF (preprint)) to the document can be overridden, since it prevents me from using it for purposes like submitting manuscripts.

(Of course, I could just edit/remove the resulting (preprint) part of string from the HTML source code, but for reproducibility and consistency reasons, it would be good to have the option to make Quarto generate it like that in the first place.)