Skip to content

Commit

Permalink
Update <text> markup to look clean in dark theme
Browse files Browse the repository at this point in the history
  • Loading branch information
danon committed Oct 17, 2024
1 parent 77a674e commit 2ec3023
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
14 changes: 6 additions & 8 deletions app/Services/Parser/Parsers/Latex.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ protected function parseHashed(string $text): string
{
return \preg_replace_callback(
"#<tex>(.*?)</tex>#si",
function ($match) {
return sprintf(
'<img src="https://latex.codecogs.com/gif.latex?%s" alt="%s">',
rawurlencode($match[1]),
htmlspecialchars($match[1])
);
},
$text
fn(array $match): string => \sPrintF(
'<img src="https://latex.codecogs.com/svg.latex?%s" alt="%s" class="latex">',
\rawUrlEncode($match[1]),
\htmlSpecialChars($match[1]),
),
$text,
);
}
}
8 changes: 8 additions & 0 deletions resources/sass/components/forms/_markdown.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import "../../../feature/theme/theme";

.editor {
border: 1px solid $border-color;
padding: $input-padding-y 0;
Expand Down Expand Up @@ -77,3 +79,9 @@
}
}
}

img.latex {
@include dark {
filter: invert(1);
}
}

0 comments on commit 2ec3023

Please sign in to comment.