Skip to content

Commit

Permalink
impr: make it more efficient
Browse files Browse the repository at this point in the history
  • Loading branch information
MR-Addict committed Feb 18, 2024
1 parent fba3b3a commit 4f4c338
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions backend/src/repl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ fn get_asset(name: &str) -> String {
fn render_repls(content: &str) -> String {
let re = Regex::new(r"(?s)```(py|python)\n(.*?)```").unwrap();

if !re.is_match(content) {
return content.to_string();
}

re.replace_all(content, |caps: &regex::Captures| {
let id = Uuid::new_v4().to_string();
let lang = caps.get(1).unwrap().as_str();
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Output/Output.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function Output() {
<p className="whitespace-pre-wrap p-2 bg-stone-100 dark:bg-zinc-800 font-mono empty:hidden">{message}</p>
<button
type="button"
className="absolute right-2 top-2 opacity-0 duration-300 group-hover:opacity-100"
className="absolute right-2 top-1 opacity-0 duration-300 group-hover:opacity-100"
onClick={() => setOutput({ status: "idle", msg: "" })}
>
clear
Expand Down

0 comments on commit 4f4c338

Please sign in to comment.