support extracting nu code snippets into standalone .nu files for better downstream trackability#2162
Conversation
…ter downstream trackability
|
the people yearn for programmatically trackable cookbook recipes |
|
what people? |
|
i'm ok with this, although there are more scripts than the few you have in this pr probably. @hustcer usually makes most decisions on this repo so i'll leave it up to him. |
just a meme format lol (see: "my people yearn for freedom") |
|
Thanks, I’m fine with this change. |
|
Apologies for missing this, but ... We used to do this, and we decided to remove snippets. It was a lot of work to remove them across all of the files and translations, and I really don't want to re-introduce this "feature." Translations being one of the bigger issues. I know that this is limited to the Cookbook at the moment, and I don't think we have any Cookbook translations. It's probably my fault for never finishing up #1487 and adding this guidance to Contributing.md ;-) Also note that the support is already there (see 61adb5c), so no need to add a new plugin for it, I don't think? But regardless, I'd like to consider moving these back to being embedded in the md files themselves. It's far easier on maintainers to edit all in one doc. The disadvantages of this change, IMHO, far outweigh any advantages. The "Copy" button on each code block is what most users will use to make use of the snippet anyway. Do we really foresee people cloning the entire doc repository just to be able to copy over a few files? I seriously doubt it. |
|
ya, i forgot that i agreed with @NotTheDr01ds. handling those extra files is a pain. here's the revert #2171 |
|
Ah sorry I tired to find some prior art around this but I should've looked harder, no worries! |
|
@orthonormalremy Not a problem at all! Again, I consider this my fault for not catching your PR earlier (as well as for not updating the Contribution Guide as I had promised). I really do appreciate your attempt at improving Nushell here! Looking forward to future suggestions! |
There are many useful recipes that exist in the cookbook and there is no way to track them directly in a script-friendly way (markdown file parsing is not ideal obviously).
This PR adds support for useful standalone code snippets (e.g. snippets that someone might want to put in their
autoload/dir) to be extracted out into their own .nu files so it can remain the source of truth for the cookbook while also being programmatically fetch-able.Note: this PR uses the lightweight @vuepress/plugin-markdown-include plugin which is an official VuePress plugin from the same @vuepress/* family already used in this repo