Skip to content

Commit cf429de

Browse files
Update how links are resolved
1 parent a239277 commit cf429de

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

packages/cursorless-org-docs/docusaurus.config.mts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import { fileURLToPath } from "node:url";
99

1010
const require = createRequire(import.meta.url);
1111

12+
const userRelative = "packages/cursorless-org-docs/src/docs/user";
13+
const contributingRelative =
14+
"packages/cursorless-org-docs/src/docs/contributing";
15+
1216
/**
1317
* Files within /docs reference repository directories
1418
* and files outside of that folder. They are not served
@@ -41,12 +45,19 @@ function remarkPluginFixLinksToRepositoryArtifacts(): Transformer<Root> {
4145
dirname(fileURLToPath(import.meta.url)),
4246
"../..",
4347
);
48+
4449
const artifact = resolve(file.dirname!, url);
4550
const artifactRelative = relative(repoRoot, artifact).replace(/\\/g, "/");
51+
const fileRelative = relative(repoRoot, file.path).replace(/\\/g, "/");
4652

47-
// We host all files under docs, will resolve as a relative link
53+
// We host all files under docs, will resolve as a relative link, but
54+
// relative links passing between user and contributing are not resolved
55+
// correctly
4856
if (
49-
artifactRelative.startsWith("packages/cursorless-org-docs/src/docs/")
57+
(artifactRelative.startsWith(userRelative) &&
58+
fileRelative.startsWith(userRelative)) ||
59+
(artifactRelative.startsWith(contributingRelative) &&
60+
fileRelative.startsWith(contributingRelative))
5061
) {
5162
return;
5263
}

packages/cursorless-org-docs/src/docs/contributing/adding-a-new-language.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Follow the instructions in [Adding a new scope](./adding-a-new-scope.md) to defi
4141

4242
## 5. Document your language
4343

44-
Create a `.mdx` file in [`languages`](../../user/languages) with the `Language` react component. The file should be named after your language, eg `java.mdx`
44+
Create a `.mdx` file in [`languages`](../user/languages) with the `Language` react component. The file should be named after your language, eg `java.mdx`
4545

4646
```md
4747
import { Language } from "./components/Language";

packages/cursorless-org-docs/src/docs/contributing/architecture/neovim-test-infrastructure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ cursorless.nvim/.busted
300300
### Running lua unit tests
301301
302302
Many of the cursorless.nvim lua functions are run in order to complete Cursorless actions and so are already
303-
indirectly tested by the tests described in the [previous section](#3-cursorless-tests-for-neovim). Nevertheless, we run
303+
indirectly tested by the tests described in the [previous section](#running-neovim-tests-locally). Nevertheless, we run
304304
more specific unit tests in order to give better visibility into exactly which functions are failing.
305305
The [busted](https://github.com/lunarmodules/busted) framework is used to test lua functions defined in cursorless.nvim.
306306
This relies on a `cursorless.nvim/.busted` file which directs busted to use a lua interpreter and test specifications files:

0 commit comments

Comments
 (0)