Introduces AllowNestedAlerts on AlertExtension and AlertInlineParser
(default: false) to allow alert blocks inside blockquotes or list items.
The UseAlertBlocks() pipeline extension method exposes the new option
via an allowNestedAlerts parameter.
Resolves#853
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* test: add failing regression tests for issue #935 (abbreviation + emphasis)
* fix: AbbreviationParser now substitutes post-inline-parse, fixes emphasis corruption (#935)
The PostMatch hook approach (running mid-parse) produced a ContainerInline
with IsClosed=false that disrupted FindLastContainer(), causing emphasis
delimiters to be appended as children of the abbreviation container instead
of as root siblings. It also had an off-by-one (i != 0 vs i != content.Start)
that caused abbreviations to be missed when the literal started inside emphasis.
Replace with a document.ProcessInlinesEnd handler that walks the fully resolved
inline tree (after EmphasisInlineParser and LinkInlineParser have run), inserting
AbbreviationInline/LiteralInline siblings directly into parent containers without
any wrapper ContainerInline.
Also update TestSourcePosition.TestAbbreviations to reflect the new tree shape
(no container wrapper; empty leading literals at word boundaries are pruned).
Fixes#935
* Fix to calculate LinkReferenceDefinition span positions from StringLineGroup.Lines
* Add test case in TestMultilineInBlockquote
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Change from startPosition + span.End - span.Start to GetAbsolutePosition(lines, span.End)
* Move ConvertToAbsoluteSpan and GetAbsolutePosition to StringLineGroup
* Remove '\r' check in Write(ReadOnlySpan<char>)
---------
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Optimize PipeTable parsing: O(n²) → O(n) for large tables
Pipe tables were creating deeply nested tree structures where each pipe
delimiter contained all subsequent content as children, causing O(n²)
traversal complexity for n cells. This change restructures the parser to
use a flat sibling-based structure, treating tables as matrices rather
than nested trees.
Key changes:
- Set IsClosed=true on PipeTableDelimiterInline to prevent nesting
- Add PromoteNestedPipesToRootLevel() to flatten pipes nested in emphasis
- Update cell boundary detection to use sibling traversal
- Move EmphasisInlineParser before PipeTableParser in processing order
- Fix EmphasisInlineParser to continue past IsClosed delimiters
- Add ContainsParentOrSiblingOfType<T>() helper for flat structure detection
Performance improvements (measured on typical markdown content):
| Rows | Before | After | Speedup |
|------|-----------|---------|---------|
| 100 | 542 μs | 150 μs | 3.6x |
| 500 | 23,018 μs | 763 μs | 30x |
| 1000 | 89,418 μs | 1,596 μs| 56x |
| 1500 | 201,593 μs| 2,740 μs| 74x |
| 5000 | CRASH | 10,588 μs| ∞ |
| 10000| CRASH | 18,551 μs| ∞ |
Tables with 5000+ rows previously crashed due to stack overflow from
recursive depth. They now parse successfully with linear time complexity.
* remove baseline results file
* Do not use System.Index and fix nullabillity checks for older platforms