TiddlyWiki5
TiddlyWiki5 copied to clipboard
Add start and end properties to WikiText AST nodes for all elements.
Enhancements to WikiText Parser AST
Summary
This pull request introduces a significant enhancement to the WikiText parser by adding start
and end
properties to the AST nodes that did not previously have them. This update includes nodes such as lists, codeblocks, and various other elements that were lacking these properties.
Background
The ability to identify the exact substring range of a syntax subtree within the source file is crucial for advanced functionalities like section editing. While some progress had been made in the past by adding start
and end
properties to paragraph elements, other nodes were still missing this information.
Changes
With this PR, I've implemented a uniform check across all syntax rules during the AST generation process. Now, every node produced by the parser will have its corresponding start
and end
properties, marking the range of the substring it represents in the source text.
Benefits
- Enables the implementation of more complex features such as segment editing.
- Improves the accuracy and usefulness of the AST for further processing and manipulation.
- Provides consistency across different types of nodes in the AST.
Testing
Before:
After:
I look forward to your feedback on these enhancements!