Skip to content

Conversation

halso
Copy link

@halso halso commented Aug 6, 2025

Summary

Problem

The explode command was treating # symbols inside code blocks (like bash comments) as markdown headers, causing sections to be truncated prematurely.

Solution

Added code block state tracking:

  1. Detect code block boundaries (```)
  2. Skip header detection when inside code blocks
  3. Only process lines as headers when NOT in a code block

Commits in this PR

  1. chore: apply automatic formatting/linting changes and add CLAUDE.md to gitignore

    • Applied Prettier formatting to JSON and markdown files (2-space indentation)
    • Added newline at end of index.js
    • Manually added CLAUDE.md to .gitignore for AI assistant workspace analysis
  2. fix: prevent # symbols in code blocks from being treated as headers in explode command

Test plan

Closes #7

🤖 Generated with Claude Code

Steve Personal and others added 2 commits August 6, 2025 20:23
…o gitignore

- All changes except .gitignore generated by automatic formatting and linting tools
- Apply Prettier formatting to JSON and markdown files (2-space indentation)
- Add newline at end of index.js
- Manually add CLAUDE.md to .gitignore for AI assistant workspace analysis
- No functional changes, only automated formatting adjustments

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…n explode command

Fixes issue ksylvan#7 where the explode command would incorrectly truncate sections
when encountering # symbols inside code blocks. Now tracks code block boundaries
and skips header detection when inside code blocks.

Closes ksylvan#7

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Owner

@ksylvan ksylvan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of this seems like formatting changes - please reduce this diff to just the functional changes and keep my formatting choices.

Also, please squash your commits into 1.

@halso
Copy link
Author

halso commented Aug 6, 2025

@ksylvan - you're right. They shouldn't be mixed in. The formatting changes were done by the tools automatically when I ran your instructions at:

https://github.com/ksylvan/markdown-tree-parser/blob/main/CONTRIBUTING.md#before-submitting

image

so I wanted to keep them separate from the actual bug commit.

I'm guessing the correct thing to do then is:

  • You or I create an issue for the fact the auto-formatting has changed and commit the changes (let me know if you want me to do it).
  • I create an issue for the "chore" commit of adding the .gitignore for CLAUDE.md and submit a pull request.
  • I then just retract my mixed up pull request (or you reject it) and I submit a clean fix on this Issue with just the changes to test and the src code.

Sorry for the confusion. It's my first time doing a Pull Request and also wasn't sure what the best thing was to do (and didn't want to create lots of different GitHub issues).

@xymb-endcrystalme
Copy link

A lot of this seems like formatting changes - please reduce this diff to just the functional changes and keep my formatting choices.

Maybe just apply the first commit of this pull request: c32cfad
Or should I open a pull request with only the first commit?

The markdown-tree-parser is definitely buggy without this fix.

@ksylvan
Copy link
Owner

ksylvan commented Aug 22, 2025

I'll take care of this today. Thank you for finding the bug.

@ksylvan
Copy link
Owner

ksylvan commented Aug 22, 2025

Fixed in #9

@ksylvan ksylvan closed this Aug 22, 2025
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.

Markdown Tree Parser Truncates Sections At # Comments Within Embedded Bash Code Blocks
3 participants