From 8e8d5f7974b417a4957c6e7fd36001d429073df3 Mon Sep 17 00:00:00 2001 From: Adrien Furnari Date: Thu, 12 Feb 2026 11:24:25 +0100 Subject: [PATCH] feat: enhanced the tests --- test-server.php | 4 +- tests/index.php | 33 ++++- tests/targets/html.md | 294 +++++++++++++++++++++++++++++++++++++++ tests/targets/php.md | 312 ++++++++++++++++++++++++++++++++++++++++++ tests/targets/test.md | 3 - tests/targets/xml.md | 177 +++++++++++++++++++++++- 6 files changed, 811 insertions(+), 12 deletions(-) create mode 100644 tests/targets/html.md create mode 100644 tests/targets/php.md delete mode 100644 tests/targets/test.md diff --git a/test-server.php b/test-server.php index dfa6ee0..7e6f11a 100644 --- a/test-server.php +++ b/test-server.php @@ -2,4 +2,6 @@ require_once __DIR__ . '/vendor/autoload.php'; -passthru("php -S localhost:8000 -t tests/"); \ No newline at end of file +$port = intval($argv[1] ?? 8000); + +passthru("php -S localhost:$port -t tests/"); diff --git a/tests/index.php b/tests/index.php index 5f2fede..e4d391d 100644 --- a/tests/index.php +++ b/tests/index.php @@ -12,6 +12,8 @@ use Tempest\Highlight\Highlighter; use Tempest\Highlight\Themes\CssTheme; +$tests = glob("./targets/*.md"); + $environment = new Environment(); $highlighter = (new Highlighter(new CssTheme())); @@ -24,7 +26,7 @@ $markdown = new MarkdownConverter($environment); -$target = 'targets' . DIRECTORY_SEPARATOR . 'test.md'; +$target = 'targets' . DIRECTORY_SEPARATOR . 'php.md'; if (isset($_GET['target'])) { $target = $_GET['target']; @@ -46,7 +48,7 @@ ?> - + Test + + + + + + + + + + + + + + + + + + + + + + + + Paragraph one + Paragraph two — the first <p> auto-closes + Third with inline that doesn't break + + + Item 1 + Item 2 + Item 3 with link + + + + Term + Definition + Another + Def 2 + + + + AB + CD + + + + One + Two + Three + + + + '; + if (1 < 2 && 3 > 1) { console.log("not bold"); } + var tpl = ``; + + + + + + This is raw text in textarea + + & but this entity IS parsed in textarea + + + + & < > " ' © © © © + Bare & ampersand, and 3 < 5 > 2 technically invalid but tolerated + &nonexistent; entity — parser should handle gracefully + Numeric edge: + + + Mixed quoting + JSON in single-quoted attr + JSON in double-quoted with entities + Attr soup + Newline in attribute value + Nested quotes + + Case insensitive attrs + + + + + + + + + + + + + + + + HTML inside SVG foreignObject + + + + Text + + Link + + + + Bonjour + Hello + + + + + + + + + + ∑ + i=0 + ∞ + + + xi + i! + + = + ex + + \\sum_{i=0}^{\\infty} \\frac{x^i}{i!} = e^x + + + + + HTML context + + + + + + + + x + + + + + Back to HTML + + + + + + + + Slotted + + + + + + + + + + 8 levels + + + Extra spaces in attributes + Multiline attribute formatting + + + Uppercase tag + Mixed case tag + h1h2h3h4h5h6 + + + + + + + + + + + Is 5<10? And what about bold after? + Bare angle < and > in text + + + + Open by default + + Nested details + Deeply nested + + + + + + OK + + + + Popover + Toggle + + + + + + + + + + Obsolete center + Obsolete font + Obsolete marquee + Obsolete blink + Obsolete xmp — raw text + + +
Paragraph one +
Paragraph two — the first <p> auto-closes +
Third with inline that doesn't break
& < > " ' © © © ©
Bare & ampersand, and 3 < 5 > 2 technically invalid but tolerated
&nonexistent; entity — parser should handle gracefully
Numeric edge:
HTML inside SVG foreignObject
Extra spaces in attributes
Is 5<10? And what about bold after?
Bare angle < and > in text
Deeply nested