diff options
Diffstat (limited to 'src/generate_html.rs')
-rw-r--r-- | src/generate_html.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/generate_html.rs b/src/generate_html.rs index a6aa0b6..e329739 100644 --- a/src/generate_html.rs +++ b/src/generate_html.rs @@ -415,8 +415,11 @@ fn sanitize_text(text: &str, fancy: bool) -> String { false => output.push('’'), }, '-' if fancy => match prev.is_whitespace() && next.is_whitespace() { - true => output.push('—'), - false => output.push('-'), + true => match i > 0 { + true => output.push('—'), // em-dash, for mid-sentence + false => output.push('–'), // en-dash, for start of line + } + false => output.push('-'), // regular dash, for mid-word } _ => output.push(*c), } |