Skip to content

Base

Handsdown API Index / Handsdown / Generators / Base

Auto-generated documentation for handsdown.generators.base module.

BaseGenerator

Show source in base.py:27

Attributes

  • INDEX_NAME - Index filename: 'README.md'

  • INDEX_TITLE - Index title: 'Index'

  • insert_toc - Whether to add ToC to generated module docs: False

Base documentation generator.

Arguments

  • project_name - Name of the project.
  • input_path - Path to repo to generate docs.
  • output_path - Path to folder with auto-generated docs to output.
  • source_paths - List of paths to source files for generation.
  • docstring_processor - Docstring converter to Markdown.
  • loader - Loader for python modules.
  • raise_errors - Raise LoaderError instead of silencing in.
  • source_code_url - URL to source files to use instead of relative paths, useful for GitHub Pages.
  • source_code_path - Path to local source code
  • toc_depth - Maximum depth of child modules ToC
  • encoding - File encoding

Signature

class BaseGenerator:
    def __init__(
        self,
        input_path: Path,
        output_path: Path,
        source_paths: Iterable[Path],
        project_name: Optional[str] = None,
        docstring_processor: Optional[BaseDocstringProcessor] = None,
        loader: Optional[Loader] = None,
        raise_errors: bool = False,
        source_code_url: Optional[str] = None,
        source_code_path: Optional[Path] = None,
        toc_depth: int = 1,
        encoding: str = ENCODING,
    ) -> None:
        ...

See also

BaseGenerator()._write_changed

Show source in base.py:392

Write content to file if it's changed.

Signature

def _write_changed(self, path: Path, content: str) -> bool:
    ...

BaseGenerator().cleanup_old_docs

Show source in base.py:141

Remove old docs generated for this module.

Signature

def cleanup_old_docs(self) -> None:
    ...

BaseGenerator().generate_doc

Show source in base.py:171

Generate one module doc at once.

Arguments

  • source_path - Path to source file.

Raises

  • GeneratorError - If source_path not found in current repo.

Signature

def generate_doc(self, source_path: Path) -> None:
    ...

BaseGenerator().generate_docs

Show source in base.py:241

Generate all doc files at once.

Signature

def generate_docs(self) -> None:
    ...

BaseGenerator().generate_external_configs

Show source in base.py:403

Signature

def generate_external_configs(self) -> None:
    ...

BaseGenerator().generate_index

Show source in base.py:252

Generate <output>/README.md file.

Contains a Tree of all modules in the project.

Signature

def generate_index(self) -> None:
    ...

BaseGenerator().get_children_module_records

Show source in base.py:415

Get all module records that are children of this module.

Signature

def get_children_module_records(self, parent: ModuleRecord) -> List[ModuleRecord]:
    ...

See also

BaseGenerator().get_external_configs_templates

Show source in base.py:364

Get a tuple with pairs of template path to project path

Signature

def get_external_configs_templates(self) -> Tuple[Tuple[Path, Path], ...]:
    ...

BaseGenerator().get_md_document

Show source in base.py:199

Get or create MDDocument for module record.

Signature

def get_md_document(self, module_record: ModuleRecord) -> MDDocument:
    ...

See also

Show source in base.py:329

Get links to other modules that are referenced in the docstring.

Signature

def get_see_also_links(
    self, record: NodeRecord, module_record: ModuleRecord, md_document: MDDocument
) -> List[str]:
    ...

See also

Show source in base.py:270

Signature

def replace_links(
    self,
    module_record: ModuleRecord,
    record: NodeRecord,
    md_document: MDDocument,
    docstring: str,
) -> str:
    ...

See also