Comments (2)
Hi! This is because by default markdown-it-anchor sets the href
of the title anchor to #slug
, meaning that if your slug is ji-chu-yong-fa
, the href
will be #ji-chu-yong-fa
. The browser will then replace the whole anchor part of the URL, losing the /components/srclock
part.
This is the default way of browsers to link to a specific element of the page. If you use the anchor part of the URL for internal navigation purpose, you can't use anchors to link to specific element of the page, and you would need to re-implement this behavior yourself.
For example, you could can pass a custom permalinkHref
function that would keep the /components/srclock
par of the URL and append the slug to it, so you would end up with something like #/components/srclock#ji-chu-yong-fa
. It's then your responsibility to have some code parsing the location.hash
to extract the ji-chu-yong-fa
part at the end and make the browser scroll tho the element that have this ID.
from markdown-it-anchor.
@valeriangalliat is right, it's not an issue. The solution involves passing a custom permalinkHref
.
from markdown-it-anchor.
Related Issues (20)
- Add container around heading and anchor HOT 3
- Expose custom options regardless of permalink styles HOT 4
- Headings containing a hashtag yield invalid hrefs HOT 2
- Headers in html_block Tokens aren't given slugs HOT 11
- Add <span> inside permalink.headerLink style until safari reader more is fixed HOT 1
- incorrect type for permalink.headerLink() HOT 2
- Feature request: container option for linkAfterHeader HOT 5
- KaTeX Expressions aren't Included in Headings HOT 4
- Should return type for `PermalinkGenerator` be `void` instead of `string`? HOT 1
- Missing `wrapper` property in `LinkAfterHeaderPermalinkOptions` type HOT 1
- Add brief description of what plugin does to top of readme. HOT 1
- Types invalid with `"type": "module"` and `"moduleResolution": "Node16"` HOT 7
- @types in peerDeps HOT 2
- TypeError: c.attrGet is not a function HOT 1
- Missing #todo-anchor-or-file header in README HOT 1
- Exception 'plugin.apply is not a function' HOT 2
- Issue with linkAfterHeader
- Update typescript types HOT 1
- styleOfPermalinks is not a function HOT 2
- Advice for keeping permalink symbol token stable HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from markdown-it-anchor.