docs » hs.doc.builder
Builds documentation support files. Still experimental.
This submodule provides functions for mimicking the documentation generation processes used when generating the official Hammerspoon documentation. The long term goal is to provide a mechanism for generating complete Hammerspoon documentation in all of its formats with only the Hammerspoon application and source files without any additional software required.
This submodule can be used to generate and maintain the documentation for Spoon bundles and can also be used to generate documentation for third-party modules as well.
Documentation for modules and spoons is expected to be embedded in the source code for the relevant object in specially formatted comment strings. A very brief example of how to format documentation can be found at https://github.com/Hammerspoon/hammerspoon/blob/master/SPOONS.md#documentation, but a better treatment is planned.
Most of this submodule should be considered at the "Proof of Concept" stage and will require some additional work on your part to generate useful documentation in HTML, Markdown, or Docset formats. This is expected to change in the future.
- Functions - API calls offered directly by the extension
hs.doc.builder.genJSON(source) -> string
Generates a JSON string representation of the documentation source specified. This is the format expected by
hs.doc.hsdoc and is used to provide the built in documentation for Hammerspoon.
- source - the source to generate the JSON string for. If this is provided as a string, it is passed to hs.doc.builder.genComments and the result is used. If it is a table, then it is assumed to have already been generated by a call to hs.doc.builder.genComments.
- string - the JSON string representation of the documentation
- If you have installed the
hs command line tool (see
hs.ipc), you can use the following to generate the
docs.json file that is used to provide documentation for Hammerspoon Spoon bundles:
hs -c "hs.doc.builder.genJSON(\"$(pwd)\")" > docs.json
- You can also use this to generate documentation for any third-party-modules you build, but you will have to register the documentation with
hs.doc.registerJSONFile yourself -- it is not automatically loaded for you like it is for Spoons.
hs.doc.builder.genSQL(source) -> string
Generates the SQL commands required for creating the search index when creating a docset of the documentation.
- source - the source to generate the SQL commands for. If this is provided as a string, it is passed to hs.doc.builder.genComments and the result is used. If it is a table, then it is assumed to have already been generated by a call to hs.doc.builder.genComments.
- string - the relevant SQL commands as a string