Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Martin005
Copy link
Owner

This pull request introduces a minor version bump and enhances the AST node structure by adding parent references to each node. This change allows for easier navigation from a child node to its parent in the AST, which can be useful for various tree traversal and manipulation tasks. The update touches both the Rust and Python layers to ensure the new parent field is properly exposed and initialized.

AST Node Structure Enhancements

  • Added a parent field to the PyAstNode struct in Rust, allowing each node to reference its parent node. The from_comrak_node method now takes an optional parent reference and sets it appropriately when constructing the AST. (src/astnode.rs) [1] [2]
  • Updated the Python interface (comrak.pyi) to include the new parent attribute on AstNode, ensuring Python consumers can access parent nodes. The constructor signature was also updated to accept the parent parameter.

API and Versioning

  • Bumped the version number from 0.1.2 to 0.1.3 in both Cargo.toml and pyproject.toml to reflect the new feature. [1] [2]

Internal API Changes

  • Updated the parse_markdown function to pass the new parent parameter (None for the root node) when constructing the AST. (src/lib.rs)
  • Modified the PyAstNode::new constructor to initialize the parent field to None by default. (src/astnode.rs)

@Martin005 Martin005 merged commit e1d91be into master Sep 10, 2025
17 checks passed
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.

2 participants