Browse Source

Show line numbers on plaintext too

master
Dylan Baker 5 years ago
parent
commit
66beaa59bb
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      src/snippet.rs

+ 2
- 2
src/snippet.rs View File

@@ -28,12 +28,12 @@ pub struct InsertableSnippet {
28 28
 
29 29
 fn format_snippet(filetype: Option<String>, body: String) -> String {
30 30
     filetype.map_or(
31
-        format!("<pre class='plaintext'>{}</pre>", body),
31
+        format!("<pre class='plaintext'>\n{}\n</pre>", body),
32 32
         |filetype| {
33 33
             let ps = SyntaxSet::load_defaults_newlines();
34 34
             let ts = ThemeSet::load_defaults();
35 35
             ps.find_syntax_by_extension(&filetype).map_or(
36
-                format!("<pre class='plaintext'>{}</pre>", body),
36
+                format!("<pre class='plaintext'>\n{}\n</pre>", body),
37 37
                 |syntax| {
38 38
                     highlighted_html_for_string(
39 39
                         &htmlescape::decode_html(&body).expect("Invalid HTML"),

Loading…
Cancel
Save