| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5cfc547 commit 75ff8e6
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -73,10 +73,14 @@ function processContent(content) { | |||
| 73 | 73 | } | |
| 74 | 74 | // `++level` to convert the string to a number and increment it. | |
| 75 | 75 | content = content.replace(/(?<=<\/?h)[1-5](?=[^<>]*>)/g, (level) => ++level); | |
| 76 | - // Wrap h3 tags in section tags. | ||
| 76 | + // Wrap h3 tags in section tags unless they are immediately preceded by a | ||
| 77 | + // section tag. The latter happens when GFM footnotes are generated. We don't | ||
| 78 | + // want to add another section tag to the footnotes section at the end of the | ||
| 79 | + // document because that will result in an empty section element. While not an | ||
| 80 | + // HTML error, it's enough for validator.w3.org to print a warning. | ||
| 77 | 81 | let firstTime = true; | |
| 78 | 82 | return content | |
| 79 | - .replace(/<h3/g, (heading) => { | ||
| 83 | + .replace(/(?<!<section [^>]+>)<h3/g, (heading) => { | ||
| 80 | 84 | if (firstTime) { | |
| 81 | 85 | firstTime = false; | |
| 82 | 86 | return '<section>' + heading; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments