quarto-dev / quarto-dev/quarto-cli

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

Open
#10,273 5 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

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".

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/format/html/format-html-links.ts around lines 95-104, then review the format-links example in the HTML multi-format documentation. Determine how customized text for extension formats should suppress the appended extension name, and verify that the resulting link displays only the configured text such as “PDF”.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
web-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.