Skip to content

Commit b113ee3

Browse files
committed
Improve snippet documentation
1 parent f62a428 commit b113ee3

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

public/css/custom.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ section.triplesec {
253253
overflow: hidden;
254254
overflow-y: auto;
255255
border: #CECECE solid 1px;
256-
padding: 5px;
256+
padding: 10px;
257257
}
258258

259259
@media screen and (max-width: 1000px) {

views/pages/documentation.ejs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ api.ref = getVar('ref');</code></pre>
245245
<ul>
246246
<li>The generator uses internal variables that start with _API, so avoid using variables in that namespace if you can or else unexpected behavior can happen.</li>
247247
</ul>
248-
<p>If you have made an API/Snippet that requires a PRNG, you can access the generators internal PRNG with the prng function. This will return, direct from the Mersenne Twister module the generator is using, a number on [0,1) real interval.
248+
<p>If you have made an API/Snippet that requires a PRNG, you can access the generator's internal PRNG with the prng function. This will return, direct from the Mersenne Twister module the generator is using, a number on the [0,1) real interval.
249249
<div class="row">
250250
<div class="six columns">
251251
<span class='caption'>API Code</span>
@@ -371,13 +371,24 @@ api.a = randomNum();</code></pre>
371371

372372
<h5 class='subtitle'><a name="publishingSnippets">Publishing</a></h5>
373373
<p>If you've made an awesome snippet that you think would be useful for others, you can publish it!<br>
374-
Here are some basic rules and tips on publishing snippets</p>
374+
Here are some basic rules and tips on publishing snippets:</p>
375375
<ul>
376376
<li>Once published, snippets can not be removed.</li>
377377
<ol>This is to prevent other users' APIs from breaking unexpectedly. Make sure that you really want to publish a snippet before you click confim.</ol>
378378
<li>Published snippets will be given a revision number that starts at 1.</li>
379-
<ol>Once a snippet is published, you must provide a version number in the snippet signature when you use the require function.</ol>
380-
<li>Source code of revisions that are published can not be modified. You can still modify the revision's description though.</li>
379+
<ol>Once a snippet is published, you must provide a revision number in the snippet signature when you use the require function.</ol>
380+
<div class="row">
381+
<div class="eight columns">
382+
<pre><code class="javascript">const r1 = require('keith/randomNum/1').randomNum; // Revision 1
383+
const r2 = require('keith/randomNum/4').randomNum; // Revision 4
384+
const r3 = require('keith/randomNum').randomNum; // Won't work if snippet is published
385+
386+
api.a = r1();
387+
api.b = r2();</code></pre>
388+
</div>
389+
</div>
390+
391+
<li style="clear: both">Source code of revisions that are published can not be modified. You can still modify the revision's description though as well as the snippet's tags, but the snippet name cannot be modified once it is published to avoid confusion between revisions.</li>
381392
<li>If you have made a mistake or want to make an improvement to a snippet, you can create a new revision.</li>
382393
<li>Users can search for snippets by clicking the search menu item.</li>
383394
<ol>Search depends on the tags/keywords that you give a snippet. Make sure that you provide good tags that users will most likely search for in order to have the best chance of your snippet being found.</ol>

0 commit comments

Comments
 (0)