-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
links generated for sections with hyphens not working for Gitlab #36
Comments
Thanks @vser1 I'm using GitLab, too. I'll look into it, and consider if to add support for GitLab. You can reference how GitHub handles subsequent hyphens in anchors in https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/toc_filter.rb. If we are going to support GitLab, I think it's better to not combine GitHub and GitLab support code, even they are both called GFM. |
@mzlogin I've updated my bug report to remove the erroneous code and reference the github file. Thanks for your awesome script btw 👍 |
I think your solution can work, it seems that GitHub and GitLab shared most logic in generated anchors for headings except successive hyphens. So I'm going to add a command |
Oh oh... According to GitLab docs, it uses Redcarpet, maybe what I need to do is to enhancement Redcarpet supporting. 😄 Redcarpet take this rule https://docs.gitlab.com/ee/user/markdown.html#gitlab-flavored-markdown-gfm Update: sadly that most of my test cases for Redcarpet failure on GitLab. |
Indeed, misread this point about GitLab using redcarpet. I see on my test case two errors:
The GFM toc is correct, not the RedCarpet. I don't know RedCarpet's specification but I fear not being able to differentiate two headers with same name is a flaw of your implementation 😟 |
Yes. It's likely to be a problem. I used to support Redcarpet for Jekyll blog working with GitHub Pages, but last year, GitHub announced only support kramdown as Markdown engine for GitHub Pages, so I don't have Redcarpet test environment now. |
Since you do not support GitLab, my issue is mor a backlog for other users.
Since GitHub keeps hyphens and GitLab deletes them when converting a header to an anchor.
The following code is valid for GitHub but not for GitLab
To make it work, I had to add the following regex in
GetHeadingLinkGFM
(line 123):Maybe you could easily add support for GitLab too, rules to create header anchors are summarized here.
The file generating anchors for headers in GitHub is to be found here. I'm not proficient in ruby but I don't see anything about deleting successive hyphens.
The text was updated successfully, but these errors were encountered: