1831 Commits

Author SHA1 Message Date
prozolic
a9bd7c6a5e Fix to calculate LinkReferenceDefinition span positions from StringLineGroup.Lines (#931)
* 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>
1.1.2
2026-03-24 21:21:12 +01:00
prozolic
7cb7583fd7 Fix emoji not rendering in table cells (#928)
* Fix emoji not rendering in table cells

* Update EmojiSpecs.md

* Update src/Markdig/Extensions/Emoji/EmojiParser.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1.1.1
2026-03-04 21:20:18 +01:00
Alexandre Mutel
bddaa55da1 docs(site): document CJK friendly emphasis extension 1.1.0 2026-03-01 13:57:39 +01:00
Tatsunori Uchino
6d5a124863 Add CJK-friendly Emphasis Extension (#921)
* Add CJK-friendly Emphasis Extension

* Add auto-generated test file

* Add name for configuration

* Remove useless default value assignments

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>

* Make `CheckOpenCloseDelimiterCjkFriendly` internal only

* Remove `CjkFriendlyEmphasisExtension` class

* Add some comments including links

* Add direct tests on `CharHelper.CheckOpenCloseDelimiterCjkFriendly`

* Fix generated tests

* Add `#if NET`

* Skip Rune-dependent tests in .NET Standard tests

* Add missing XML Documentation Comments

* Fix URL

* Change test condition

* Add test in .NET Framework 4.8.1

* Add netstandard2.0 to SpecFileGen

* Add fallback for netstandard2.0

* Fix

* Revert "Fix"

This reverts commit 42e998b085.

* Revert "Add fallback for netstandard2.0"

This reverts commit 7400a7bb0b.

* Revert "Add netstandard2.0 to SpecFileGen"

This reverts commit f9aa8e1e8d.

* Revert "Add test in .NET Framework 4.8.1"

This reverts commit d8d6d516ed.

* Fix missing indent

---------

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
2026-03-01 13:47:54 +01:00
Alexandre Mutel
7959e3b912 Reject pipe-only rows as pipe table separators (Fixes #927) 1.0.1 2026-02-28 06:51:42 +01:00
Alexandre Mutel
391e03b8d0 Update readme 2026-02-22 19:17:58 +01:00
Alexandre Mutel
361231dc9e Fix ci 2026-02-22 14:46:24 +01:00
Alexandre Mutel
3167f8ef98 Add missing markdown example 2026-02-22 14:45:13 +01:00
Alexandre Mutel
682a30c1fe Add mermaid and katex 2026-02-22 14:11:54 +01:00
Alexandre Mutel
162c0d2264 Simplify NuGet description (#925) 1.0.0 2026-02-22 13:31:21 +01:00
Alexandre Mutel
f735314a77 Improve site documentation accuracy and structure 2026-02-22 10:49:31 +01:00
Alexandre Mutel
5de7e42a86 Add namespace API docs for Markdig 2026-02-22 10:21:13 +01:00
Miha Zupan
3fb74a0f2b Remove obsolete APIs (#926) 2026-02-22 08:15:07 +01:00
Alexandre Mutel
b370c5cca0 Update banner 2026-02-22 00:50:41 +01:00
Alexandre Mutel
d1ce188688 Add playground to frontpage 1.0.0-preview.1 2026-02-22 00:33:17 +01:00
Alexandre Mutel
999ccbc7c3 Fix top level readme about documentation 2026-02-21 23:58:48 +01:00
Alexandre Mutel
94cb00d19b Add GitHub action for site 2026-02-21 23:52:28 +01:00
Alexandre Mutel
74f429c427 Add comprehensive documentation site
Create a full Lunet-based documentation site in site/ with:
- Site config, navigation, landing page with hero section
- Core docs: getting started, usage guide, CommonMark reference
- Extension docs: 19 pages covering all 30+ extensions
- Developer guide: AST, pipeline, creating extensions, block/inline
  parsers, renderers, performance
- API reference generation via lunet-io/templates
- Remove obsolete parsing-*.md files (content revised into docs/)
- Update AGENTS.md with website build instructions
- Add site/AGENTS.md with site-specific guidance
2026-02-21 23:50:30 +01:00
Alexandre Mutel
020a8490dd Add DotSettings 2026-02-21 20:48:06 +01:00
Alexandre Mutel
310f084c9f Move doc to site 2026-02-21 20:47:59 +01:00
Alexandre Mutel
0cc463b6e1 Add XML docs for public Markdig API 2026-02-21 19:43:15 +01:00
Alexandre Mutel
148fd08b1d Add span validation/update APIs and tests 2026-02-21 19:17:18 +01:00
Alexandre Mutel
c488a27497 Document parser authoring contracts and migration risks 2026-02-21 18:46:04 +01:00
Alexandre Mutel
58e8217ddb Add typed markdown object data key helpers 2026-02-21 18:46:04 +01:00
Alexandre Mutel
2c9a9a308c Add AST mutation helpers for block and inline trees 2026-02-21 18:46:04 +01:00
Alexandre Mutel
ab6204cf61 Add parser authoring helper APIs and tests 2026-02-21 18:46:04 +01:00
Alexandre Mutel
5e5112ccca Expose parser parity APIs for extension authors 2026-02-21 18:46:04 +01:00
Alexandre Mutel
e9d582a169 Update deps NuGet 2026-02-21 14:49:05 +01:00
Alexandre Mutel
e5c88eff00 Move from net9.0 to net10.0 2026-02-21 14:49:05 +01:00
Alexandre Mutel
1a96addeba Add api authoring 1.0 2026-02-21 14:17:43 +01:00
Alexandre Mutel
3f7c09c443 Add instructions 2026-02-21 09:52:46 +01:00
Martijn Laarman
d47fbc757f Optimize PipeTable parsing: O(n²) → O(n) for 3.7x–85x speedup, enables 10K+ row tables (#922)
* 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
0.45.0
2026-01-30 22:05:18 +01:00
prozolic
3602433b84 Replace null checks with IsEmpty property for ReadOnlySpan<char> (#916)
This change suppresses CA2265 warnings.
2026-01-30 22:01:50 +01:00
prozolic
1bac4afc9b Use Dictionary.TryAdd instead of ContainsKey and indexer by reducing lookups. (#917)
* Use Dictionary.TryAdd instead of ContainsKey and indexer by reducing lookups.

* Update src/Markdig/Parsers/ParserList.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-30 22:01:27 +01:00
Tatsunori Uchino
a89056d961 Recognize supplementary characters (#913)
* Recognize supplementary characters

* Internatize Rune

* Fix failing tests

* Fix extra comment error

* Remove extra local variable c

* Reorganize classes around Rune

* Prepare both Rune and char variants / make Rune variant public for .NET

* Make APIs in StringSlice.cs public only in modern .NET

* Throw exception if cannot obtain first Rune

* Add comments

* Add comment on PeekRuneExtra

* Use `Rune.TryCreate`

* Remove backtrack

* Fix parameter name in XML comment

* Don't throw when error in `Rune.DecodeFromUtf16`

* Fix RuneAt

* Add tests of Rune-related methods of `StringSlice`

* Make comment more tolerant of changes

* Tweak comment

* Fix comment

* Add `readonly`

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>

* Move namespace of polyfilled Rune out of System.Text

* Apply suggestions from code review

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>

* Fix regression by review suggestion

* Prepare constant for .NET Standard test

* Don't call `IsPunctuationException` if unnecessary

* PR feedback

---------

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
2026-01-12 11:08:03 +01:00
Miha Zupan
cd7b9ca0ef Test netstandard (#915)
* Add GH Action to test netstandard 2.0 and 2.1

* Account for TFM changes in tests project
0.44.0
2025-11-17 18:46:26 +01:00
Alexandre Mutel
fb698598e4 Use central package management 2025-11-17 08:19:42 +01:00
mos379
12590e5fbe feat(link-helper): improve ASCII normalization handling (#911)
* feat(link-helper): improve ASCII normalization handling

Enhanced the `Urilize` method to better handle ASCII normalization and special characters. Added support for decomposing characters when `allowOnlyAscii` is true and skipping diacritical marks. Introduced handling for special German, Scandinavian, and Icelandic characters via new helper methods: `IsSpecialScandinavianOrGermanChar` and `NormalizeScandinavianOrGermanChar`.

Reorganized `using` directives for better clarity. Updated the processing loop in `Urilize` to handle normalized spans and ASCII equivalents more effectively. These changes improve link generation compatibility across various languages.

* Add tests for Scandinavian and German character normalization

Added tests for NormalizeScandinavianOrGermanChar method to validate character normalization for various special characters in both ASCII and non-ASCII contexts.

* test(link-helper): update ASCII transliteration tests

Updated test cases in `TestUrilizeOnlyAscii_Simple` to reflect
changes in `LinkHelper.Urilize` behavior. Non-ASCII characters
like `æ` and `ø` are now transliterated to their ASCII
equivalents (`ae` and `oe`) instead of being removed.
2025-11-10 22:01:35 +01:00
Miha Zupan
8c01cf0549 Add another test for pipe tables (#907) 0.43.0 2025-10-21 08:37:43 +02:00
Miha Zupan
bcbd8e47ac Lazily allocate ProcessInlinesBegin/End delegates on Blocks (#906) 2025-10-21 08:37:02 +02:00
Miha Zupan
d6e88f16f7 Fix pipe table parsing with a leading paragraph (#905)
* Fix pipe table parsing with a leading paragraph

* Use the alternative approach
2025-10-20 21:43:25 +02:00
Miha Zupan
03bdf60086 Add a basic fuzzing project (#903)
* Add basic fuzzing project

* Mark the project as non-packable
2025-10-17 08:09:28 +02:00
Miha Zupan
5c78932f55 Fix edge cases in EmphasisInlineParser (#902) 2025-10-17 08:07:15 +02:00
Miha Zupan
191e33ab32 Fix build warnings (#899) 2025-10-16 17:25:47 +02:00
Miha Zupan
800235ba7a Fix IndexOutOfRangeException in CodeInlineParser (#900) 2025-10-16 17:25:30 +02:00
Miha Zupan
d5f8a809a0 Move sln to slnx (#901) 2025-10-16 17:24:33 +02:00
Asttear
781d9b5365 Remove leading newline in block attributes (#896)
* Remove leading newline in block attributes

fix #895

* Add handling logic for `\r\n`
2025-10-05 11:21:12 +02:00
Phillip Haydon
543570224e Fix issue where an inline code block that spans multiple lines doesn't parse correctly (#893)
* fixes issue where an inline code block that spans multiple lines doesn't get treated as code

* Update src/Markdig.Tests/TestPipeTable.cs

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>

* Apply suggestion from @MihaZupan

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>

* Update src/Markdig.Tests/TestPipeTable.cs

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>

* fix broken test

* removed unreachable code and added more tests

* Update src/Markdig.Tests/TestPipeTable.cs

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>

* Update src/Markdig.Tests/TestPipeTable.cs

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>

* removed uncessary inline code check

* Update src/Markdig/Parsers/Inlines/CodeInlineParser.cs

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>

---------

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
Co-authored-by: Alexandre Mutel <alexandre_mutel@live.com>
2025-10-03 09:34:24 +02:00
Daniel Klecha
4dc0be88b4 add options for link inline (#894)
* add options for link inline

* create LinkOptions and associate it with all four parsers

* set EnableHtmlParsing to true by default
2025-10-03 09:22:51 +02:00
Phillip Haydon
0e9e80e1cd Fix for table depth error when cell contains backticks (#891)
* failing test

* fixed bug with table containing back tick which causes depth error
2025-09-21 16:26:02 +02:00