relative link in README of monorepo


(Klaus Meinhardt) #1

What I Wanted to Do

When publishing @fimbul/mimir which is located in my monorepo in https://github.com/fimbullinter/wotan in subdirectory packages/mimir, I expect all relative links in README.md to be resolved relative to https://github.com/fimbullinter/wotan/blob/HEAD/packages/mimir/

What Happened Instead

Relative links are resolved relative to the repository root, so
https://github.com/fimbullinter/wotan/blob/HEAD/packages/mimir/docs/async-function-assignability.md becomes https://github.com/fimbullinter/wotan/blob/HEAD/docs/async-function-assignability.md

Reproduction Steps

git clone git@github.com:fimbullinter/wotan.git
cd wotan
cd packages/mimir
npm publish

Details

If I changed the repository URL in package.json to something like https://github.com/fimbullinter/wotan/blob/master/packages/mimir it still wouldn’t work. In that case marky-markdown would generate https://github.com/fimbullinter/wotan/blob/master/packages/mimir/blob/HEAD/docs/async-function-assignability.md

Maybe the logic for resolving relative links could take into account if /blob/<branch>/ is already present in the repo URL

Platform Info

$ npm --versions
6.4.1
$ node -p process.platform
Ubuntu 14.04.5 LTS