Skip to content

Commit

Permalink
Make markdown headers bold
Browse files Browse the repository at this point in the history
Signed-off-by: Slendi <[email protected]>
  • Loading branch information
slendidev committed Feb 27, 2025
1 parent 3c1c250 commit d1d91d8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub async fn process_response(
let mut star_cnt = 0;
let mut in_effect = false;
let mut text_effected = false;
let mut next_newline_reset = true;
let stdout_is_terminal = std::io::stdout().is_terminal();

while let Some(chunk) = stream.next().await {
Expand All @@ -31,6 +32,10 @@ pub async fn process_response(
let mut chars = content.chars().peekable();

while let Some(ch) = chars.next() {
if ch == '\n' && next_newline_reset {
print!("\x1b[0m");
}

if language_reading {
if ch == '\n' {
language_reading = false;
Expand Down Expand Up @@ -95,6 +100,9 @@ pub async fn process_response(
print!("\x1b[0;1;3m");
}
}
} else if ch == '#' {
print!("\x1b[1m#");
next_newline_reset = true;
} else {
if in_effect {
text_effected = true;
Expand Down

0 comments on commit d1d91d8

Please sign in to comment.