The various
Processor
classes available to use
class BasicProcessor
<source>
(notebook
: AttributeDictionary
)
A basic processor that adds a comment to the top of a cell
Example usage:
#| process
def my_function():
return "Hello world!"
Example outcome:
# This code has been processed!
def my_function():
return "Hello world!"
class AutoDocProcessor
<source>
(notebook
, processor_args
: dict = {}
)
A processor which will automatically generate API documentation for a given class or method. Largely relies on the implementation in hf-doc-builder, while adding some customizations for Quarto.
This processor expects the following directives:
autodoc
, (str
): Should contain the exact import location (or relative) of an object or function to document, such asnbquarto.processors.AutoDocProcessor
.methods
, (List[str]
, optional): A list of methods to expose for the specified class. If nothing is passed, all public methods will be documented. If special methods should be documented including all special methods, such as__call__
, the keyall
can be passed along with the special methods to document.
Examples:
To expose all public methods:
#| autodoc: nbquarto.processors.AutoDocProcessor
To specify specific functions to document along with the init:
#| autodoc nbquarto.processors.AutoDocProcessor #| methods process
To expose all public methods and include special or hidden methods:
#| autodoc nbquarto.processors.AutoDocProcessor #| methods all, __call__
Example outcome:
(See the auto-generated docs that made this!)
class CodeNoteProcessor
<source>
(notebook
: AttributeDictionary
)
A processor which checks and reorganizes cells for documentation with the proper explanations
Specifically will look at source code cells that have markdown cells following them. Each markdown cell should contain #| explain
followed by a selection of the source code the markdown cell is explaining. The processor will then create a panel tabset with the original code and the new explanation.
For example:
In a code cell:
def addition(a,b):
return a+b
In a subsequent markdown cell:
`addition(a,b)`
#| explain This function adds two numbers together
Example outcome:
def addition(a,b):
return a+b
def addition(a,b):
return a+b
addition(a,b)
This function adds two numbers together