outline-minor-mode folds # comments inside fenced code blocks ```.
Expected Behavior
When outline-minor-mode is enabled in markdown-mode, only actual Markdown headings (lines starting with # outside of fenced code blocks) should be folded or treated as outline entries. Lines inside code blocks, even if they start with #, should be ignored by the outline engine.
Actual Behavior
Lines starting with # inside fenced code blocks are incorrectly recognized as headings by outline-minor-mode. As a result, such lines are included in outline folding and navigation, even though they are part of literal code content.
This leads to incorrect and confusing folding behavior when editing Markdown files with embedded code snippets.
Steps to Reproduce
- Open a Markdown buffer in Emacs.
- Enable
outline-minor-mode.
- Insert the following content:
# Top-level Heading
```python
# This should not be folded
def foo():
pass
```
## Subheading
- Move the cursor to
# This should not be folded and run M-x outline-hide-sublevels.
Observed: The line # This should not be folded inside the Python code block is treated as an outline heading and is foldable.
Expected: The content inside the code block should be ignored by the outline engine. Only real Markdown headings outside of code blocks should be recognized.
This behavior makes outline-minor-mode unusable in practical Markdown editing workflows where fenced code blocks are common.
Software Versions
- Markdown 7eb8305
- Emacs: 30.1
- OS: Arch Linux
outline-minor-modefolds#comments inside fenced code blocks ```.Expected Behavior
When
outline-minor-modeis enabled inmarkdown-mode, only actual Markdown headings (lines starting with#outside of fenced code blocks) should be folded or treated as outline entries. Lines inside code blocks, even if they start with#, should be ignored by the outline engine.Actual Behavior
Lines starting with
#inside fenced code blocks are incorrectly recognized as headings byoutline-minor-mode. As a result, such lines are included in outline folding and navigation, even though they are part of literal code content.This leads to incorrect and confusing folding behavior when editing Markdown files with embedded code snippets.
Steps to Reproduce
outline-minor-mode.# This should not be foldedand runM-x outline-hide-sublevels.Observed: The line
# This should not be foldedinside the Python code block is treated as an outline heading and is foldable.Expected: The content inside the code block should be ignored by the outline engine. Only real Markdown headings outside of code blocks should be recognized.
This behavior makes
outline-minor-modeunusable in practical Markdown editing workflows where fenced code blocks are common.Software Versions