Skip to content

feat: add support for fragment indices in line highlighting (reveal.js) #13125

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mcanouil
Copy link
Collaborator

@mcanouil mcanouil commented Jul 24, 2025

Introduce support for fragment indices to enhance line highlighting functionality, allowing for more precise control over highlighted code segments in Reveal.js.

This adds a code-line-fragment-indices attribute to offer control over fragment.
When set, the same number of fragment indices as there are steps are required.

I'm not sure of the other changes that this new feature should be coming with.

---
format: revealjs
---

:::: {.fragment fragment-index="3"}
Step 3
:::

:::: {.columns}

:::: {.column width="50%"}
```{.r code-line-numbers="|2|3" code-line-fragment-indices="1,2,4"}
par(mfrow = c(1, 2))
plot(cars)
plot(cars, col = "red")
par(mfrow = c(1, 1))
```
:::

:::: {.column width="50%"}
```{.r code-line-numbers="|2|3" code-line-fragment-indices="1,2,4"}
par(mfrow = c(1, 2))
plot(cars)
plot(cars, col = "red")
par(mfrow = c(1, 1))
```
:::

:::

:::: {.fragment fragment-index="1"}
First step
:::

@mcanouil mcanouil self-assigned this Jul 24, 2025
@posit-snyk-bot
Copy link
Collaborator

posit-snyk-bot commented Jul 24, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@mcanouil mcanouil changed the title feat: add support for fragment indices in line highlighting (revealjs) feat: add support for fragment indices in line highlighting (reveal.js) Jul 24, 2025
@cderv cderv added this to the v1.9 milestone Jul 24, 2025
@cderv
Copy link
Collaborator

cderv commented Jul 24, 2025

Thanks for initiating !

Could be also related to

Also, do we have an issue about this new feature with a discussion or only the Slack question?
Discussing the issue, the design is sometimes easier, and I may have missed. So maybe the one above covers it.

And regarding naming, I think I would like to handle this one too before adding new options

Just listing all this as thoughts for later.

@mcanouil
Copy link
Collaborator Author

mcanouil commented Jul 24, 2025

Thanks for linking. The changes would indeed fix both issues. (I'm not linking them formally at this point to avoid risking closing the issues)

The PR is mostly here to not lose the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants