Skip to content

Conversation

@3w36zj6
Copy link
Member

@3w36zj6 3w36zj6 commented Dec 31, 2025

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds functionality to properly handle content blocks in script mode by converting them to paragraph nodes in the textlint AST. The implementation introduces helper functions to flatten markup children and recursively convert Marked::ContentBlock nodes to Paragraph nodes.

Key changes:

  • Added flattenTypstMarkupChildren to recursively flatten markup/content block children while filtering out bracket delimiters
  • Added convertScriptContentBlocksToParagraphs to transform content blocks into paragraph nodes
  • Enhanced paragraphizeTextlintAstObject with hash statement detection logic to properly handle script-mode statements

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/typstToTextlintAst.ts Core implementation: added utility functions for flattening markup children, converting content blocks to paragraphs, and detecting hash statements for proper paragraphization
test/unit/fixtures/loops/input.typ Test fixture: Typst source with for/while loops containing content blocks
test/unit/fixtures/loops/output.json Expected AST output for loops fixture with paragraphized content
test/unit/fixtures/content-blocks/input.typ Test fixture: Typst source demonstrating script-mode content blocks with variables
test/unit/fixtures/content-blocks/output.json Expected AST output for content blocks with proper paragraph wrapping
test/unit/fixtures/conditionals/input.typ Test fixture: Typst conditional statements with content blocks
test/unit/fixtures/conditionals/output.json Expected AST output for conditionals with paragraphized content
test/unit/fixtures/bindings-and-destructuring/input.typ Test fixture: Complex destructuring patterns with content blocks
test/unit/fixtures/bindings-and-destructuring/output.json Expected AST output for bindings with properly transformed paragraphs

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@3w36zj6 3w36zj6 merged commit ca408f1 into main Dec 31, 2025
4 checks passed
@3w36zj6 3w36zj6 deleted the feature/paragraphize-content-blocks-in-script-mode branch December 31, 2025 22:37
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