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

Support anchor links #302

Closed
AndersDJohnson opened this issue May 30, 2016 · 7 comments
Closed

Support anchor links #302

AndersDJohnson opened this issue May 30, 2016 · 7 comments

Comments

@AndersDJohnson
Copy link
Contributor

AndersDJohnson commented May 30, 2016

Support anchor/hash links. Refer to remix-run/react-router#394 (comment) for a potential implementation to introduce to the Router in lib/utils/web-entry.js.

@KyleAMathews
Copy link
Contributor

Hey, this is an really interesting idea. My preference would be that it gets built-in to React Router. Failing that (or in the meantime), my preference would be we add a hook to Gatsby so you can add support for this in userspace though perhaps it's innocuous enough that we ship it to everyone.

AndersDJohnson pushed a commit to AndersDJohnson/gatsby that referenced this issue Jun 10, 2016
@AndersDJohnson
Copy link
Contributor Author

@KyleAMathews See my PR #321.

@AndersDJohnson
Copy link
Contributor Author

AndersDJohnson commented Jun 12, 2016

FYI I've published to npm a solution based on remix-run/react-router#394 (comment) as a standalone module called anchorate.

@KyleAMathews
Copy link
Contributor

@adjohnson916 anchorate looks cool. Perhaps even include it by default in at least the documentation starter as being able to link to headers is a feature people expect from using Github, etc.

We'd also need to add a header-id plugin for markdown-it. Do you use Markdown-it? Is there a plugin you'd recommend?

@MoOx
Copy link

MoOx commented Jun 13, 2016

I did that if this can help https://github.com/MoOx/markdown-it-toc-and-anchor but this days I use remark as the AST approach is simpler for my brain.

@KyleAMathews
Copy link
Contributor

@MoOx looks good! Thanks for the pointer.

Good to know re: Remark vs Markdown-It. I don't really like that Gatsby hard-codes Markdown-It. I want to split Gatsby core soon into plugins so it'll be easy to swap in and out Markdown renders (as one example).

Also https://github.com/wooorm/remark-lint looks cool.

@AndersDJohnson
Copy link
Contributor Author

For ideas on anchors with markdown-it, see markdown-it/markdown-it#28.

Also consider https://github.com/bryanbraun/anchorjs that generates anchors with client-side JS, to which I recently added npm support.

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

3 participants