[FR] Allow to selectively disable anchors added to headings or figures.
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- typescript
Research direction
Read src/format/html/format-html.ts around lines 709-731, then review the linked discussion and example document to understand the anchor conflict. The issue presents multiple possible designs rather than a decided change; done would require an agreed selective opt-out behavior for headings or figures.
Written by the indexing model from the issue text.
Description
anchor-sections configuration only allows true or false to opt-out adding anchor in a document. We don't have currently some more specific configuration to target one of the selector. In particular, sections and figures are dealt the same.
We could offer some more control over this in the future, like
- More configuration
anchor-sections: headings: false - or exposing the opt-out through
.no-anchorclass.
It can work with heading today, but really hard to set on computed figure because using cell optionclasses: no-anchorwill set on thediv.celland not on thediv.quarto-figure
Opening this to track idea. Motivation: See https://github.com/quarto-dev/quarto-cli/discussions/10274#discussioncomment-10023421 - the current situation creates conflict with interactive figure that could already have some content exactly at the same place as the anchor we add
Discussed in https://github.com/quarto-dev/quarto-cli/discussions/10274
Originally posted by royfrancis July 11, 2024
Description
A code chunk with a label creates a clickable anchor. This is usually fine and nice to have.
But sometimes, with interactive graphics, it can conflict with existing elements.
anchor-sections: false disables anchors for the whole document. Is it possible to disable anchors selectively by chunk? Or enable anchors for headings, but disable for figures?
An example document
Click here
---
title: Anchor conflict
format: html
---
## ggplot
```{r}
#| label: fig-ggplot
#| fig-cap: A ggplot figure
library(ggplot2)
data <- data.frame(x = c(1, 2, 3, 4, 5), y = c(10, 11, 12, 13, 14))
p <- ggplot(data = data,aes(x = x,y = y))+
geom_point()
p+labs(title="A ggplot figure")
```
## ggiraph
```{r}
#| label: fig-ggiraph
#| fig-cap: A ggiraph figure
library(ggiraph)
p1 <- p+labs(title="A ggiraph figure")
girafe(ggobj = p1) |>
girafe_options(opts_toolbar(saveaspng = TRUE))
```
## plotly
```{r}
#| label: fig-plotly
#| fig-cap: A plotly figure
library(plotly)
plot_ly(data, x = ~x, y = ~y, type = 'scatter', mode = 'markers') |>
layout(title = list(text = "A plotly figure", x = 0.1))
```
quarto 1.5.54
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
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.
More from quarto-dev/quarto-cli
-
binder bug
Difficulty 1/5 Under an hour Newbie friendliness 92/100
quarto-dev/quarto-cli#14907 · 3 comments ·
-
brand bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
quarto-dev/quarto-cli#14891 ·
-
brand bug html revealjs
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
quarto-dev/quarto-cli#14882 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
quarto-dev/quarto-cli#14875 ·
-
Percent scripts: accept raw-string (r""") and '''-delimited markdown cells, as jupytext writes them Openengines-jupyter enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
quarto-dev/quarto-cli#14850 · 2 comments ·
All issues in quarto-dev/quarto-cli
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
babalae/bettergi-scripts-list#3674 ·
-
ecosystem wording
Difficulty 1/5 Under an hour Newbie friendliness 90/100
matrix-org/matrix.org#3649 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
vadimdemedes/ink#1029 ·
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·