-
Notifications
You must be signed in to change notification settings - Fork 99
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
render readme html scrapped via the server #781
Conversation
how do we handle if readme has been updated by the package maintainer? atm, readme will only rebuild on release of new build. |
added issues: or just do all correctly remotely which i prefer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢
// TODO: support gitlab too | ||
const changeSrcIfNeeded = (element: HTMLElement | Element) => { | ||
const src = element.getAttribute("src"); | ||
if (src?.startsWith("/")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this single condition will cover all the bases for relative URLs. I had found most examples of a relative path in the Openssl, lefthook, and xcodegen libraries. Among those three you get srcs like:
assets/imgs/foo.png
/assets/imgs/foo.png
./assets/imgs/foo.png
I had begun working on a remedy to this issue yesterday before the s3 solution was mentioned/implemented, and a regular expression covered the bases for relative paths we'd run in to in READMEs. Something like:
const isRelativePath = src?.match(/^[^\/]+\/[^\/].*$|^\/[^\/].*$/i)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: This regex could probably be simplified, as it covers conditions we won't likely run in to as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ryanml ill add that thank you, i missed out on that hehehe
DEMO: https://www.loom.com/share/71fab2e24ffe442da15102d62d76867c