@@ -42,15 +42,34 @@ documentation tool, but of course is written in and is a dialect of Janet. See
4242
4343## Adding Examples
4444
45- Simply add a file with the name of the binding you are giving examples for to the examples
46- directory, with the ` .janet ` suffix. If the binding includes the ` / ` character, replace it with
47- an underscore - this works because no bindings in the core use an underscore. For example, the
48- binding ` array/new ` has examples in the ` examples/array_new.janet ` file.
49-
50- If such a file already exists, you can simply append your example code the existing file.
51-
52- When building the site, the new examples will be included in the generated documentation. Make
53- sure that your example has correct janet syntax, as syntax errors will cause the entire site
54- to not build. If the example has valid syntax (has a 0 exit code when loaded with
55- ` janet -k example/my-fn.janet ` ), there may be a bug in the mendoza janet syntax
56- highlighter and you open a bug in mendoza.
45+ Simply add a file with the name of the binding you are giving examples
46+ for to the ` examples ` directory, with the ` .janet ` suffix.
47+
48+ To cope with some of Janet's symbols having names with characters that
49+ are not-so-friendly to certain filesystem and/or operating system
50+ combinations, an escaping scheme is used.
51+
52+ For a given symbol, use the ` content/api/examples.janet ` script to
53+ generate an appropriate filename. For example, for ` array/new ` ,
54+ invoking:
55+
56+ ```
57+ $ janet content/api/examples.janet array/new
58+ ```
59+
60+ should give the output:
61+
62+ ```
63+ array_47new.janet
64+ ```
65+
66+ If such a file already exists, you can simply append your example code
67+ to the existing file.
68+
69+ When building the site, the new examples will be included in the
70+ generated documentation. Make sure that your example has correct janet
71+ syntax, as syntax errors will cause the entire site to not build. If
72+ the example has valid syntax (has a 0 exit code when loaded with
73+ ` janet -k example/my-fn.janet ` ), there may be a bug in the mendoza
74+ janet syntax highlighter in which case please open a bug in mendoza.
75+
0 commit comments