ALERT! THIS IS IN A VERY EARLY BETA STATE!
Snap!Doc is a documentation generator for Snap! blocks, designed to create structured documentation from a special set of blocks in each custom block.
Really self explantory. You should have completed this step already.
Include the DocBlocks library from here to your project. Then, you can use the doc block, at the start of your block with the other documentation blocks. I dont't rellly know how to explain this, so here's an example:
Do this will all of your blocks. If you dont do documenation for a block, the generator will do a really basic no documentation page for your block.
Open the Snap! project you want to document, and export it as a .xml
file. This is done by clicking on the Snap! menu, then "Export Project", which will save the resulting blocks named something like [project name] blocks.xml
.
If wanted, you can also generate block pictures to be displayed on their pages. This is really simple. Make sure, before you do this, JavaScript extensions are enabled in Snap!, like this:
Then, go to the Docs category and click on the generate script pics
block:
Now, a file named pictures.zip
(or something like it) should've downloaded. Note the name down, you'll need it later.
Again, you don't need this; the generator will work fine without it, but its useful.
When you open index.html
or the GitHub pages page, you should see something like this (taken from Firefox):
There are a couple of options here. Here are what they mean:
Library name
: The name of your library. Will be displayed in the index page, and the title of all of the pages.Script pictures ZIP file
: If you generate the script pictures in Step 4, you should select that downloaded zip file here. Again, not needed; but without it, readers wont be able to see your blocks!
Start by selecting the .xml
file you exported in Step 3, and then press that Generate
button! This will generate the documentation for your blocks.
Now the documentation will be generated, but you havent downloaded it yet.
After the documentation is generated, you will see that the Download
button is no longer disabled. Press that, and it will download a zip file containing the documentation, in HTML. Extract this with your favorite archive extraction tool, and the folder extracted should look like this (taken on a Linux Mint system):
Now, you can finally open the index.html
file in your browser, and see the documentation you generated!
You can now explore the documentation! Click on the links to see the documentation for each block. Heres a example page for the sum of (nums)
block in the previous screenshot:
You can host your documentation on GitHub pages, or any other static file hosting service. Just upload the contents of the extracted folder to your hosting service, and you should be able to access it via a URL. I'm going to add a section on how to do this later, but for now just search one up.
Contributions are welcome! If you find a bug or have a feature request, please open an issue. Or, if you want to contribute code, feel free to open a pull request.
Licensed under the MIT License. See the LICENSE file for details.
First of all, well... me. ilikecoding-197 on GitHub, and CodingIsFun2831t on Snap. (The T was a typo. I dont know how to change it). Special thanks to Snap! for creating such a great visual programming language, of course.