josdejong / mathjs

An extensive math library for JavaScript and Node.js
https://mathjs.org
Apache License 2.0
14.35k stars 1.24k forks source link

Make live demos on the website working for node.js examples #1343

Open neokito opened 5 years ago

neokito commented 5 years ago

Where http://mathjs.org/examples/advanced/custom_argument_parsing.js.html Custom argument parsing File: custom_argument_parsing.js (click for a live demo)

josdejong commented 5 years ago

Thanks for bringing this up.

The "live demo" link currently only works for the browser examples. We should either turn this link off for the node.js examples like custom_argument_parsing.js, or link it to a real live demo on RunKit or CodeSandbox or something like that.

josdejong commented 5 years ago

Anyone interested in picking this up?

ericman314 commented 5 years ago

Sounds fun. What would you think about adding the interactive code demos to the examples page itself (the table of contents at the top of the page links to individual sections below), so visitors could play with all the demos right there? We could even include the relevant portions of the JS which visitors can edit in a small window, and see the results immediately. Then next to that is a link to the full JS/HTML like there is now.

josdejong commented 5 years ago

ah, of course!! Embedded node.js example would be even better

ericman314 commented 5 years ago

I've looked at a few code snippet hosting providers. JSFiddle has a nice, clean interface for embedded fiddles (https://docs.jsfiddle.net/embedding-fiddles) but they are not editable. Codepen can do editable embedded pens but it requires a pro account. Codesandbox can supposedly do it but I couldn't figure out how to make it work. Have any of you had any luck with anything else? We could do our own but it seems like it might take a lot of work.

harrysarson commented 5 years ago

I think it is okay do not allow support editing embedded snippets. As long is folk can click a link to get to an editable one.

Alternatively, I think runkit allows editable embedded snippets: https://runkit.com/docs/embed

josdejong commented 5 years ago

Some more options (I don't know if / how well they support embedding):

rnd-debug commented 3 years ago

Another suggestion:

josdejong commented 3 years ago

👍 I guess we should summarize pros/cons of the alternatives and pick a suitable one.

tmello01 commented 1 year ago

A very small team and I are looking into this now! Was there ever internal discussion on which embedded node platform sounds best? One that I found while investigating was https://glitch.com, which seems to have a free tier that supports our needs and allows embedding.

Also, it looks like just the files in /examples and /examples/advanced need updating, does that sound right? I want to make sure there's no actual website code that needs updating in addition to these examples.

josdejong commented 1 year ago

o nice, thanks👌

Yes, we'll have to see what a suitable solution is for embedded node.js examples. https://runkit.com can be interesting too, that's used by npm.

Also, it looks like just the files in /examples and /examples/advanced need updating, does that sound right?

That is correct