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

Makes parser correctly identify unmatched opening tags #376

Merged
merged 1 commit into from May 11, 2023

Conversation

rpaul-stripe
Copy link
Contributor

When the parser attempts to determine if a closing token matches the latest parent on the stack, it only checks the node type and does not check the tag name. Early versions of markdoc used to include the tag name in the type attribute, but this condition wasn't updated when the tag became its own property.

This PR addresses issue #375 by updating the condition so that it checks to make sure that the tag name matches the value of parent.tag. This will make the check work as expected for opening and closing tags. For non-tag nodes, the value of tag and parent.tag should both be undefined, so this approach should work as expected for all node types.

In addition to fixing the issue, this PR also adds test cases to ensure that the structural errors are added to the AST for mismatched opening and closing tags, missing closing tags, and missing opening tags.

@rpaul-stripe rpaul-stripe merged commit 15becda into main May 11, 2023
2 checks passed
@rpaul-stripe rpaul-stripe deleted the structural-error-fix branch May 11, 2023 13:13
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.

None yet

2 participants