Skip to content

Conversation

@rockaxorb13
Copy link

@rockaxorb13 rockaxorb13 commented Dec 22, 2025

Fixes #49

Description

This PR adds a regression test case using & improving the reproduction files provided in Issue #49.

Changes

  • Added test/templates/good/optional-nested containing the reproduction model, data, and template.
  • Added a custom "Negative Test" case to template.md to verify top-level optionals alongside nested ones.
  • Updated snapshots to reflect the correct resolution of nested optional variables (e.g., {{uri}} resolving to the URL instead of being empty).

Verification

The test already passes on the current main branch, confirming that the logic for switching scope in OptionalBlock is working correctly.

Signed-off-by: Aadityavardhan Singh <singhrashmi018@gmail.com>
Copy link
Member

@mttrbrts mttrbrts left a comment

Choose a reason for hiding this comment

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

@niallroche, does this match your expectations too?

@niallroche
Copy link

thanks @rockaxorb13 I can see it is resolving now, I do notice that there are newlines placed between the variables that does create layout issues, I am not sure if this is a separate issue or a side effect of any related work?

@rockaxorb13
Copy link
Author

rockaxorb13 commented Jan 9, 2026

Thanks, @niallroche!

I reviewed the snapshot output (optional-nested), and you are right—there are Softbreak nodes and nested Paragraph structures creating vertical whitespace between the variables.

However, I believe this is pre-existing behavior in how the engine generates CommonMark for nested blocks. My PR didn't modify the AST generation logic; I just added the test case to check and ensure that the nesting logic resolves correctly (which it now does).

The test captures the current reality of the engine. I'm happy to open a separate issue to track 'whitespace/layout cleanup' for the engine so we can merge this regression test first.

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.

nested optional resolving issues

3 participants