-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
add maintainCase option #20
Conversation
Why would that be good? This project follows GH: they don’t do that. It’s also not how URLs work: |
This may be true for GitHub, but not on a page without JavaScript. This URL navigates to the correct section: https://remcohaszing.nl/blog/creating-a-typescript-package#tsconfigjson. This URL does not: https://remcohaszing.nl/blog/creating-a-typescript-package#tsconfigjsoN. Apart from that I agree with the points made by @wooorm. It is notable that the option exists in |
the option was just always there, from the start |
Hi, without going too much deeper into my particular use case. I come up with this change because I'm migrating my personal blog from Hexo to Next.js + remark + rehype. I need to keep compatibility between two version and Hexo is generating the heading id maintaining the case. I can confirm also that result from @remcohaszing that by default browser behaviour is URL is case sensitive without additional scripting, that is why I need make this change. I fork this repo with corresponding change because I need it, but I think some other people will need same functionality as well. I haven't found there is any standard that specify markdown genereted HTML need to have heading id in lower case. So I think giving this flexibity to the user is important. |
I also plan to make the same change for https://github.com/remarkjs/remark-toc and https://github.com/syntax-tree/mdast-util-toc to have consistent behaviour between them. |
this is how Hexo is generating heading id https://github.com/hexojs/hexo-renderer-marked/blob/b457f4717c28985effe9b7b7af3f8fb4b358a603/lib/renderer.js#L14, it is case sensitive. |
While I understand your predicament, it is not of interest for this project to follow how Hexo does things. Or other arbitrary tools. Letter case is only one part, there will be many other differences. Instead, it is recommended to follow how GH does things. You markdown files seem to be on GH. Following how GH means: There are some alternatives:
|
This comment has been minimized.
This comment has been minimized.
Hi, I don't understand the philosophy of closing this pull request with "won't fix".
Github doesn't support prefix neither, why we have this option?
My change is not copying how Hexo is generating the heading id, I'm just asking the GithubSlugger to keep the same case as original it is. This option exist in https://github.com/Flet/github-slugger why we don't want to have for this plugin? Anything that is useful for the users without complicating the code structure should be good to have. The change is also backward compatible. |
GH uses prefixes. I am against GH slugger having that option. It is intentional that people make their own plugins. |
Initial checklist
Description of changes
add maintainCase option to allow the heading to be consistent with original case of heading title