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

Markdown URLs generated from Headings are different, as on GitHub #1351

Closed
NonSwag opened this issue May 1, 2024 · 2 comments
Closed

Markdown URLs generated from Headings are different, as on GitHub #1351

NonSwag opened this issue May 1, 2024 · 2 comments
Labels
1. feature New feature or request 2. frontend This issue/pr relates to an issue/change on the frontend

Comments

@NonSwag
Copy link

NonSwag commented May 1, 2024

Observed/problematic behavior

Hangar replaces some symbols used in URLs generated for headings different than GitHub.

I only noticed two characters so far:
/ and . on Hangar are replaced with - but completely stripped on GitHub

The problem with this is that for example TOCs (table of contents) do not work in some cases

Expected behavior

Would be nice if the Markdown format was consistent across GitHub and Hangar

Steps to reproduce

Create headings inside a markdown file containing / and or . on Hangar and GitHub
Create a TOC and try to use it.

Other

No response

@MiniDigger
Copy link
Member

Would be nice if the Markdown format was consistent

hahahhahaha

markdown sadly is extremely underspec'd and everybody implements it differently. there is no standard.
github doesnt document their impl, the original markdown spec (that nobody follows and was already underspec'd) doesn't even include section links, neither does the good (but different from gfm) commonmark spec.

I found a lib that does attempt to emulate githubs slug parsing and used that to generate headings instead: https://github.com/Flet/github-slugger

while at it, also added a toc section.

@MiniDigger MiniDigger added 1. feature New feature or request 2. frontend This issue/pr relates to an issue/change on the frontend labels May 4, 2024
@github-project-automation github-project-automation bot moved this from New to ✅ Done in Hangar Roadmap May 4, 2024
@NonSwag
Copy link
Author

NonSwag commented May 4, 2024

thanks for the hard work 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. feature New feature or request 2. frontend This issue/pr relates to an issue/change on the frontend
Projects
Status: Done
Development

No branches or pull requests

2 participants