-
Notifications
You must be signed in to change notification settings - Fork 19
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
Custom header anchors #82
Conversation
5f5cd4d
to
206d193
Compare
206d193
to
e7f7544
Compare
Looks good, but suggest the code be reviewed by someone else on the team too as I don't have bg. on it yet. |
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.
A couple of things I wasn't sure of what does.
lib/app-router.js
Outdated
if (!opts.back) history.pushState({ pathname }, null, pathname) | ||
await element.load(page, opts) | ||
|
||
if (pathname.startsWith('/documentation') && !!opts.header) { |
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.
Could you name this guard similar to if (isDocumentationPage)
? A little unclear to me what this checks.
lib/app-router.js
Outdated
const elementY = Math.floor(element.getBoundingClientRect().y) | ||
const headerHeight = 170 | ||
const extraScroll = 80 | ||
if (elementY < headerHeight + extraScroll) { |
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.
Similar to this check, could you name this?
b135fe9
to
e9b9505
Compare
This PR implements custom header ids in Marked using https://github.com/markedjs/marked-custom-heading-id, adds the header ids, corrects the indexes and implements the anchor navigation in pear-desktop-app.