Always apply GitHub markdown re-formatting features to all objects with markdown
This issue came out of this comment #478851 (comment 2225729213).
Current situation
We have a fragmented approach to re-formatting markdown from GitHub before we import it, which is causing some inconsistencies.
We do two kinds of re-formatting of GitHub markdown:
- Convert full links to the GitHub issues or PRs to full links to the GitLab issues or MRs within
MarkdownText.convert_ref_links. - Convert user mentions to backticks within
UsernameMentionRewriter#wrap_mentions_in_backticks
The conversions are both just pure string matching.
But we don't apply both of these in all places where we import objects that have GitHub markdown:
| Conversion | Code | Issues | MRs | Notes | Diff notes | Releases | Milestones |
|---|---|---|---|---|---|---|---|
| Convert full links to the GitHub issues or PRs to full links to the GitLab issues or MRs | MarkdownText.convert_ref_links |
||||||
| Convert user mentions to backticks | UsernameMentionRewriter#wrap_mentions_in_backticks |
Note, we're ignoring the Created by annotations when we didn't map to a user on GitLab, because we'll be removing that soon because of user contribution mapping.
Proposal
- Have a single method that does those conversions. (This might be just extending the existing
Gitlab::GithubImport::MarkdownText#format) - Use that method wherever we import GitHub markdown (see the above table as a starter, but double-check there are not more places).
Edited by Luke Duncalfe