Commit 0410bbc
authored
Refactor: New extensible Markdown Parser (#229)
* Refactor: Convert syntax node serializers to non-static classes implementing `IMdSyntaxNodeSerializer` and add associated `Syntax` regex properties.
* BROKEN
* Refactor: Standardize regex patterns for whitespace handling and optimize multiline parsing logic in `PushMultiLineMatchesToStack`.
* Refactor: Add `ToString` and `ToDebugString` methods for `MdSyntaxNode` and `MdSyntaxTree`, update regex references, and standardize serializer naming.
* Fix Markdown regex and code block serialization
Improved Markdown regex patterns for superscript, subscript, and underline to handle newlines and nested delimiters correctly. Simplified code block serialization logic to always add newlines for CRLF sequences and removed special handling for trailing newlines. Added test output and failure files for debugging.
* Update TUnit and TUnit.Core package versions to 1.7.7
* Refactor: Add `ToDebugString` to `TextMdSyntaxNode`, update `BoldRegex` pattern, and optimize single-line match stack logic
* Refactor: Optimize memory allocation using `ArrayPool` in `MdSyntaxFragmentStack` and ensure capacity for dynamic resizing.
* Refactor: Optimize multiline and single-line match stacking logic, replace `PushMatchToStack` with direct stack operations, and enhance memory efficiency with `ArrayPool`.
* Refactor: Simplify matching logic in `MdSyntaxFragmentStack` by removing unnecessary `foundMatch` variable and redundant conditions
* Refactor: Replace static `Pool.Get()` calls with centralized `MdSyntaxNodePool<T>.Shared.Get()` for memory management consistency and add shared pooling utility
* Refactor: Remove unused `System.Runtime.CompilerServices` import and redundant `Return(IMdSyntaxNode)` method in `MdSyntaxNodePool`
* Refactor: Merge `MdSyntaxNodeModifierExtensions` methods directly into `IMdSyntaxNodeModifier` and `MdSyntaxNodeModifier` to streamline API usage and reduce extension overhead
* Refactor: Centralize pooling logic for `MdSyntaxTree` and `MdSyntaxFragmentStack` with new shared pool classes, remove redundant methods, and simplify memory management
* Refactor: Add `GetCount` method to `MdSyntaxTree` for improved child node count retrieval
* Update Directory.Packages.props
* Refactor: Replace `MdRegexLib` with `GeneratedRegex` annotations in syntax node serializers for improved performance and maintainability
* Fix regex group name usage in node serializers
Replaces usage of constants for regex group names with string literals in BlockQuoteSyntaxNodeSerializer and BoldSyntaxNodeSerializer. Also removes the unused 'bold' named group from the bold regex pattern.
* Update: Rename project to 'infiniblazor' and remove unused 'peer' fields from package-lock.json
* Refactor: Simplify regex usage in BlockQuoteSyntaxNodeSerializer by removing unused group and constants
* Refactor: Replace regex group name constants with string literals and simplify regex patterns in syntax node serializers
* Refactor: Remove unused `MdRegexGroupNames` constants to simplify project structure and reduce maintenance overhead
* Refactor: Replace `TryGetValue` and related checks with direct property access for improved clarity and consistency across syntax node serializers
* Add mock dependencies to Markdown benchmarks for improved test isolation
* Remove unused imports and update nullability handling for cleaner code structure
* Remove unused `MdRegexLibTests` and update nullability handling in tests for clarity and simplicity
* Add `TriggerCharacters` property to `IMdSyntaxNodeSerializer` and update relevant serializers to optimize matching logic
* Refactor: Optimize multiline and single-line syntax node matching by improving `TriggerCharacters` checks and line-handling logic
* Refactor: Add character-based serializer lookup tables to optimize syntax matching logic and improve performance
* Refactor: Simplify serializer lookup initialization and optimize global + trigger-based serializer handling
* Refactor: Add `SearchValues<char>` for fast trigger detection and optimize serializer matching logic
* Refactor: Improve line handling, trigger matching, and serializer capacity logic for better readability and performance
* Refactor: Replace empty `TriggerCharacters` array initializations with `Array.Empty<char>()` for improved clarity and performance
* Refactor: Simplify line handling logic and remove redundant conditions for improved readability and maintainability
* Update benchmark runner and refactor interface parameters
Switched the benchmark runner in Program.cs to use IndividualMarkdownBenchmarks instead of MarkdownBenchmarks. Removed an unused using directive in InfiniMarkdownEditor.razor. Renamed parameters in IMdSyntaxFragmentStack interface methods for clarity.
* Refactor benchmarks: Introduce `ParamsSource` cases for improved test coverage and remove redundant benchmark methods. Extract mocks into dedicated classes for reusability.
* Expand `IndividualMarkdownBenchmarks` with additional cases, warmup logic, and helper methods to enhance benchmark coverage and performance.
* Refactor benchmarks: Add missing `using` directives, make `Cases` public, and update mock service registrations for consistency and enhanced test coverage.
* Remove `SerializeToSyntaxTree_ParagraphBaseline` benchmark as redundant
* Switch benchmark runner back to `MarkdownBenchmarks` and add `Results.md` for benchmark result documentation.
* Expand `IndividualMarkdownBenchmarks` with additional table cases for 50 and 100 rows to improve benchmark coverage.
* Refactor: Move `ArrayPool` rentals closer to usage in `MdSyntaxFragmentStack` methods for clarity and maintainability
* Refactor: Introduce `IRootMdSyntaxNode` interface, add tree reference management, and improve cache handling in `MdSyntaxTree` and related components
* Add `RemoveChild` and `RemoveChildAt` functionality to `IMdSyntaxNode`, update core logic, and add corresponding unit tests.
* Add comprehensive child node management tests to `MdSyntaxNode`, refactor sibling navigation logic, and fix index calculation bugs.
* Update benchmark results for `RenderMarkdown` with improved performance metrics
* Switch to IndividualMarkdownBenchmarks in benchmark runner
The benchmark runner now executes IndividualMarkdownBenchmarks instead of MarkdownBenchmarks. This change likely aims to focus benchmarking on individual markdown scenarios for more granular performance analysis.
* Update benchmark results in `Results.md` with additional metrics and formatting adjustments1 parent d27ebe8 commit 0410bbc
89 files changed
Lines changed: 1897 additions & 1109 deletions
File tree
- benchmarks/Benchmarks.InfiniBlazor.Markdown
- docs/InfiniBlazorDocs
- src
- InfiniBlazor.Core.Markdown.Components
- InfiniMarkdownEditor
- MdBlazorComponents
- InfiniBlazor.Core.Markdown
- Config
- Parsers
- Json
- Markdown/Serializer
- NodeSerializers
- RegexLib
- Xml
- NodeVisitors
- Syntax
- Nodes
- tests/InfiniBlazorTests.Core.Markdown
- Parsers
- Json
- Markdown
- Xml
- RegexLib
- Syntax
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 271 additions & 226 deletions
Large diffs are not rendered by default.
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| |||
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | 10 | | |
15 | 11 | | |
16 | 12 | | |
| |||
Binary file not shown.
Binary file not shown.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments