Skip to content

Commit

Permalink
RemoteContent is picking up the next to last line incorrectly. (#2885)
Browse files Browse the repository at this point in the history
We should remove any comments on the next to last line, otherwise it will comment out anything below the remote content call incorrectly.

See https://fusionauth.io/docs/sdks/react-sdk

It should include a "Source Code" section per https://github.com/FusionAuth/fusionauth-site/blob/master/astro/src/content/docs/sdks/react-sdk.mdx

But it doesn't.
  • Loading branch information
mooreds authored Feb 9, 2024
1 parent bc484c3 commit 979ffb3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion astro/src/components/RemoteContent.astro
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,16 @@ function selectTagged(content: string, tags: string): string {
const lines = content.split("\n");
const startLine = lines.findIndex((line) => line.includes(`tag::${tags}`));
const endLine = lines.findIndex((line) => line.includes(`end::${tags}`));
const endLine = lines.findIndex((line) => line.includes(`end::${tags}`))
// remove trailing multi-line HTML comment
if (startLine < lines.length - 1) {
lines[startLine + 1] = lines[startLine + 1].replace('-->', '');
}
// remove preceding multi-line HTML comment
lines[endLine-1] = lines[endLine-1].replace('<!--', '');
return lines.slice(startLine + 1, endLine).join("\n").replace(/\s+$/g, '');
}
Expand Down

0 comments on commit 979ffb3

Please sign in to comment.