markdown link anchor issue #1691

Closed
opened 2025-11-02 04:09:45 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @tst2005 on GitHub (Apr 11, 2018).

Description

A markdown link with anchor is rendered as a html URL page%23anchor instead of page#anchor.
On https://try.gitea.io/g/test-anchor-bug/src/branch/master/README.md
the link to "foo.md#bar" is
https://try.gitea.io/g/test-anchor-bug/src/branch/master/foo.md%23bar
but should be
https://try.gitea.io/g/test-anchor-bug/src/branch/master/foo.md#bar

The README.md content:

# test-anchor-bug

* [link bug 1](foo.md#bar)
* [link bug 2][bug2]

[bug2]: foo.md#bar

Screenshots

Screenshot is not usefull.

Originally created by @tst2005 on GitHub (Apr 11, 2018). - Gitea version (or commit ref): 1.4.0 - Git version: *not related* - Operating system: *not related* - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes https://try.gitea.io/g/test-anchor-bug/src/branch/master/README.md - [ ] No - [ ] Not relevant - Log gist: ## Description A markdown link with anchor is rendered as a html URL `page%23anchor` instead of `page#anchor`. On https://try.gitea.io/g/test-anchor-bug/src/branch/master/README.md the link to "foo.md#bar" is https://try.gitea.io/g/test-anchor-bug/src/branch/master/foo.md%23bar but should be https://try.gitea.io/g/test-anchor-bug/src/branch/master/foo.md#bar The README.md content: ``` # test-anchor-bug * [link bug 1](foo.md#bar) * [link bug 2][bug2] [bug2]: foo.md#bar ``` ## Screenshots Screenshot is not usefull.
GiteaMirror added the type/bug label 2025-11-02 04:09:45 -06:00
Author
Owner

@tst2005 commented on GitHub (Apr 11, 2018):

FYI,

I'm using nginx as frontal and gitea as backend.
My current workaround for this bug is:

server {
   server_name my.domain.tld;
   location /gitea/ {
      # workaround about markdown anchor issue
      if ($request_uri ~ ^(/.*\.md)%23(.*)$ ) { return 301 $scheme://$server_name$1#$2; }
      # end of workaround
      proxy_pass http://localhost:3000/;
   }
}
@tst2005 commented on GitHub (Apr 11, 2018): FYI, I'm using nginx as frontal and gitea as backend. My current workaround for this bug is: ```nginx server { server_name my.domain.tld; location /gitea/ { # workaround about markdown anchor issue if ($request_uri ~ ^(/.*\.md)%23(.*)$ ) { return 301 $scheme://$server_name$1#$2; } # end of workaround proxy_pass http://localhost:3000/; } } ```
Author
Owner

@ncantelmo commented on GitHub (May 23, 2018):

Just ran into this after generating some API docs in markdown. Basically all the relative links with anchors are broken.

@ncantelmo commented on GitHub (May 23, 2018): Just ran into this after generating some API docs in markdown. Basically all the relative links with anchors are broken.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1691