dotnet / try

Try .NET provides developers and content authors with tools to create interactive experiences.
MIT License
2.9k stars 526 forks source link

Support Bloggers and Code Samples #561

Open khalidabuhakmeh opened 5 years ago

khalidabuhakmeh commented 5 years ago

Is your feature request related to a problem? Please describe.

I like to blog about .NET and normally leave samples scattered throughout the post to illustrate some ideas. It would be great to allow folks to interactively play with the samples that are part of the post.

Describe the solution you'd like

A way to write blog posts (using markdown) that can inject parts of Try.NET into the current site/post. Either by allowing bloggers to host the service or by paying a small service fee to allow Try.NET to manage the security and headaches of hosting.

I could see a couple of ways to accomplish this:

Describe alternatives you've considered

Flat samples or .NET Fiddle links.

Read More https://github.com/dotnet/try/wiki/Product-Roadmap

thijstijsma commented 5 years ago

There already seems to be a feature in private preview that seems to allow you to do just that. Heading "Simple to embed" on https://dotnet.microsoft.com/platform/try-dotnet

Simple to embed

Go beyond copy and paste samples to live snippets. Our private preview customers can embed live .NET code into blogs and documentation.

Is there anything else you would require?

jonsequitur commented 5 years ago

I wrote up a quick outline of what needs to be done here: https://github.com/dotnet/try/issues/298#issuecomment-546147042

khalidabuhakmeh commented 5 years ago

Silly question, but how would you determine if someone is using a Try.NET instance maliciously. They are essentially executing code remotely.

In theory, someone could come to my site, change the code sample, then start mining bitcoin.

jonsequitur commented 5 years ago

The code is executed with Blazor in the browser of the person who clicks the run button, so they'd be mining in (or otherwise maliciously using) their own browser.

khalidabuhakmeh commented 5 years ago

@jonsequitur ah ok, so we are going down the route of a hosted WASM solution. I must have misread the other issue, where assets would be uploaded to the try.net servers (unless that is directly the compiled wasm of the sample).

jonsequitur commented 5 years ago

Assets have to be uploaded to Try .NET for compilation of the final assembly (which includes user-modified code) and language services.