Initialize the Reader instance
Sets up the reader with application context including logger and options. The reader will use the provided configuration for file paths and processing options.
Application context containing logger, options, and other shared state
Reads and merges configuration from multiple sources
This method searches for configuration files in the following order of precedence:
apidoc.json
- Dedicated APIDoc configuration file (highest priority)apidoc.config.js
- JavaScript configuration filepackage.json
- NPM package file with 'apidoc' fieldThe method also reads header and footer content files if specified in the configuration.
Merged configuration object containing:
// 1. apidoc.json (if exists)
{
"name": "My API",
"version": "1.0.0",
"header": { "filename": "header.md" }
}
// 2. package.json (if apidoc.json doesn't exist)
{
"name": "my-package",
"version": "1.0.0",
"apidoc": {
"name": "My API Documentation"
}
}
Search for API documentation configuration files in specified directories.
Merged configuration object
Get json.header / json.footer title and markdown content
Retrieves and processes header and footer configurations by reading content from the specified files and rendering it with a Markdown parser if available.
Configuration object containing details about header and footer settings.
Object containing processed header and footer content, including their titles.
Search for a configuration file in a specified directory.
Name of the configuration file to locate.
Directory to scan
Configuration data if the file is found, or an empty object if not found.
Look for a file in each of the input folders.
If multiple files with the same name exist in different directories, the method returns the first valid file it finds.
Name of the file to search for
Resolved path of the found file, or an empty string if not.
Configuration and content reader for APIDoc projects
The Reader class is responsible for:
Example: Basic usage
Example: Configuration precedence
Since
4.0.0
Public