fix: breaking behaviour with inline tags#13
Merged
cpursley merged 1 commit intoagoodway:mainfrom Sep 12, 2025
Merged
Conversation
Don't add double new line after a inline tag mixed with text.
Reviewer's GuideImplement context-sensitive element spacing to avoid unnecessary double newlines after inline tags, introduce helper to differentiate block vs inline tags, and update tests and fixtures to validate inline tag behavior. Class diagram for updated Html2Markdown.Converter spacing logicclassDiagram
class Html2Markdown.Converter {
+process_children_to_iolist(children, opts)
+process_node_to_iolist(node, opts)
+process_ordered_list_item_to_iolist(other, index, opts)
+process_children_with_context(children, opts, context)
-get_spacing_between_elements(node)
}
class ElementTypes {
+block_element?(tag)
}
Html2Markdown.Converter --> ElementTypes: uses
Html2Markdown.Converter : get_spacing_between_elements(node)
Html2Markdown.Converter : process_children_to_iolist(children, opts)
Html2Markdown.Converter : process_node_to_iolist(node, opts)
Html2Markdown.Converter : process_ordered_list_item_to_iolist(other, index, opts)
Html2Markdown.Converter : process_children_with_context(children, opts, context)
ElementTypes : block_element?(tag)
Flow diagram for spacing decision between elementsflowchart TD
A["process_children_to_iolist"] --> B["get_spacing_between_elements(node)"]
B --> C{Is tag a block element?}
C -- Yes --> D["Spacing: '\n\n'"]
C -- No --> E["Spacing: ' '"]
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Closed
Collaborator
|
Thank you @ejscunha !!! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Don't add double new line after a inline tag mixed with text.
Summary by Sourcery
Fix spacing logic between HTML elements by replacing hard-coded newlines with context-aware spacing, add supporting tests, and update fixtures
Bug Fixes:
Enhancements:
Tests:
Chores: