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

Add copy/paste enable/disable lines for each rule #2700

Closed
nikclayton opened this issue Jun 13, 2024 · 3 comments · Fixed by #2702
Closed

Add copy/paste enable/disable lines for each rule #2700

nikclayton opened this issue Jun 13, 2024 · 3 comments · Fixed by #2702

Comments

@nikclayton
Copy link

Sorry, not a bug, but there wasn't a template for "Documentation change".

At the moment each rule entry in the documentation has a section at the bottom that lists the rule name and rule set.

For example, https://pinterest.github.io/ktlint/latest/rules/standard/#class-signature ends with:

Rule id: class-signature (standard rule set)

The only time I need this information is when I'm updating .editorconfig to enable or disable the rule. So it would be a helpful quality-of-life improvement if the system that generates the documentation could also insert a section with copy/pasteable strings that can be used directly. Bonus points if there's a "Copy" button I can use to copy the content directly.

@paul-dingemans
Copy link
Collaborator

Actually that was a good idea. It makes the documentation more easy to read.

@nikclayton
Copy link
Author

nikclayton commented Jun 17, 2024

#2702 doesn't resolve this issue.

Now the text looks like e.g., standard:class-signature.

I can't copy/paste that in to a .editorconfig file, it needs to be ktlint_standard_class-signature = disabled.

So the generated HTML should look something like this:

<p><code>.editorconfig</code>: <code>ktlint_standard_class-signature = disabled</code> <button onclick="navigator.clipboard.writeText('ktlint_standard_class-signature = disabled')">Copy</button></p>

@paul-dingemans
Copy link
Collaborator

Bonus points if there's a "Copy" button I can use to copy the content directly.

I have improved the solution to support copy to clipboard in #2705. Instead of a single click, you will need two clicks. As the rules documentation is stored in Markdown files, and via Mkdocs is converted to Html, it was not possible to go with your solution.

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 a pull request may close this issue.

2 participants