Skip to content

Commit

Permalink
Merge pull request #21 from UmbrellaDocs/baseUrl-fix
Browse files Browse the repository at this point in the history
Fix baseUrl variable name
  • Loading branch information
gaurav-nelson authored Jan 26, 2024
2 parents 43c2afb + 230a2fb commit 520985c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/extract-markdown-hyperlinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import { visit } from "unist-util-visit";
// options (optional) - An object specifying additional settings
// - ignorePatterns (optional) - An array of objects holding regular expressions to skip link checking
// - replacementPatterns (optional) - An array of objects holding regular expressions for link replacements
// - baseURL (optional) - A string specifying the base URL to prefix to URLs that start with '/'
// - baseUrl (optional) - A string specifying the base URL to prefix to URLs that start with '/'
// Returns:
// An array of MDAST nodes that represent headings, links, link references, definitions, and image references
// See https://github.com/syntax-tree/mdast for more information on the types of MDAST nodes
//

function extractMarkdownHyperlinks(markdownText, options = {}) {
const { ignorePatterns = [], replacementPatterns = [], baseURL } = options;
const { ignorePatterns = [], replacementPatterns = [], baseUrl } = options;
const tree = unified()
.use(remarkParse)
.use(remarkGfm)
Expand All @@ -36,8 +36,8 @@ function extractMarkdownHyperlinks(markdownText, options = {}) {
}

// Prefix the base URL to URLs that start with '/'
if (baseURL && url.startsWith('/')) {
url = baseURL + url;
if (baseUrl && url.startsWith('/')) {
url = baseUrl + url;
}

// Replace link URL based on replacement patterns
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umbrelladocs/linkspector",
"version": "0.2.6",
"version": "0.2.7",
"description": "Uncover broken links in your content.",
"type": "module",
"main": "linkspector.js",
Expand Down

0 comments on commit 520985c

Please sign in to comment.