discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: Announcement: OrthoDocs v1.0.0 released

GG
Giampiero Gabbiani
Sun, Feb 26, 2023 10:45 PM

Hi Jeremy,

thank you very much for your feedback!

As for the examples you can give a look to the project paragraph on GitHub How to document.

As for the markup, OrthoDocs has built in a full OpenSCAD parser, so there is no need of @params for documenting parameters, just place an annotation before the parameter and this will be interpreted as documentation for the formal parameter immediateley following. The same for functions, modules and variables: just annotate them!

An annotation here is simply a comment start followed immediately by the '!' character like in the following examples:

//! this is a single line annotation that will be used for describing 'variable'
variable=123;

/*!
This is simple block used for the module test

Every line is used for documenting. No format ... 
*/
module test() {
  ...
}

/*!
 * this is another 'style' recognized:
 * multi-line comment aligned with a column star (*)
 * this is the description for the function test()
 */
function test(
  //! this parameter must be a string
  p1="a string",
  //! this parameter must be ... blah blah blah
  p2,
  p3
) = ...;

The three SCAD elements (variable, test module and test function) will use the immediately preceding annotation as description. The function test() will be also documented in its parameters, i.e. there will be a description for each annotated parameter (p1 and p2). Since p3 doesn't have any annotation it will be reported in the function signature but will have no description.

There is only one thing that has to be 'coded', the referral to other function/modules/variables from inside an annotation. For them I had to establish a format that is (at present time) the following:

variable variable_name
module_name{}
function_name()

In the first case the text will be linked to the documentation of the variable 'variable_name'
In the second to the documentation of the module 'module_name'
In the last to the documentation of the function 'function_name'

This is the only 'rule' to follow if you want to cross-reference documented items (it is very 'basic' ... likely to change in the future..).

Since for now the only supported output format is Markdown, if you need any formatting inside your comments (lists, tables emphasis and so on) you can use just the Markdown syntax.

I'm using OrthoDOcs for documenting another OpenSCAD project OFL, if you want you can give a look to its sources and see the corresponding generated documents (they are in the 'orthodocs' directory).

Let me know if I answered your question!

Kind Regards
Giampiero

Hi Jeremy, thank you very much for your feedback! As for the examples you can give a look to the project paragraph on GitHub [How to document](https://github.com/ggabbiani/orthodocs#How-to-document). As for the markup, OrthoDocs has built in a full OpenSCAD parser, so there is no need of @params for documenting parameters, just place an annotation before the parameter and this will be interpreted as documentation for the formal parameter immediateley following. The same for functions, modules and variables: just annotate them! An annotation here is simply a comment start followed immediately by the '!' character like in the following examples: ``` //! this is a single line annotation that will be used for describing 'variable' variable=123; /*! This is simple block used for the module test Every line is used for documenting. No format ... */ module test() { ... } /*! * this is another 'style' recognized: * multi-line comment aligned with a column star (*) * this is the description for the function test() */ function test( //! this parameter must be a string p1="a string", //! this parameter must be ... blah blah blah p2, p3 ) = ...; ``` The three SCAD elements (variable, test module and test function) will use the immediately preceding annotation as description. The function test() will be also documented in its parameters, i.e. there will be a description for each annotated parameter (p1 and p2). Since p3 doesn't have any annotation it will be reported in the function signature but will have no description. There is only one thing that has to be 'coded', the referral to other function/modules/variables from inside an annotation. For them I had to establish a format that is (at present time) the following: variable variable_name module_name{} function_name() In the first case the text will be linked to the documentation of the variable 'variable_name' In the second to the documentation of the module 'module_name' In the last to the documentation of the function 'function_name' This is the only 'rule' to follow if you want to cross-reference documented items (it is very 'basic' ... likely to change in the future..). Since for now the only supported output format is Markdown, if you need any formatting inside your comments (lists, tables emphasis and so on) you can use just the Markdown syntax. I'm using OrthoDOcs for documenting another OpenSCAD project [OFL](https://github.com/ggabbiani/OFL), if you want you can give a look to its sources and see the corresponding generated documents (they are in the 'orthodocs' directory). Let me know if I answered your question! Kind Regards Giampiero