jordan-dalby / ByteStash

A code snippet storage solution written in React & node.js
GNU General Public License v3.0
390 stars 11 forks source link

[FEATURE] Embeddable shared snippets #69

Open jordan-dalby opened 1 week ago

jordan-dalby commented 1 week ago

Is your feature request related to a problem? Please describe. Links are currently the only way to view shared snippets

Describe the solution you'd like Embeddable shared snippets (probably require no auth to access)

Describe alternatives you've considered I guess screenshots but those are not dynamic

Additional context n/a

jordan-dalby commented 1 week ago

After some searching it looks like this would require an API endpoint that returns a page design, which can then be used in an iframe or similar. Shouldn't be too hard to implement, assuming the design process isn't too tricky.

vlavrynovych commented 5 days ago

Hi @jordan-dalby, this should be a really cool feature. Especially for a tech guys who want to host their snippets on their own service.

I have my own blog and it was the first feature I wanted to check. I wasn't dissapointed, because the project itself is super helpful. I like the control on the access like an expiration period for the public links. Waiting to see the this feature live

So, now let me share of how I expect it to work (as a user). Some minimal control of how it look should be added (maybe later as an improvements). I wish to be able to toggle on/off the title, desc, categories, line numbers. When the snippet has only one file, I would also want to be able to hide a file name. This way any blogger will have a full control of how they want to inject it to their pages.

Ability to override styles a little bit - it's more like nice to have. All above is just a feedback. I will be glad to see any version of embeddable snippets. I hope that I'm talking on behalf of many people.

jordan-dalby commented 5 days ago

@vlavrynovych Good ideas. I've been thinking about a few ways to do this. A snippet designer would be awesome, but potentially overkill, how about- as an initial implementation, could be expanded later- a curated list of designs for the user to choose from, i.e.

  1. Show title, languages, categories, code etc
  2. Show title and code
  3. Code only

Etc... And potentially a light and dark theme for each as well.

vlavrynovych commented 5 days ago

@jordan-dalby , you described all I personally need 😄

vlavrynovych commented 1 day ago

Hello @jordan-dalby,

Another thought that came to me just recently, that this embeddable content where we have a multiple files (or better to say Code Fragments) should be also available for each file. Like abilty to embedd each fragment separately

Here is the use case: I prepared an instruction lets say on how to setup a docker + ollama. I logically will group it into one snippet with a multiple fragments (docker-compose.yaml, ollama.sh, etc). When I share it as public snippet of course it all is bundled, but when I inject it to my blog, I'd rather like to inject embeddable Code Fragments than entire snippet.

The Code Fragments can be far from each other in the article. And I don't want to create a bunch of Snippets for each injection to the articles - it will be a mess in a week for me.

I hope that my example is clear. I wonder if anybody else see this useful For now it's just my thoughts

P.S. I see good potential in this project, so don't judge me too harshly for being too active 😄