Content-Length: 600316 | pFad | http://github.com/eslint/eslint/pull/18855

8E docs: add copy button for the site by gweesin · Pull Request #18855 · eslint/eslint · GitHub
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

docs: add copy button for the site #18855

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

gweesin
Copy link
Contributor

@gweesin gweesin commented Sep 4, 2024

closed #18769

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[X] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

What changes did you make? (Give an overview)

add a copy button for each code blocks

image
image

Is there anything you'd like reviewers to focus on?

can we make the style better match the current website theme?

@gweesin gweesin requested a review from a team as a code owner September 4, 2024 16:32
@eslint-github-bot eslint-github-bot bot added the documentation Relates to ESLint's documentation label Sep 4, 2024
Copy link

netlify bot commented Sep 4, 2024

Deploy Preview for docs-eslint ready!

Name Link
🔨 Latest commit 6bb6c07
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/67598d8a3ab5800008134e5d
😎 Deploy Preview https://deploy-preview-18855--docs-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Tanujkanti4441
Copy link
Contributor

Hi @gweesin, thanks for PR, but right now CI is failing, could you fix that?

@gweesin
Copy link
Contributor Author

gweesin commented Sep 6, 2024

Hi @gweesin, thanks for PR, but right now CI is failing, could you fix that?

sure, it seems this is a lint problem, but now I can't run the trunk command. So you can see lots of format commits manually.

I will research it later.

@gweesin
Copy link
Contributor Author

gweesin commented Sep 6, 2024

anybody can help?

PS D:\opensource\eslint> trunk
node:internal/deps/undici/undici:13185
      Error.captureStackTrace(err);
            ^

TypeError: fetch failed
    at node:internal/deps/undici/undici:13185:13
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
  [cause]: Error: read ECONNRESET
      at TLSWrap.onStreamRead (node:internal/stream_base_commons:218:20) {
    errno: -4077,
    code: 'ECONNRESET',
    syscall: 'read'
  }
}

Node.js v22.8.0

@Jay-Karia
Copy link
Contributor

anybody can help?

PS D:\opensource\eslint> trunk
node:internal/deps/undici/undici:13185
      Error.captureStackTrace(err);
            ^

TypeError: fetch failed
    at node:internal/deps/undici/undici:13185:13
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
  [cause]: Error: read ECONNRESET
      at TLSWrap.onStreamRead (node:internal/stream_base_commons:218:20) {
    errno: -4077,
    code: 'ECONNRESET',
    syscall: 'read'
  }
}

Node.js v22.8.0

Seems like a network issue

@Tanujkanti4441
Copy link
Contributor

docs/src/assets/images/icons/copied.svg
fmt Unoptimized svg, fix by running 'trunk fmt'

i guess recommended command is trunk fmt to optimize the SVG that is creating the issue.

@gweesin
Copy link
Contributor Author

gweesin commented Sep 6, 2024

docs/src/assets/images/icons/copied.svg
fmt Unoptimized svg, fix by running 'trunk fmt'

i guess recommended command is trunk fmt to optimize the SVG that is creating the issue.

Yes, the error caused by fetch https://trunk.io/releases/1.22.3/trunk-1.22.3.mingw.tar.gz

image

but my network really connect it successfully: image


Hoping another collaborator can help me run the command trunk fmt to fix this lint ci problem.

@nzakas
Copy link
Member

nzakas commented Sep 6, 2024

@gweesin what operating system are you on?

@det can you help us debug this trunk problem?

@nzakas
Copy link
Member

nzakas commented Sep 6, 2024

Thanks for taking a look at this.

All of the code samples now have the language in the upper-right corner. I don't think we want that.
Screenshot 2024-09-06 at 11-49-05 Getting Started with ESLint - ESLint - Pluggable JavaScript Linter

I think the copy button should be visible all the time, not just on hover. Also, the image disappears completely in light mode.
Screenshot 2024-09-06 at 11-49-36 Getting Started with ESLint - ESLint - Pluggable JavaScript Linter

Also, we should not be applying this to valid/invalid code in the rules docs as it overlaps.

Screenshot 2024-09-06 at 11-51-02 array-callback-return - ESLint - Pluggable JavaScript Linter
Screenshot 2024-09-06 at 11-51-31 array-callback-return - ESLint - Pluggable JavaScript Linter

@gweesin
Copy link
Contributor Author

gweesin commented Sep 6, 2024

@gweesin what operating system are you on?

@det can you help us debug this trunk problem?

my OS is Windows 11. I can provide more informations if you need.

@gweesin
Copy link
Contributor Author

gweesin commented Sep 6, 2024

@nzakas Thanks for your review.
the language corner forked from vitepress, I haven't removed it before because it worked properly. Also I can remove it latter.

button's icon disapeers in light mode seems a bug.

shouldn't display in code block for validation demo is the good user experience.

I will fix for all of advertisements. Thanks a lot.

@EliSchleifer
Copy link

@det is on the case - working with reporter to understand why trunk fmt won't run on box

Copy link

Hi everyone, it looks like we lost track of this pull request. Please review and see what the next steps are. This pull request will auto-close in 7 days without an update.

