Skip to content

Commit

Permalink
link fix (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
rambleraptor authored Sep 11, 2024
1 parent e38ba86 commit fe5a589
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scripts/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,18 @@ function buildMarkdown(contents: string, folder: string): Markdown {
substituteCallouts(result);
substituteRuleIdentifiers(result);
removeTitle(result);
substituteLinks(result);
return result;
}

function substituteLinks(contents: Markdown) {
// Old site-generator expressed relative links as '[link]: ./0123'.
// These should be expressed as '[link]: /123'

contents.contents = contents.contents.replaceAll(']: ./', ']: /')
contents.contents = contents.contents.replaceAll(']: /0', ']: /')
}

function removeTitle(contents: Markdown) {
// Title should be removed because Starlight will add it for us.
contents.contents = contents.contents.replace(/# (.*)\n/, '');
Expand Down

0 comments on commit fe5a589

Please sign in to comment.