about summary refs log tree commit diff
path: root/src/main.rs
diff options
context:
space:
mode:
authorShubham <25881429+shoebham@users.noreply.github.com>2022-12-26 21:28:45 +0530
committerShubham <25881429+shoebham@users.noreply.github.com>2022-12-26 21:28:45 +0530
commit80133a6c6fc448de495f48ce53494f80c3f2b123 (patch)
tree41b9743219d1e035fb7d9ae65f7386612bd2dea7 /src/main.rs
parent41937f38622b98064ab526b6dfb5e7150b30ba96 (diff)
remove trailing whitespace and newline
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 438a24a..a785d03 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -490,6 +490,8 @@ fn write_readme_content(file: &mut File, in_path: &Path, raw_path: &Path)
             for line in readme.split('\n') {
                 if line.starts_with("###") {
                     let line = line.get(4..).unwrap();
+                    // trim the line to remove the trailing whitespace
+                    let line = line.trim();
                     file.write_all(
                         format!(
                             r##"       <a href="#{}">{}</a>
@@ -500,6 +502,7 @@ fn write_readme_content(file: &mut File, in_path: &Path, raw_path: &Path)
                     )?;
                 } else if line.starts_with("##") {
                     let line = line.get(3..).unwrap();
+                    let line = line.trim();
                     file.write_all(
                         format!(
                             r##"    <a href="#{}">{}</a>
@@ -510,6 +513,7 @@ fn write_readme_content(file: &mut File, in_path: &Path, raw_path: &Path)
                     )?;
                 } else if line.starts_with("#") {
                     let line = line.get(2..).unwrap();
+                    let line = line.trim();
                     file.write_all(
                         format!(
                             r##"<a href="#{}">{}</a>