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

Links to local #id don't work in html preview #9

Closed
kieferrm opened this issue May 11, 2016 · 2 comments
Closed

Links to local #id don't work in html preview #9

kieferrm opened this issue May 11, 2016 · 2 comments

Comments

@kieferrm
Copy link
Owner

kieferrm commented May 11, 2016

click don't work in the html preview even when section2 exists. This seems to be an issue with the webview.

@rebornix
Copy link
Collaborator

  1. markdown-it doesn't support header anchor, which means, there is no id set for headers. See issues here Header anchors [needs discussion] markdown-it/markdown-it#28 and the only workaround for now is adding plugins.
  2. Even if there is an anchor generated successfully, the default behavior of clicking #id (we call it bookmark) in an iframe inside a webview is opening the file again. So it will try to load file:///c%3A/Users/penlv/code/testmd/#synchronization, which is not accessible.
  3. We are checking if people are clicking on bookmarks by if (node.tagName === 'A' && node.href && node.href[0] !== '#') {, however, node.href contains file name, eg, file:///c%3A/Users/penlv/code/testmd/#synchronization, node.href[0] !== '#' is always true. The correct attribute we should check is node.hash per http://www.w3schools.com/jsref/prop_anchor_hash.asp
  4. scrollIntoView works here perfectly.

@kieferrm
Copy link
Owner Author

Resolved by commit kieferrm/vscode@521500a

rebornix added a commit that referenced this issue May 19, 2016
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

No branches or pull requests

2 participants