Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix skipping of text nodes in markdown parser #1

Merged
merged 3 commits into from
Feb 27, 2025

Conversation

erikjuhani
Copy link
Owner

Add blank implementations for TextNode and Text

Add more blanket implementations to cover &str, String conversions
into TextNode and String TextNode, Vec<TextNode> and
&[TextNode] for Text.

This simplifies the conversions between types. For instance one helper
function text from the markdown test module was removed and replaced
with .into() calls.

Module: basalt-core
Scope: markdown

Fix skipping text nodes in markdown parser

Previously, quite naively every 'unhandled' tag was pushed as a new
paragraph node, however, this did not work as expected and actually
might replace the current node, even, if that wasn't the intention.

This happened for example with styled text using emphasis or bold
markers.

This is now fixed and the tags that do not have implementation are not
handled at all as separate nodes, but instead if they contain text. This
text will be pushed to the current node block instead.

New more comprehensive test was also added and replaces the simple block
quote test.

Module: basalt-core
Scope: markdown

Bump basalt-core to version 0.2.2

Update CHANGELOG.

Module: basalt-core

Add more blanket implementations to cover `&str`, `String` conversions
into `TextNode` and `String` `TextNode`, `Vec<TextNode>` and
`&[TextNode]` for `Text`.

This simplifies the conversions between types. For instance one helper
function `text` from the markdown test module was removed and replaced
with `.into()` calls.

Module: basalt-core
Scope: markdown
Previously, quite naively every 'unhandled' tag was pushed as a new
paragraph node, however, this did not work as expected and actually
might replace the current node, even, if that wasn't the intention.

This happened for example with styled text using emphasis or bold
markers.

This is now fixed and the tags that do not have implementation are not
handled at all as separate nodes, but instead if they contain text. This
text will be pushed to the current node block instead.

New more comprehensive test was also added and replaces the simple block
quote test.

Module: basalt-core
Scope: markdown
Update CHANGELOG.

Module: basalt-core
@erikjuhani erikjuhani changed the title Fix markdown parser Fix skipping of text nodes in markdown parser Feb 27, 2025
@erikjuhani erikjuhani merged commit e4be85c into main Feb 27, 2025
@erikjuhani erikjuhani deleted the fix-markdown-parser branch February 27, 2025 19:50
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