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

Make it possible to add copy to clipboard icon #324

Open
MarcSkovMadsen opened this issue Jan 16, 2024 · 3 comments
Open

Make it possible to add copy to clipboard icon #324

MarcSkovMadsen opened this issue Jan 16, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@MarcSkovMadsen
Copy link

MarcSkovMadsen commented Jan 16, 2024

Context

I'm a contributor and user of HoloViz Panel. It uses markdown-it-py as the default renderer for markdown.

I would really like my code blocks to be easy to copy-paste. I would like a copy icon similar to what most data app and tech doc frameworks I know support.

I cannot see how this is possible with markdown-it-py. And I would really like it. So therefore I propose this feature request.

Proposal

A plugin to add a copy to clipboard icon to the rendered markdown.

For example like Github does

image

Or like Quarto does it

image

Additional Context

Tasks and updates

No response

@MarcSkovMadsen MarcSkovMadsen added the enhancement New feature or request label Jan 16, 2024
Copy link

welcome bot commented Jan 16, 2024

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.

If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).

Welcome to the EBP community! 🎉

@chrisjsewell
Copy link
Member

Heya, this would probably not be done at the parser level though?

For example, the documentation here (which is created using markdown-it-py for back-end parsing) has copy buttons https://markdown-it-py.readthedocs.io/en/latest/using.html:

image

But these are implemented as front-end javascript, added to the page by https://github.com/executablebooks/sphinx-copybutton/blob/1a2ee439dae08de21d429dd5b4abc587579c3cf4/sphinx_copybutton/_static/copybutton_funcs.js

With HoloViz markdown based html is dynamically added to the application. And even streamed if the web app is a chat interface. So adding buttons on load of the document will not solve the problem.

it might be then that you have to activate this Javascript to run in some, each time the page changes

@emcd
Copy link

emcd commented Jul 22, 2024

I would expect this to be a plugin for the Python Markdown-It. It is more than just JS code, since a relatively-positioned HTML button must be generated as part of the output. For the JS Markdown-It, several people have created such plugins:

Unless you're aware of someone working on a Python implementation, I may create one soon, since I have need of it. (Another Holoviz Panel user.)

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

No branches or pull requests

3 participants