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

Custom header anchors #82

Merged
merged 3 commits into from
Feb 29, 2024
Merged

Custom header anchors #82

merged 3 commits into from
Feb 29, 2024

Conversation

rafapaezbas
Copy link
Contributor

@rafapaezbas rafapaezbas commented Feb 29, 2024

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.

@rafapaezbas rafapaezbas marked this pull request as ready for review February 29, 2024 11:01
@subashsn
Copy link
Contributor

Looks good, but suggest the code be reviewed by someone else on the team too as I don't have bg. on it yet.

Copy link
Contributor

@freeall freeall left a 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.

if (!opts.back) history.pushState({ pathname }, null, pathname)
await element.load(page, opts)

if (pathname.startsWith('/documentation') && !!opts.header) {
Copy link
Contributor

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.

const elementY = Math.floor(element.getBoundingClientRect().y)
const headerHeight = 170
const extraScroll = 80
if (elementY < headerHeight + extraScroll) {
Copy link
Contributor

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?

@rafapaezbas rafapaezbas merged commit 1c7a120 into main Feb 29, 2024
5 checks passed
@rafapaezbas rafapaezbas deleted the custom-header-anchors branch February 29, 2024 16:56
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.

3 participants