-
Notifications
You must be signed in to change notification settings - Fork 457
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
Example formats: Make it easier to copy paste examples #1684
Comments
Agreed. This would make it easier. We'd accept a PR for this. |
In general, we're trying to converge on a "commented return result" so that copy/paste works: ls / | get name; $in | describe
# => nothing Return results are indicated by ls | table -a 3
# => ╭───┬────────────────────┬──────┬──────────┬──────────────╮
# => │ # │ name │ type │ size │ modified │
# => ├───┼────────────────────┼──────┼──────────┼──────────────┤
# => │ 0 │ CITATION.cff │ file │ 812 B │ 2 months ago │
# => │ 1 │ CODE_OF_CONDUCT.md │ file │ 3.4 KiB │ 9 months ago │
# => │ 2 │ CONTRIBUTING.md │ file │ 11.0 KiB │ 5 months ago │
# => │ 3 │ ... │ ... │ ... │ ... │
# => │ 4 │ toolkit.nu │ file │ 20.0 KiB │ 2 weeks ago │
# => │ 5 │ typos.toml │ file │ 513 B │ 2 months ago │
# => │ 6 │ wix │ dir │ 4.0 KiB │ 5 months ago │
# => ╰───┴────────────────────┴──────┴──────────┴──────────────╯ I'll take the blame for the ones you mention being in the current state that makes copy/paste difficult - I read somewhere about the format above, but I didn't understand the reason behind it when I first started submitting doc PR's here. |
There sure are a lot of them. Looks like close to 500: grep -ri '^\w*>' It would be nice to get the majority into the "copyable" format so that new contributors don't make the same mistake I did and follow the "bad examples.' |
I'd be happy to take some time and clean this up! |
A few quick points as I'm getting into this:
|
@0x4D5352 Great questions.
|
@NotTheDr01ds Sounds good! Pedagogically, I like the idea of keeping the prompt in for these types of sections. The code snippets in those sections feel less like examples you can plug-and-play with and more like concepts to be aware of. I kept them in when submitting the PR for the book changes; will likely do the same for the rest of the changes. |
# Description Conforming the examples in the README documentation to match the new example formatting suggested in nushell/nushell.github.io#1684. # User-Facing Changes Examples no longer have a prompt indicator, and example results are now inside of commend blocks. This should improve the ability for users to test out the examples when exploring nushell for the first time. # Tests + Formatting No tests have been added as this is purely a documentation change.
Example taken from https://www.nushell.sh/book/pipelines.html#when-does-in-change-and-when-can-it-be-reused but are many places in the documentation:
Should be split in two and the prefixed
>
should be removed:Because many readers allow copying a code block and that is practical for pasting and executing: Like it does here in gitlab PR reader.
Now I have to manually select the code I want executed and that is tedious.
PS: It seems like the documentation is not consistent on this, some places it looks as I suggest.
The text was updated successfully, but these errors were encountered: