Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Merge requests
  • !6375

Merged
Created Feb 21, 2014 by Administrator@rootOwner

Blob and tree gfm links to anchors work.

  • Overview 1
  • Commits 1
  • Changes 7

Created by: cirosantilli

Fixes #6046 (closed) bug

Intended Behavior

When on a tree directory such as path/name/tree/branch/dir, in the rendered README.md:

[0]() | path/name/tree/branch/dir | current behavior. [1](#id) | path/name/tree/branch/dir#id | new. Before opened wiki. [2](file.md#id) | path/name/blob/branch/dir/file.md#id | new

When on a markdown blob such as path/name/blob/branch/dir/file.md:

[0]() | path/name/blob/branch/dir/file.md | current [1](#id) | path/name/blob/branch/dir/file.md#id | new [2](file2.md#id) | path/name/blob/branch/dir/file2.md#id | new

This differs slightly from GitHub behavior, in which [empty]() always points to a non existent URL.

I feel that this behavior makes more sense, because if "#a" points to the current file, then "" should too.

The following is the diff for the tests under spec/seed_project.tar.gz. Only the markdown branch was modified with a new commit added. Rationale is explianed on the comments under features/steps/project/project_markdown_render.rb and spec/factories.rb#project.

diff --git a/README.md b/README.md
index 7577fc5..96c09cf 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,11 @@
+This branch is meant to be used with for markdown tests.
+
+Do not rely on its commit message or SHA being constant.
+
# Welcome to GitLab [![build status](https://secure.travis-ci.org/gitlabhq/gitlabhq.png)](https://secure.travis-ci.org/gitlabhq/gitlabhq)

GitLab is a free project and repository management application

-
## Application details

* rails 3.1
@@ -53,3 +56,15 @@ Email

Want to help - send a pull request.
We'll accept good pull requests.
+
+# Links with IDs
+
+[empty]()
+
+[#id](#id)
+
+[/#id](/#id)
+
+[README.md#id](README.md#id)
+
+[d/README.md#id](db/README.md#id)
diff --git a/d/README.md b/d/README.md
new file mode 100644
index 0000000..78addd3
--- /dev/null
+++ b/d/README.md
@@ -0,0 +1,9 @@
+[empty]()
+
+[#id](#id)
+
+[/#id](/#id)
+
+[README.md#id](README.md#id)
+
+[d/README.md#id](db/README.md#id)
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: github/fork/booktree/link-with-id