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

handling of automatic <a> anchors with headers #8

Open
vapier opened this issue Jan 8, 2020 · 3 comments
Open

handling of automatic <a> anchors with headers #8

vapier opened this issue Jan 8, 2020 · 3 comments

Comments

@vapier
Copy link

vapier commented Jan 8, 2020

most common markdown renderers i'm familiar with automatically create anchors for # headers. there's no need to generate <a name=...> tags for them.

@mle86
Copy link
Owner

mle86 commented Jan 10, 2020

Yes, GitHub and most other Markdown renderers output sane anchors (such as “See Also: Chapter 5” → #see-also-chapter-5,
but I've seen renderers with a different output style (#seealsochapter5).

Since the script now supports links to anchors (.\" LINK-TO SECTION TITLE), the script needs to know the exact anchor name -- and the easiest way to accomplish that is to output them itself.

That may of course result in duplicate anchors but since they're both in the same position, that shouldn't be a problem.

@mle86
Copy link
Owner

mle86 commented Jan 10, 2020

(But I've noticed a related problem: sometimes different sections have the same name, such as “Examples” sub-sections. Those should of course get different anchor names. GitHub's renderer uses #examples-1 anchors in these cases. But implementing something similar in my script would be rather complicated right now as there's no way to reference a section other than by its exact title.)

@vapier
Copy link
Author

vapier commented Jan 11, 2020

the lack of standardization in automatic anchor link generation is a great point as a generalized tool. maybe for people who only ever target one renderer could have an option to skip the automatic generation ? that way you could put a comment in noting the lack of standardization which is why the are created in the first place.

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