Skip to content

Commit

Permalink
Merge pull request tempestphp#145 from JunioraTeam/main
Browse files Browse the repository at this point in the history
Fix for extra added spaces at the start of lines
  • Loading branch information
brendt authored Aug 30, 2024
2 parents e7711dd + a3b2079 commit d767c3c
Show file tree
Hide file tree
Showing 48 changed files with 78 additions and 31 deletions.
4 changes: 3 additions & 1 deletion src/Languages/Base/Injections/GutterInjection.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Tempest\Highlight\Highlighter;
use Tempest\Highlight\Injection;
use Tempest\Highlight\ParsedInjection;
use Tempest\Highlight\TerminalTheme;

final class GutterInjection implements Injection
{
Expand Down Expand Up @@ -62,13 +63,14 @@ public function parse(string $content, Highlighter $highlighter): ParsedInjectio
$gutterClass = 'hl-gutter' . ($hasClasses ? ' ' . $hasClasses : '');

$lines[$i] = sprintf(
Escape::tokens('<span class="%s">%s</span> %s'),
Escape::tokens('<span class="%s">%s</span>%s%s'),
$gutterClass,
str_pad(
string: (string) $gutterNumber,
length: $gutterWidth,
pad_type: STR_PAD_LEFT,
),
$highlighter->getTheme() instanceof TerminalTheme ? ' ' : '',
$line,
);
}
Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/andromeeda.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/aurora-x.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/ayu-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/catppuccin-frappe.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/catppuccin-latte.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/catppuccin-macchiato.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/catppuccin-mocha.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/dark-plus.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/dracula-soft.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/dracula.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/github-dark-default.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/github-dark-dimmed.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/github-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/github-light-default.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/github-light.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/highlight-light-lite.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/houston.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/inspired-github.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ pre, code {
font-size: 0.9em;
color: #b3b3b3;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/light-plus.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/material-theme-darker.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/material-theme-lighter.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/material-theme-ocean.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/material-theme-palenight.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/material-theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/min-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/min-light.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/monokai.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/night-owl.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/nord.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/one-dark-pro.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/poimandres.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/red.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/rose-pine-dawn.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/rose-pine-moon.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/rose-pine.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/slack-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/slack-ochin.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/solarized-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/solarized-light.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/synthwave-84.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/tokyo-night.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/vesper.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/vitesse-black.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/vitesse-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
1 change: 1 addition & 0 deletions src/Themes/Css/vitesse-light.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pre, code {
font-size: 0.9em;
color: #555;
padding: 0 1ch;
margin-right: 1ch;
user-select: none;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/CommonMark/CodeBlockRendererTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Foo {}
TXT;

$expected = <<<'TXT'
<pre data-lang="php" class="notranslate"><span class="hl-gutter">10</span> <span class="hl-keyword">class</span> <span class="hl-type">Foo</span> {}</pre>
<pre data-lang="php" class="notranslate"><span class="hl-gutter">10</span><span class="hl-keyword">class</span> <span class="hl-type">Foo</span> {}</pre>

TXT;

Expand Down
Loading

0 comments on commit d767c3c

Please sign in to comment.