#2770·DocsGPT

Bug Report: RstParser does not remove standard reStructuredText directives

Author: aleenabenny0Created Sep 14, 2026Updated Sep 14, 2026

Description

RstParser.remove_directives() does not recognize standard reStructuredText directive syntax. The current regex expects a backtick before the directive and does not handle the required space between .. and the directive name:

python
pattern = r"`\.\.([^:]+)::"

Therefore, valid directives such as .. note:: remain in the parsed content.

Reproduction steps

  1. Create an instance of RstParser.
  2. Pass the following content to remove_directives(): Text before\n.. note:: Important information\nText after
  3. Examine the returned string.
  4. Observe that the valid .. note:: directive marker remains unchanged.

Expected behavior

The parser should remove the standard reStructuredText directive marker while preserving useful inline content. Expected result: Text before\nImportant information\nText after

Actual Behavior with Screenshots

The method returns the directive unchanged: Text before\n.. note:: Important information\nText after This is a parser-level bug, so a UI screenshot is not available. A regression test can demonstrate the failure.

Operating system

Windows

What browsers are you seeing the problem on?

No response

What development environment are you experiencing this bug on?

Local dev server

Did you set the correct environment variables in the right path? List the environment variable names (not values please!)

No response

Provide any additional context for the Bug.

The existing test_remove_directives test uses the nonstandard form `..note::`. It therefore does not verify valid reStructuredText syntax such as .. note::. Relevant files:

  • docsgpt/parser/file/rst_parser.py
  • tests/parser/file/test_rst_parser.py

I am willing to add regression coverage and submit a focused PR.

Relevant log output

bash

Have you spent some time to check if this bug has been raised before?

  • I checked and didn't find similar issue

Are you willing to submit PR?

Yes, I am willing to submit a PR!

‍⚖️ Code of Conduct

  • I agree to follow this project's Code of Conduct