| 82 | } |
| 83 | |
| 84 | function formatContent(content) { |
| 85 | const removeContentRegex = /<!--.*stripFromDocsSTART((.|\n)*?END.*-->)/g |
| 86 | const mdMagicRegex = /<!--.*AUTO-GENERATED-CONTENT:START((.|\n)*?END.*-->)/g |
| 87 | |
| 88 | return content |
| 89 | // Remove first h1 |
| 90 | .replace(/^#(.*)/m, '') |
| 91 | // remove blocks |
| 92 | .replace(removeContentRegex, '') |
| 93 | // remove redudant view docs link |
| 94 | .replace(/\[View the docs\]\(.*\)\.?/, '') |
| 95 | .replace(/For more information \[see the docs\]\(.*\)\.?/, '') |
| 96 | // remove md magic blocks |
| 97 | // .replace(mdMagicRegex, '') |
| 98 | .replace('<!--', '---') |
| 99 | .replace('-->', '---') |
| 100 | // Replace multiple blank lines |
| 101 | .replace(/^\s*\n/gm, '\n') |
| 102 | } |
| 103 | |
| 104 | function removeGithubSpecificContent(content) { |
| 105 | const docLinkRegex = /<!--.*stripFromDocsSTART((.|\n)*?END.*-->)/g |