Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for extra added spaces at the start of lines #145

Merged
merged 5 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 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,7 +63,7 @@ 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>'.($highlighter->getTheme() instanceof TerminalTheme ? ' ' : '').'%s'),
nimah79 marked this conversation as resolved.
Show resolved Hide resolved
$gutterClass,
str_pad(
string: (string) $gutterNumber,
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
Loading