sillsdev / docu-notion

Download Notion pages as markdown and image files, preserving hierarchy and enabling workflow properties. Works with Docusaurus.
MIT License
151 stars 30 forks source link

[Problem]Link to page (to other page in Notion) leads to Broken Link Error #106

Open cirezd opened 3 months ago

cirezd commented 3 months ago

Describe the bug I embed a link like this:

image

This creates a relative link in markdown:

image

But docusaurus does not compile:

[15:31:20.367] [ERROR] Error: Unable to build website for locale en. [15:31:20.367] at tryToBuildLocale (/vercel/path0/nodemodules/.pnpm/@docusaurus+core@3.4.0@docusaurus+types@3.4.0_react-dom@18.3.1_react@18.3.1_typescript@5.2.2/node_modules/@docusaurus/core/lib/commands/build.js:54:19) [15:31:20.367] at async /vercel/path0/nodemodules/.pnpm/@docusaurus+core@3.4.0@docusaurus+types@3.4.0_react-dom@18.3.1_react@18.3.1_typescript@5.2.2/node_modules/@docusaurus/core/lib/commands/build.js:65:9 [15:31:20.368] at async mapAsyncSequential (/vercel/path0/nodemodules/.pnpm/@docusaurus+utils@3.4.0@docusaurus+types@3.4.0_typescript@5.2.2/node_modules/@docusaurus/utils/lib/jsUtils.js:20:24) [15:31:20.368] at async Command.build (/vercel/path0/nodemodules/.pnpm/@docusaurus+core@3.4.0@docusaurus+types@3.4.0_react-dom@18.3.1_react@18.3.1_typescript@5.2.2/node_modules/@docusaurus/core/lib/commands/build.js:63:5) { [15:31:20.368] [cause]: Error: Docusaurus found broken links! [15:31:20.368]
[15:31:20.368] Please check the pages of your site in the list below, and make sure you don't reference any path that does not exist. [15:31:20.368] Note: it's possible to ignore broken links with the 'onBrokenLinks' Docusaurus configuration, and let the build pass. [15:31:20.368]
[15:31:20.368] Exhaustive list of all broken links found: [15:31:20.368] - Broken link on source page path = /docs/how-to-embed: [15:31:20.368] -> linking to /settings [15:31:20.368]
[15:31:20.368] at throwError (/vercel/path0/node_modules/.pnpm/@docusaurus+logger@3.4.0/node_modules/@docusaurus/logger/lib/index.js:79:11) [15:31:20.368] at reportBrokenLinks (/vercel/path0/nodemodules/.pnpm/@docusaurus+core@3.4.0@docusaurus+types@3.4.0_react-dom@18.3.1_react@18.3.1_typescript@5.2.2/node_modules/@docusaurus/core/lib/server/brokenLinks.js:250:47) [15:31:20.368] at handleBrokenLinks (/vercel/path0/nodemodules/.pnpm/@docusaurus+core@3.4.0@docusaurus+types@3.4.0_react-dom@18.3.1_react@18.3.1_typescript@5.2.2/node_modules/@docusaurus/core/lib/server/brokenLinks.js:282:5) [15:31:20.368] at executeBrokenLinksCheck (/vercel/path0/nodemodules/.pnpm/@docusaurus+core@3.4.0@docusaurus+types@3.4.0_react-dom@18.3.1_react@18.3.1_typescript@5.2.2/node_modules/@docusaurus/core/lib/commands/build.js:200:47) [15:31:20.368] at /vercel/path0/nodemodules/.pnpm/@docusaurus+core@3.4.0@docusaurus+types@3.4.0_react-dom@18.3.1_react@18.3.1_typescript@5.2.2/node_modules/@docusaurus/core/lib/commands/build.js:146:66 [15:31:20.369] at Object.async (/vercel/path0/nodemodules/.pnpm/@docusaurus+core@3.4.0@docusaurus+types@3.4.0_react-dom@18.3.1_react@18.3.1_typescript@5.2.2/node_modules/@docusaurus/core/lib/utils.js:36:47) [15:31:20.369] at buildLocale (/vercel/path0/nodemodules/.pnpm/@docusaurus+core@3.4.0@docusaurus+types@3.4.0_react-dom@18.3.1_react@18.3.1_typescript@5.2.2/node_modules/@docusaurus/core/lib/commands/build.js:146:30) [15:31:20.369] at async tryToBuildLocale (/vercel/path0/nodemodules/.pnpm/@docusaurus+core@3.4.0@docusaurus+types@3.4.0_react-dom@18.3.1_react@18.3.1_typescript@5.2.2/node_modules/@docusaurus/core/lib/commands/build.js:47:13) [15:31:20.369] at async /vercel/path0/nodemodules/.pnpm/@docusaurus+core@3.4.0@docusaurus+types@3.4.0_react-dom@18.3.1_react@18.3.1_typescript@5.2.2/node_modules/@docusaurus/core/lib/commands/build.js:65:9 [15:31:20.370] at async mapAsyncSequential (/vercel/path0/nodemodules/.pnpm/@docusaurus+utils@3.4.0@docusaurus+types@3.4.0_typescript@5.2.2/node_modules/@docusaurus/utils/lib/jsUtils.js:20:24) [15:31:20.370] at async Command.build (/vercel/path0/nodemodules/.pnpm/@docusaurus+core@3.4.0@docusaurus+types@3.4.0_react-dom@18.3.1_react@18.3.1_typescript@5.2.2/node_modules/@docusaurus/core/lib/commands/build.js:63:5) [15:31:20.370] } [15:31:20.370] [INFO] Docusaurus version: 3.4.0 [15:31:20.370] Node version: v20.12.2 [15:31:20.391]  ELIFECYCLE  Command failed with exit code 1. [15:31:20.404] Error: Command "pnpm run build" exited with 1 [15:31:20.674]

Reproduction Steps

see above

Expected behavior Docusaurus should compile and relative link should work correctly.

Thanks!

andrew-polk commented 3 months ago

Is your screenshot of the markdown showing the output of docu-notion? If yes, it seems that docu-notion is creating the expected output. If this is not expected, what should it be?

Is your Navigator Settings page published?

cirezd commented 3 months ago

Is your screenshot of the markdown showing the output of docu-notion? If yes, it seems that docu-notion is creating the expected output. If this is not expected, what should it be?

Is your Navigator Settings page published?

Yes, the page is published and yes the output is from docu-notion. Shouldn't the relative link work and docusaurus compile? If I don't use Link to Page in Notion I must use Mention a Page, but for this the notion.so/hdjksandka links are not resolved. See https://github.com/sillsdev/docu-notion/issues/97

Thank you

andrew-polk commented 3 months ago

Could you please clarify what you expect the docu-notion output to be?

Note, there is a slight chance there is a difference due to using docusaurus v3. We have only tested docu-notion output with docusaurus v2 so far. But I highly doubt that the resolution of urls would have changed.

cirezd commented 3 months ago

I use docusaurus v3. I specifically decided on docusaurus as there is this nice docu-notion package ;)

The link should be /docs/settings. I use the docs prefix for the documentation since I have 'pages' as well. So docu-notion would need to look up whether there is a prefix defined in the docuraurus config. This is the issue I believe.

andrew-polk commented 3 months ago

I'm sorry I don't have time to look at this. We don't have anyone in our sphere using this for more than just docs at the moment, so it is true that could be the issue.

Note, I see in the docusaurus docs that they don't recommend making link paths based on (/docs/*). See https://docusaurus.io/docs/markdown-features/links.

Relative file paths are resolved against the current file's directory. Absolute file paths, on the other hand, are resolved relative to the content root, usually docs/, blog/, or localized ones like i18n/zh-Hans/plugin-content-docs/current.

Absolute file paths can also be relative to the site directory. However, beware that links that begin with /docs/ or /blog/ are not portable as you would need to manually update them if you create new doc versions or localize them.

You can write [links](/otherFolder/doc4.mdx) relative to the content root (`/docs/`).

You can also write [links](/docs/otherFolder/doc4.mdx) relative to the site directory, but it's not recommended.