about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEmile <HanEmile@users.noreply.github.com>2023-01-17 12:09:44 +0000
committerGitHub <noreply@github.com>2023-01-17 12:09:44 +0000
commit4af79170e715adab02ddfe20f6155f99159b2c70 (patch)
tree41b9743219d1e035fb7d9ae65f7386612bd2dea7 /src
parent41937f38622b98064ab526b6dfb5e7150b30ba96 (diff)
parent80133a6c6fc448de495f48ce53494f80c3f2b123 (diff)
Merge pull request #1 from shoebham/main
Fix bug that generated toc links weirdly
Diffstat (limited to 'src')
-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>