Skip to main content
`Ctrl`+`K`

# doxysphinx.writer

The writer module contains classes that write the docs-as-code output files.

## Classes

`Writer` | Protocol representing a Writer that write docs-as-code files.
`RstWriter` | Writes sphinx-rst files to disk.

## Module Contents

class doxysphinx.writer.Writer(source_directory: pathlib.Path, toc_generator_type: Type[doxysphinx.toc.TocGenerator] = DoxygenTocGenerator)

  Bases: `Protocol`

  Protocol representing a Writer that write docs-as-code files.

  write(parse_result: doxysphinx.html_parser.HtmlParseResult, target_file: pathlib.Path, html_hash: str) → pathlib.Path

    Write a parsed html result to a target file.

    The format of that file is controlled by the concreate Writer implementation.

    Parameters:

      - parse_result – The result of a previous html parser run

      - target_file – The target file to write

    Returns:

      The written file (should be always identical to target_file input, but allows chaining…)

class doxysphinx.writer.RstWriter(source_directory: pathlib.Path, toc_generator_type: Type[doxysphinx.toc.TocGenerator] = DoxygenTocGenerator)

  Writes sphinx-rst files to disk.

  write(parse_result: doxysphinx.html_parser.HtmlParseResult, target_file: pathlib.Path, html_hash: str) → pathlib.Path

    Write html content to the target_file.

    Parameters:

      - parse_result – The result of the html parsing (=content + metadata)

      - target_file – The target docs-as-code (e.g. rst) file

    Returns:

      The path the file was written to.