Skip to content

Conversation

@roxspring
Copy link
Contributor

Changes, with unit tests where appropriate:

  1. Refactored TextCollectingVisitor to avoid duplicate code
  2. TextContainer has a new collectEndText(..) method allowing Paragraph to append it's optional trailing line break
  3. Consistently add a blank line before all (non-first) Block text (implicitly including FencedCodeBlock, no longer relying on Paragraph special case)
  4. IndentedCodeBlock implements TextContainer and collects content chars.

Closes #574

roxspring added 5 commits May 17, 2023 10:52
The call was happening first irrespective of whether the node was a TextContainer so lifted this logic out of the `if` block.
It seems that currently LineBreakNode is independant of TextContainer so it seems safe to pull that out of the `if` block.
Consequently only a single new line is needed to add paragraph breaks
- Removed special case logic for Paragraph blocks
- Generalised from BlankLineBreakNode case
Implementation based on Text collectText(..) but using getContentChars()
@roxspring roxspring marked this pull request as ready for review May 17, 2023 11:12
@vsch
Copy link
Owner

vsch commented May 17, 2023

@roxspring, thank you for the PR. I reviewed the changes and will merge it and make a new release.

@vsch vsch merged commit b9bfe63 into vsch:master May 17, 2023
@roxspring roxspring deleted the issue-574-better-block-text-collecting branch May 18, 2023 19:59
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.

Inconsistent TextCollectingVisitor behaviour with code blocks

2 participants