Skip to content

Tutorial links in API Documentation pages using JSON Files

For the splashkit.io website, JSON files are now used to list all the functions used in the guides pages, to link them in to the API documentation pages for SplashKit users to see if a function has been demonstrated in any of the guides.

Here is information about how this is set up:

Directory

  • Directoryscripts/
    • Directoryjson-files/
      • Directoryguides/
        • DirectoryAnimations/
          • animations.json
        • DirectoryAudio/
          • audio.json
        • DirectoryCamera/
          • camera.json
        • DirectoryGraphics/
          • graphics.json
        • DirectoryInput/
          • input.json
        • DirectoryInterface/
          • interface.json
        • DirectoryJSON/
          • json.json
        • DirectoryNetworking/
          • networking.json
        • DirectoryRaspberry-GPIO/
          • raspberry-gpio.json
        • DirectoryResource-Bundles/
          • resource-bundles.json
        • DirectoryUtilities/
          • ultilies.json

When creating a folder for a new category, it can be placed within the guides folder. The JSON file for a certain category should be the folder’s name in lowercase.

Content

Each guides’ entry need to contain a name, an array of the functions used, and the url to the guide page. It is important to use the function’s unique_global_name to ensure the correct function is linked on the documentation site. Each new addition can be added consecutively using the curly brackets.

{
"guides": [
{
"name": "Introduction to JSON in SplashKit",
"functions": [
"json_from_file",
"json_read_string",
"write_line",
"free_json",
"json_has_key"
],
"url": "/guides/json/0-json_intro/"
},
{
"name": "Reading JSON Data in SplashKit",
"functions": [
"json_read_array_of_string",
"write_line",
"write",
"json_read_object",
"json_read_number_as_int"
],
"url": "/guides/json/1-json_reading/"
}
]
}