r-lib / downlit

Syntax Highlighting and Automatic Linking
https://downlit.r-lib.org
Other
90 stars 22 forks source link

Look for metadata in package-local pkgdown.yml #29

Closed strazto closed 4 years ago

strazto commented 4 years ago

Migrated from https://github.com/r-lib/pkgdown/issues/1366

Previously named: Private (Enterprise Hosted) packages not autolinking due to requirement to sign-in

Hi there.

My organization hosts an instance of GH enterprise.

The Process

The current trajectory for autolinking is as follows (correct me if I'm wrong)

Read URL from package DESCRIPTION, for example:

URL: https://pages.github.sydney.edu.au/speed-extract/mandrake/

Resolve {url}/pkgdown.yml , use the links given here to help configure autolinking.

For example, DESCRIPTION$URL gives:

https://pages.github.sydney.edu.au/speed-extract/mandrake/pkgdown.yml

pandoc: '2.10'
pkgdown: 1.5.1.9000
pkgdown_sha: ~
articles: []
last_built: 2020-07-22T05:05Z
urls:
  reference: https://pages.github.sydney.edu.au/speed-extract/mandrake//reference
  article: https://pages.github.sydney.edu.au/speed-extract/mandrake//articles

pkgdown figures out the rest.

The problem with this process and enterprise hosted repos

This would be great, however, you will find that if you click on https://pages.github.sydney.edu.au/speed-extract/mandrake/pkgdown.yml

you will be given a challenge-response asking you to sign in.

curl says:

curl -I "https://pages.github.sydney.edu.au/speed-extract/mandrake/pkgdown.yml"
HTTP/1.1 302 Moved Temporarily
Server: GitHub.com
Date: Wed, 22 Jul 2020 06:27:49 GMT
Content-Type: text/html
Content-Length: 138
Location: https://github.sydney.edu.au/sessions/_auth_request_bounce?return_to=https%3A%2F%2Fpages.github.sydney.edu.au%2Fspeed-extract%2Fmandrake%2Fpkgdown.ym

So, pkgdown is never going to resolve those links.

Potential Fixes / Accomodations

I wonder, then, whether there are other ways pkgdown could accomodate linking enterprise hosted packages. A few jump out:

These fall-backs might allow a best-effort linking for package's whose description$url field cannot be resolved publicly. I personally don't see too much harm in building a pkgdown.yml into installed R packages, so I think this could accomodate those of us who can't host all of our work publically.

Cheers!