Skip to content

Implement first nested marks support#100

Merged
Nowely merged 31 commits intonextfrom
nestes
Nov 15, 2025
Merged

Implement first nested marks support#100
Nowely merged 31 commits intonextfrom
nestes

Conversation

@Nowely
Copy link
Owner

@Nowely Nowely commented Nov 15, 2025

Summary

This PR introduces first version of support for nested marks. The implementation includes:

  • Tree-based token structure supporting arbitrary nesting depth
  • Two-value patterns for HTML-like tag matching (e.g., <value>...</value>)
  • Enhanced useMark hook with nesting metadata (depth, parent, children)
  • __nested__ placeholder enables child mark parsing
  • New stories

…arify ParserV2 readiness. Add important notice regarding pending React API components and hooks. Revise implementation phases and current priorities, highlighting ongoing work on React integration and documentation updates.
…d performance

- Added new ESLint plugins and rules to enhance code quality.
- Refactored various components to remove unused variables and improve readability.
- Updated type definitions and interfaces for better type safety.
- Simplified event listener implementations in multiple components.
- Removed deprecated code and comments to streamline the codebase.
- Changed ESLint rules for import-related checks from "warn" to "error" to enforce stricter code quality.
- Added new ESLint rules for sorting imports and exports.
- Refactored import statements across multiple files for improved consistency and readability.
- Updated ESLint rule for sorting imports from "error" to "allow" for flexibility.
- Removed unused test case for complex event handling in EventBus.spec.ts.
- Deleted Parser.bench.ts file to streamline the codebase.
- Consolidated import statements in Parser.ts and useValueParser.tsx for improved clarity.
- Enhanced test case in createMarkedInput.spec.tsx to ensure proper rendering.
- Updated all instances of the deprecated split() method to parse() in ParserV2 and related files.
- Replaced join() method calls with stringify() for consistency with the new API.
- Removed deprecated split and join methods from Parser class to streamline the codebase.
- Updated documentation and tests to reflect the new method names and ensure proper functionality.
…te README to reflect new transform method usage. This change streamlines the API and enhances clarity for users transitioning to the updated method names.
- Refactored the escape method to handle complete markup patterns using backslashes, improving the handling of nested content and custom escape characters.
- Introduced a new unescape method to revert escaped patterns back to their original form, ensuring proper parsing.
- Updated tests to cover various scenarios, including handling empty text and multiple patterns, ensuring robust functionality.
- Updated the escape method to focus on escaping individual markup segments instead of complete patterns, enhancing clarity and functionality.
- Simplified the logic by directly using unique segments from the registry, improving performance and maintainability.
- Adjusted documentation to reflect changes in method behavior and parameters.
… character

- Removed custom escape character handling from escape and unescape methods, simplifying their signatures.
- Introduced a constant for the default escape character to enhance code clarity and maintainability.
- Updated the implementation of unescape to use `replaceAll` for improved performance.
- Removed outdated test cases related to custom escape character handling.
- Updated the escape method to use `replaceAll` for improved segment replacement, enhancing performance and readability.
- Simplified the unescape method by using a direct regex pattern for escaping characters, streamlining the implementation.
- Adjusted documentation to reflect the changes in method behavior.
…rmance

- Streamlined the escape method by utilizing `reduce` for segment replacement, enhancing clarity and efficiency.
- Simplified the unescape method to directly apply the regex pattern, improving code conciseness.
- Removed unnecessary comments and improved overall code structure.
…ndling

- Introduced a constant for the nested placeholder to enhance code clarity.
- Simplified the logic for reconstructing nested content by directly checking for the placeholder.
- Improved readability by removing unnecessary variable declarations and streamlining the nested content assignment.
…fficiency

- Streamlined the logic by removing unnecessary else statements and using continue for clarity.
- Enhanced the handling of nested content by maintaining the existing structure while improving code flow.
- Improved overall readability of the function by reducing indentation and simplifying the control flow.
- Introduced createTextToken function to encapsulate text token creation logic, improving code reusability and clarity.
- Updated TreeBuilder to utilize the new createTextToken function, simplifying the createTextToken method.
- Adjusted import paths to reflect the new utility location, enhancing module organization.
…ctionality

- Moved SegmentMatcher and MarkupRegistry imports to a core directory for better organization and clarity.
- Introduced a new MarkupRegistry class to manage markup descriptors, enhancing the structure of markup handling.
- Updated references to SegmentMatcher throughout the codebase to reflect the new import paths.
- Added tests for SegmentMatcher to ensure correct functionality with both static and dynamic segments.
- Updated import statements for SegmentMatcher and MarkupRegistry to reflect their new locations in the core directory, improving code organization.
- Enhanced type safety by specifying MarkupDescriptor in the PatternMatcher class, ensuring better clarity and maintainability.
…and performance

- Removed overallTrend from ProfilingComparison and replaced performanceChange with performanceDelta for better representation of performance metrics.
- Updated totalDuration and averageDuration to use formatted strings instead of numbers, enhancing readability.
- Adjusted the logic for determining trends and performance changes, ensuring accurate calculations and clearer output in profiling results.
- Modified the JSON structure to reflect the new metrics and improved performance reporting in the profiling results.
…d formatting

- Changed durationChange and durationChangePercent types from number to string for better representation.
- Modified output messages for performance improvements and degradations to enhance readability.
- Adjusted trend determination logic to ensure accurate classification of performance changes.
…ce metrics and enhancing complexity calculations

- Removed performance rating from TestProfile and averageDuration from ProfilingResult for streamlined output.
- Updated createProfilingResult to directly use currentRun.tests, eliminating unnecessary processing.
- Enhanced complexity estimation for methods to provide more accurate descriptions of algorithmic performance.
… performance reporting

- Eliminated trend properties from ProfilingResult and related calculations to simplify the profiling output.
- Updated createProfilingResult function to focus on performanceDelta, enhancing clarity in performance reporting.
- Adjusted console output to reflect the removal of trend information, ensuring consistency in profiling summaries.
…d focus on test duration changes

- Removed the comparison object from ProfilingResult, simplifying the output structure.
- Updated createProfilingResult to directly include test duration changes, improving performance reporting.
- Adjusted console output to reflect the new structure, ensuring consistency in profiling summaries.
…cs and structure

- Adjusted timestamps and summary metrics to accurately represent the latest profiling results.
- Enhanced test duration reporting with updated duration values and performance deltas for each test case.
- Refined the structure of the profiling results to improve clarity and consistency in performance reporting.
- Removed outdated performance ratings and trends, focusing on relevant metrics for better analysis.
…d trend calculations

- Added comprehensive performance metrics for various test cases, including scalability and real-world scenarios.
- Implemented trend calculations to compare current and previous benchmark runs, identifying performance changes and regressions.
- Refined the structure of the benchmark results to improve clarity and facilitate better analysis of performance data.
- Introduced MarkProps interface to simplify props passed to Mark components, including value, meta, nested content, and children.
- Updated the Piece component to construct props for Mark components and handle nested children rendering.
- Enhanced the Token component to support recursive rendering of nested marks and improved memoization for performance.
- Added comprehensive tests for nested marks rendering and tree navigation properties, ensuring correct depth and children handling.
- Updated storybook examples to demonstrate nested marks functionality and interactive editing capabilities.
… interactivity

- Removed commented-out markup examples for clarity.
- Updated HtmlLikeMark and InteractiveMark components to better handle nested content.
- Simplified options in the InteractiveNested story to focus on essential functionality.
- Cleaned up instructional comments to improve readability and user experience.
… RichText components

- Updated EditableNested story to include a TODO comment for future fixes.
- Removed commented-out RichText components and related markup examples to streamline the code.
- Cleaned up the structure for better readability and maintainability.
…lity and consistency

- Removed unnecessary whitespace in various files, enhancing code clarity.
- Updated README and documentation to reflect changes in markup handling and nested structures.
- Streamlined event listener management in tests for better maintainability.
- Enhanced storybook examples to demonstrate nested marks functionality more effectively.
- Introduced a new MarkdownOptions.ts file to define a default markdown theme with various presets for headings, lists, and text styles.
- Updated Nested.stories.tsx to utilize the new MarkdownOptions, simplifying the MarkdownInput component and enhancing code maintainability.
- Removed redundant inline markup definitions from the story, improving clarity and reducing duplication.
- Simplified the arrow function syntax in the initMark property of the MarkdownOptions, enhancing code clarity and consistency.
@vercel
Copy link

vercel bot commented Nov 15, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
marked-input Ready Ready Preview Comment Nov 15, 2025 2:33pm

…ltiple files

- Removed unused variables and simplified the comparison logic in parser.profile.bench.ts to enhance performance metrics clarity.
- Cleaned up import statements in types.ts and story files to remove unnecessary dependencies, improving code maintainability.
- Commented out and added TODOs in Nested.stories.tsx for future enhancements to editable nested marks support.
@Nowely Nowely changed the title Nestes Implement first nested marks support Nov 15, 2025
@Nowely Nowely merged commit dc589fd into next Nov 15, 2025
7 checks passed
@Nowely Nowely deleted the nestes branch November 15, 2025 14:46
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