Add current_ref placeholder for markdown documentation
What does this MR do and why?
This MR adds a new %{current_ref} Markdown placeholder.
When the markdown_placeholders feature flag is enabled, %{current_ref} is replaced with the ref that the Markdown is being rendered for:
- Branch name when viewing a branch
- Tag name when viewing a tag
- Commit SHA when viewing a specific commit
This makes it easier to write documentation (for example, coverage badges) that always point to “the ref I’m currently looking at” without hard-coding a particular branch name.
References
How to set up and validate locally
-
In a Rails console, enable the feature flag:
Feature.enable(:markdown_placeholders) -
In any project, create an Markdown file and add a line such as:
Current ref: %{current_ref} -
View that Markdown on different refs:
- On the default branch.
- On another branch.
- On a tag.
- On a specific commit.
-
Confirm that:
- On a branch view,
%{current_ref}is replaced with that branch name. - On a tag view,
%{current_ref}is replaced with the tag name. - On a commit view,
%{current_ref}is replaced with the commit SHA.
- On a branch view,
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Kouta Kumagai