Skip to content
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

why are the clibpoard buttons added by JS and not R? #1675

Closed
maelle opened this issue May 7, 2021 · 6 comments · Fixed by #1812
Closed

why are the clibpoard buttons added by JS and not R? #1675

maelle opened this issue May 7, 2021 · 6 comments · Fixed by #1812
Assignees
Labels
front end 🌷 General HTML, CSS, and JS issues

Comments

@maelle
Copy link
Collaborator

maelle commented May 7, 2021

No description provided.

@maelle
Copy link
Collaborator Author

maelle commented May 7, 2021

I was wondering out of curiosity, but actually this reminds me of rstudio/bookdown#1072

If the buttons were written in R then the comments could be stripped (they're span "co") and the code would be put in a data-clipboard-text element https://clipboardjs.com/

@maelle
Copy link
Collaborator Author

maelle commented May 7, 2021

If downlit were the home for that code, it'd be easy to use it in both pkgdown and bs4_book, assuming stripping comments is also a good idea for pkgdown.

@maelle
Copy link
Collaborator Author

maelle commented May 7, 2021

or span "r-out co" only if one only wants to remove output, not actual comments.

@maelle
Copy link
Collaborator Author

maelle commented May 25, 2021

downlit output munging as in #1540

@maelle maelle added the front end 🌷 General HTML, CSS, and JS issues label May 25, 2021
@maelle
Copy link
Collaborator Author

maelle commented May 25, 2021

@apreshill I see a +1 so pinging you. Would you expect the code that end up on the clipboard to contain code comments or not? i.e. should only the output be removed.

@hadley
Copy link
Member

hadley commented Oct 13, 2021

Per discussion in PR, probably easier to do in JS with .replace(/\n#>[^\n]*/g, "")

hadley added a commit that referenced this issue Oct 13, 2021
hadley added a commit that referenced this issue Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
front end 🌷 General HTML, CSS, and JS issues
Projects
None yet
2 participants