@github-actions github-actions bot added the Stale label Sep 22, 2024
@Tanujkanti4441
Copy link
Contributor

Hi @gweesin, there are some suggestions, you can check them out :).

Copy link

github-actions bot commented Oct 3, 2024

Hi everyone, it looks like we lost track of this pull request. Please review and see what the next steps are. This pull request will auto-close in 7 days without an update.

@github-actions github-actions bot added the Stale label Oct 3, 2024
@amareshsm
Copy link
Member

@gweesin Just a gentle reminder: there’s some feedback that I'd appreciate you taking a look at. If you're busy, please let us know, and I can handle it from here.

Additionally, I’ve addressed the lint issue for now and pushed the changes from my end.

@github-actions github-actions bot removed the Stale label Oct 6, 2024
Copy link

Hi everyone, it looks like we lost track of this pull request. Please review and see what the next steps are. This pull request will auto-close in 7 days without an update.

@github-actions github-actions bot added the Stale label Oct 16, 2024
@amareshsm
Copy link
Member

@gweesin Just a gentle reminder: there’s some feedback that I'd appreciate you taking a look at. If you're busy, please let us know, and I can handle it from here.

Additionally, I’ve addressed the lint issue for now and pushed the changes from my end.

Since it has been pending for a long time I will take over the pr complete the remaining changes.

@amareshsm amareshsm removed the Stale label Oct 18, 2024
@amareshsm amareshsm self-assigned this Oct 18, 2024
@gweesin
Copy link
Contributor Author

gweesin commented Oct 25, 2024

@gweesin Just a gentle reminder: there’s some feedback that I'd appreciate you taking a look at. If you're busy, please let us know, and I can handle it from here.
Additionally, I’ve addressed the lint issue for now and pushed the changes from my end.

Since it has been pending for a long time I will take over the pr complete the remaining changes.

Thanks! I'm sorry I have no time to fix it recently. Also puzzled by running trunk command.

@nzakas
Copy link
Member

nzakas commented Oct 25, 2024

@gweesin has someone reached out to you to discuss your issues with Trunk?

@gweesin
Copy link
Contributor Author

gweesin commented Oct 26, 2024

@gweesin has someone reached out to you to discuss your issues with Trunk?

Chris Clearwater told me upgrade the trunk launcher package to version 1.3.2 on Slack, but nothing changed. And then the communication was stopped.

@nzakas
Copy link
Member

nzakas commented Oct 28, 2024

Okay, I'll reach out to them and see if we can get you some help.

@gweesin
Copy link
Contributor Author

gweesin commented Nov 28, 2024

Okay, I'll reach out to them and see if we can get you some help.

I'm sorry for resolving this issue so late. Here is my solution for the trunk installation:

  1. Download trunk-1.22.3.mingw.tar.gz using Chrome.
  2. Start a local static server to serve the file via an HTTP request.
  3. Modify the download URL in /node_modules/@trunkio/launcher/src/download.js.
  4. The program should now be able to download the file successfully.

It would be better if Trunk could support reading the download mirror from environment variables.

I will continue working on this PR.

@nzakas
Copy link
Member

nzakas commented Dec 2, 2024

@gweesin thanks for the update, and glad you got things working. Do you want to finish up this PR?

@gweesin
Copy link
Contributor Author

gweesin commented Dec 3, 2024

@gweesin thanks for the update, and glad you got things working. Do you want to finish up this PR?

I have rebased the branch and fixed the bugs you mentioned. However, I couldn't reproduce this particular issue. It seems to be a temporary compilation state during development.

image

Thank you for your review! We're now ready to revisit the code for further review.

@nzakas
Copy link
Member

nzakas commented Dec 4, 2024

I've tested in both Firefox and Edge, and I'm still seeing the button without an icon. I'm using the deploy preview:
https://deploy-preview-18855--docs-eslint.netlify.app/

@nzakas
Copy link
Member

nzakas commented Dec 9, 2024

I can see the icon now! 🎉

I think in dark mode the button should be darker. Basically, just slightly lighter than the background.

Screenshot 2024-12-09 at 11-32-42 Getting Started with ESLint - ESLint - Pluggable JavaScript Linter

In light mode, we already have the button as slightly darker than the background.

Screenshot 2024-12-09 at 11-33-25 Getting Started with ESLint - ESLint - Pluggable JavaScript Linter


[class*="language-"] > .c-btn--copy:hover,
[class*="language-"] > .c-btn--copy.copied {
opacity: 0.8;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The semi-transparency is a problem when the button overlaps text, making it harder to see the button on hover.

What do you think about doing a box-shadow on hover instead?

@nzakas
Copy link
Member

nzakas commented Dec 11, 2024

At least on my screen, I don't see anything in dark mode and light mode is also difficult to see.

Maybe we should just go with a glow effect using box-shadow? So something along the lines of 0 0 5px rgba(0, 0, 0, 0.4) (although that only looks good in light mode and can't be seen in dark mode.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor pool documentation Relates to ESLint's documentation
Projects
Status: Implementing
Development

Successfully merging this pull request may close these issues.

Docs: Add copy button to code blocks
6 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/eslint/eslint/pull/18855

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy