Skip to content
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

Fix: Docusaurus Edit URL is broken #3487

Merged
merged 1 commit into from
Jan 11, 2022

Conversation

abestel
Copy link

@abestel abestel commented Jan 11, 2022

According to the documentation of the plugin-content-docs, the actual URL used is computed by editUrl + relativeDocPath.

When using a string value for the editUrl, then the edit URL is editUrl + target/docs + docPath (in your case).
The target/docs is added automatically - but not needed.

Again, according to the documentation, is is possible to use a function instead of a plain string for the editUrl, and this is what this change is all about: docusaurus now ignores the target/docs to construct the path.

According to the documentation of the [plugin-content-docs](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-docs#editUrl),
the actual URL used is `computed by editUrl + relativeDocPath.`

When using a string value for the editUrl, then the edit URL is `editUrl` + `target/docs` + `docPath` in your case.
The `target/docs` is added but not needed.

Again, according to the [documentation](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-docs#ex-config), is is possible
to use a function instead of a plan string for the `editUrl`, and this is what this change is all about: docusaurus now ignored the `target/docs` to construct the path.
@kpodsiad
Copy link
Member

Thanks @abestel for this fix! I checked in on my machine and it works!

@tgodzik This PR doesn't need green CI, it can be merged right now.

@tgodzik tgodzik merged commit 5d069d1 into scalameta:main Jan 11, 2022
@ckipp01
Copy link
Member

ckipp01 commented Jan 11, 2022

I was actually trying to test this and realized I can't actually run docs/run anymore. Did you have any issues with this @kpodsiad ?

[info] running docs.Docs
Exception in thread "sbt-bg-threads-1" java.lang.NoSuchMethodError: pprint.TPrint$.make(Lscala/Function1;)Lpprint/TPrint;
        at mdoc.internal.cli.Settings$.<init>(Settings.scala:303)
        at mdoc.internal.cli.Settings$.<clinit>(Settings.scala)
        at mdoc.MainSettings$.apply(MainSettings.scala:122)
        at mdoc.MainSettings$.apply(MainSettings.scala:127)
        at docs.Docs$.main(Docs.scala:59)
        at docs.Docs.main(Docs.scala)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at sbt.Run.invokeMain(Run.scala:143)
        at sbt.Run.execute$1(Run.scala:93)
        at sbt.Run.$anonfun$runWithLoader$5(Run.scala:120)
        at sbt.Run$.executeSuccess(Run.scala:186)
        at sbt.Run.runWithLoader(Run.scala:120)
        at sbt.Defaults$.$anonfun$bgRunTask$6(Defaults.scala:1983)
        at sbt.Defaults$.$anonfun$termWrapper$2(Defaults.scala:1922)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at scala.util.Try$.apply(Try.scala:213)
        at sbt.internal.BackgroundThreadPool$BackgroundRunnable.run(DefaultBackgroundJobService.scala:369)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

@tgodzik
Copy link
Contributor

tgodzik commented Jan 11, 2022

Waaait, this an error that pops up with pprint 0.7.1. I am fixing it in scalameta/metaconfig#151

It's not related to this PR, but I have no idea why this works currently :O

@tgodzik
Copy link
Contributor

tgodzik commented Jan 11, 2022

Could you try setting dependencyOverrides for pprint to set it to 0.6.x in docs @ckipp01 ?

@kpodsiad
Copy link
Member

@ckipp01 oh shoot you're right, I didn't spot this :/

@abestel abestel deleted the fix/docusaurus_edit_url branch January 11, 2022 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants