Skip to content

Conversation

jackhogan
Copy link

When rm_fenced=True, line indices from text_for_headings.splitlines() (after fenced block removal) were being used to slice original_lines (before removal), causing misalignment.

For example:

md_content = """# First Header
Content here.

```python
# A comment that should be ignored for structure
def example():
    pass
```

# Second Header
This content belongs to Second Header."""

create_heading_dict(md_content)['Second Header'].text

results in

'def example():\n    pass\n```\n\n# Second Header\nThis content belongs to Second Header.'

This wasn't being caught in the tests because there was no example of a fenced code block between two headings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant