In the works: run snippets of code in the Programming Reference

Started by CharlieJV, Feb 11, 2023, 03:20 AM

Previous topic - Next topic

CharlieJV

I had already setup: while looking up a keyword, show in an iframe the BASIC Anywhere Machine such that it lists all programs tagged with the keyword, and give each a "RUN" button so that each program can be run, right there while looking at the documentation.

Now, focusing on documentation about programming, I wanted to do the same kind of thing for small snippets of code, but do so in a way that we're not loading up BASIC Anywhere Machine.

What I've done: embed the interpreter in the Programming Reference, just enough of the stuff for running a program.

Not ready to roll out yet, but here's how it looks:

You cannot view this attachment.

ed davis

This - the interpreter embedded in the help/docs - is really, really cool!

I can't wait to give it a try!

Thanks for continuing to work on this!

CharlieJV

G'day Ed,

Ridiculously easy, all of 166KB of overhead to the TiddlyWiki instance that is the BAM Programming Reference.

That's kind of the beauty of all this stuff living in a single HTML file, and easily transferred from one TiddlyWiki instance to another.

But technical TiddlyWiki gobbledegook aside, I am setting up the TiddlyWiki documentation to eventually be just like this sample documentation page from MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toString

So have some example snippet of code in the documentation, run it, edit it, run it.

That's my kind of documentation !

CharlieJV

Oops, forgot to add:

https://basicanywheremachine.neocities.org/BAM_ProgReference?target=Operators%20and%20Expressions%3A%20Part%201#Home

Scroll down and expand the "String Operators" section, and there's the snippet of code and the run button.

Now I just need to make that editable, and also have a "Reset" button.


CharlieJV

Quote from: ed davis on Feb 11, 2023, 11:54 AMThis - the interpreter embedded in the help/docs - is really, really cool!

I can't wait to give it a try!

Thanks for continuing to work on this!

I'm in the process of rejigging the navigation for the documentation.

Here's a rough first draft of notes describing this feature (run sample code and try your own code):

Demonstration Programs and Runs

johnno56

May your journey be free of incident.  Live long and prosper.