🐛 Bug Report: Markdown parser treats "#" lines inside fenced code blocks as headings
📜 Description
MarkdownParser.markdown_to_tups (application/parser/file/markdown_parser.py, or wherever markdown_parser.py lives) matches ^#+\s on every line, including lines inside ``` fences, so a shell comment in a code block starts a new section and the code block is split across two chunks.
I'd like to work on this. Plan: skip heading detection while inside a ``` or ~~~ fence, and add a regression test.
👟 Reproduction steps
MarkdownParser().markdown_to_tups("# Install\nbash\n# install dependencies\npip install -r requirements.txt\n\nDone.\n")
👍 Expected behavior
A single Install section containing the whole code block.
👎 Actual Behavior with Screenshots
It returns [('Install', 'bash\n'), ('install dependencies', 'pip install -r requirements.txt\n\nDone.\n\n')]
💻 Operating system
Linux
What browsers are you seeing the problem on?
No response
🤖 What development environment are you experiencing this bug on?
Docker
🔒 Did you set the correct environment variables in the right path? List the environment variable names (not values please!)
N/A
📃 Provide any additional context for the Bug.
No response
📖 Relevant log output
👀 Have you spent some time to check if this bug has been raised before?
- [x] 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
- [x] I agree to follow this project's Code of Conduct
@Anandb71, you're assigned. The current file is docsgpt/parser/file/markdown_parser.py; it checks headings without tracking code fences.
- Read
CONTRIBUTING.mdand add regression tests for backtick and tilde fences intests/parser/file/test_markdown_parser.py. - Open a PR or post progress here within 14 days, or the issue will be available to others again.
- Include a screenshot or short recording demonstrating the parser output in your PR.
Automated triage. A maintainer will follow up.