Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
Get the test to pass
Browse files Browse the repository at this point in the history
  • Loading branch information
ptgott committed Nov 1, 2023
1 parent 950f626 commit 0e4352f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 8 additions & 2 deletions server/remark-includes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,14 @@ const handleURLPath = (
) {
const href = node.url;

// Ignore non-strings, absolute paths, or web URLs
if (typeof href !== "string" || href[0] === "/" || /^http/.test(href)) {
// Ignore non-strings, absolute paths, web URLs, and links consisting only
// of anchors (these will end up pointing to the containing page).
if (
typeof href !== "string" ||
href[0] === "/" ||
/^http/.test(href) ||
href[0] === "#"
) {
return href;
}

Expand Down
3 changes: 2 additions & 1 deletion uvu-tests/remark-includes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,8 @@ This is a [link to an anchor](#this-is-a-section).
## This is a section.
This is content within the section.`
This is content within the section.
`
);
}
);
Expand Down

0 comments on commit 0e4352f

Please sign in to comment.