-
Notifications
You must be signed in to change notification settings - Fork 7
docs: add custom javascript to remove prompt and output #78
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
Conversation
We have to use "console" to get the right classes for the clipboard script to work. If you use "sh" and add "$ " to the code block, it doesn't work
|
Very cool! It might be safer to use OTOH I think |
|
I clicked the button to copy the YAML at |
|
Looks like this doesn't handle |
|
Thanks for testing. I also notice that pycon blocks aren't perfect. Fixing these things now. |
|
Re: bash and zsh don't like this (though fish handles it gracefully) but I don't think it's an unreasonable choice on our part: The user sees multiple lines of commands and might be expecting their clipboard gets filled with similarly-structured output (i.e., we should preserve whitespace where we can and try to just remove prompt/comment chars). |
|
I've done some manually testing and I think the only place this doesn't work great is pycon blocks (we don't preserve whitespace which python needs to parse). This could be hard to do without rewriting the code. Can we skip it? |
|
With an assist from Claude Code, I fixed the leading whitespace issue and also made the script preserve blank lines. @amoeba please take a look. |
|
Seems to work nicely, thanks @ianmcook. |
|
Tested in Safari and Firefox. |
Creates and enables an extra.js script adapted from uv's docs that cleans copied code blocks by removing any prompts or output. Also updates some areas in the docs where we weren't using prompt chars that we now can.
Any code blocks with prompt characters must be
consolenotshfor this to work.Closes #54