-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[gatsby-theme-docz] Using Standard Markdown Anchor Tag Syntax [LinkName](http://url.com) Breaks Gatsby Build #832
Comments
Hey @AryanJ-NYC ! 👋🏼 I believe this is happening because const docs = useDocs();
if (typeof window === 'undefined') return
const toCheck = useMemo(() => [
// the rest of your code... Let me know if that fixes it! |
Hey @jsjoeio! Appreciate the feedback. I've tried to fix that in All those potential fixes lead to the same error message:
|
Hmm...that's strange. Okay I'll see if I can reproduce this later with the repo you provided and hopefully we can figure out a fix. |
After some investigating, I think your issue is valid. I believe this error stems from the I wonder if it would be as "easy" as changing this: const docs = useDocs()
const toCheck = useMemo(
() =>
[
location.pathname
.split(separator)
.slice(0, -1)
.join(separator)
.slice(1),
(href || '').replace(/^(?:\.\/)+/gi, ''),
].join('/'),
[separator]
) to this: const docs = useDocs()
const toCheck = useMemo(
() => {
if (typeof window === 'undefined') return
return [
location.pathname
.split(separator)
.slice(0, -1)
.join(separator)
.slice(1),
(href || '').replace(/^(?:\.\/)+/gi, ''),
].join('/'),
[separator]
}
) |
@jsjoeio Made your proposed change in
Hopefully some weekday help tomorrow will lead us to finding the fix. |
Ah, bummer. Yeah, hopefully we can get someone who knows more to help us figure this out! |
I updated
Anyone? |
check environment before using global `location` variable in link component fixes doczjs#832
check environment before using global `location` variable in link component fixes doczjs#832
@jsjoeio Now that gatsbyjs/gatsby#13641 is fixed, your suggested fix at #832 (comment) works. Thanks! |
check environment before using global `location` variable in link component fixes doczjs#832
@AryanJ-NYC awesome! Glad to that fixed it 🙌🏼 |
check environment before using global `location` variable in link component fixes #832
check environment before using global `location` variable in link component fixes #832
Bug Report
Describe the bug
Running
gatsby build
when using standard Markdown anchor tag syntax throws an error:To Reproduce
git clone https://github.com/AryanJ-NYC/docz-theme-example
cd docz-theme-example
npm i && gatsby build
Expected behavior
Lack of error. Please note that
gatsby develop
works fine.Environment
The text was updated successfully, but these errors were encountered: