Skip to content

Hook to replace rst parsing in autodoc #8018

@sbliven

Description

@sbliven

Is your feature request related to a problem? Please describe.

I would like to use an alternate markup syntax for my docstrings (specifically MyST). Sphinx plugins that provide alternate syntaxes for documentation files (e.g recommonmark, MyST-parser, etc) seem to produce docutil AST objects, but the autodoc modules store and manipulate rST strings instead.

Describe the solution you'd like

It would be great if there was an interface for replacing rST parsing in autodoc via plugins, analogous to how plugins can provide parsers for specific file extensions.

Describe alternatives you've considered

The closest I could find was the autodoc-process-docstring hook, which does allow rewriting the docstrings prior to parsing. However, it expects rST output and most parsers output AST. I suppose it would be possible to create a AST to rST writer, but this seems backwards since the rST will eventually have to be parsed back to AST.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions