about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/main.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index e82d081..f6cdb8c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -475,6 +475,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>
@@ -485,6 +487,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>
@@ -495,6 +498,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>