diff --git a/README.md b/README.md index f63adfb..4e876ca 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ or via reference to [a later defined url][massivedynamic], i we so desire. ### Tables ```markdown | Product name | Amount | Price | -|--------------|-----:----|-------:| +|--------------|:--------:|-------:| | Football | 7 | $18,00 | | Golfball | 122 | $7,00 | | Fooseball | 355 | $1,00 | @@ -90,7 +90,7 @@ or via reference to [a later defined url][massivedynamic], i we so desire. ``` | Product name | Amount | Price | -|--------------|-----:----|-------:| +|--------------|:--------:|-------:| | Football | 7 | $18,00 | | Golfball | 122 | $7,00 | | Fooseball | 355 | $1,00 | diff --git a/src/Parser.php b/src/Parser.php index f40eb52..4cf06ea 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -396,11 +396,14 @@ class Parser { if ($buffer === "") continue; - if (substr($buffer, 0, 1) === ':') + + $firstChar = substr($buffer, 0, 1); + $lastChar = substr($buffer, strlen($buffer) - 1, 1); + if ($firstChar === ':' && $lastChar !== ':') array_push($props, "left"); - elseif (substr($buffer, strlen($buffer) - 1, 1) === ':') + elseif ($lastChar === ':' && $firstChar !== ':') array_push($props, "right"); - elseif (str_contains($buffer, ':')) + elseif ($firstChar === ':' && $lastChar === ':') array_push($props, "center"); else array_push($props, "left");