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

Hash change docs #1168

Merged
merged 5 commits into from Mar 27, 2018
Merged

Hash change docs #1168

merged 5 commits into from Mar 27, 2018

Conversation

UziTech
Copy link
Member

@UziTech UziTech commented Mar 27, 2018

Marked version: 0.3.19

Markdown flavor: Markdown.pl|CommonMark|GitHub Flavored Markdown|n/a

Description

Contributor

  • Test(s) exist to ensure functionality and minimize regresstion (if no tests added, list tests covering this PR); or,
  • no tests required for this PR.
  • If submitting new feature, it has been documented in the appropriate places.

Committer

In most cases, this should be a different person than the contributor.

  • Draft GitHub release notes have been updated.
  • CI is green (no forced merge required).
  • Merge PR

@UziTech
Copy link
Member Author

UziTech commented Mar 27, 2018

This seems to work with linking to specific sections of a .md file and with back and forward buttons

😃 👍

docs/index.html Outdated
if(currentHash) {
var hashElement = document.getElementById(currentHash);
if (hashElement) {
hashElement.scrollIntoView();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change hashElement.scrollIntoView(); to hashElement.scrollIntoView({ behavior: 'smooth' }); for a buttery transition ⛷️

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem to work very well.

screenshot

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It worked correctly when you clicked "supported specifications" because that was the only time it hit the scrollIntoView() function as far as I can tell.

@@ -25,15 +25,15 @@ The following table lists the ticket type labels we use when there is work to be
|Ticket type label |Description |
|:----------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|L0 - security |A security vulnerability within the Marked library is discovered. |
|L1 - broken |Valid usage results in incorrect output compared to [supported specifications](README.md#specifications) OR causes marked to crash AND there is no known workaround for the issue. |
|L1 - broken |Valid usage results in incorrect output compared to [supported specifications](#README.md#specifications) OR causes marked to crash AND there is no known workaround for the issue. |
Copy link
Member

@styfle styfle Mar 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think the urls to md files should being with a slash #/README.md#specifications.
This is a common pattern for js routers so that you know its linking to a different route and not a normal anchor on the page. Thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We determine whether it is a route or anchor by the existence of /.md$/ but we could change it to /^\\/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also realized, we can use #/README and drop the .md altogether which will read a little bit better.

@styfle styfle added the category: docs Documentation changes label Mar 27, 2018
@styfle
Copy link
Member

styfle commented Mar 27, 2018

@joshbruce Any objections to this?

Copy link
Member

@joshbruce joshbruce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would really like to consider an alternative to the SPA and using the hash for anything other than inline anchors.

@styfle styfle merged commit 8489411 into markedjs:master Mar 27, 2018
@vsemozhetbyt
Copy link
Contributor

vsemozhetbyt commented Mar 28, 2018

There are still some issues after this fix:

  1. Hash link navigation into new tabs works only from the main page.
  1. History back navigation does not remember the scrolled space.

@UziTech UziTech deleted the hash-change-docs branch April 5, 2018 14:39
zhenalexfan pushed a commit to zhenalexfan/MarkdownHan that referenced this pull request Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: docs Documentation changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants