Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Add '?plain=1' to Permalinks on GitLab/GitHub for md files (#18241)

Peter Trippe95e1c9ae5bd
diff --git a/crates/git_hosting_providers/src/providers/github.rs b/crates/git_hosting_providers/src/providers/github.rs
index be46b51ddf7..77eaa80961e 100644
--- a/crates/git_hosting_providers/src/providers/github.rs
+++ b/crates/git_hosting_providers/src/providers/github.rs
@@ -145,6 +145,9 @@ impl GitHostingProvider for Github {
.base_url()
.join(&format!("{owner}/{repo}/blob/{sha}/{path}"))
.unwrap();
+ if path.ends_with(".md") {
+ permalink.set_query(Some("plain=1"));
+ }
permalink.set_fragment(
selection
.map(|selection| self.line_fragment(&selection))
diff --git a/crates/git_hosting_providers/src/providers/gitlab.rs b/crates/git_hosting_providers/src/providers/gitlab.rs
index ccb8a7280a2..36ee214cf9d 100644
--- a/crates/git_hosting_providers/src/providers/gitlab.rs
+++ b/crates/git_hosting_providers/src/providers/gitlab.rs
@@ -65,6 +65,9 @@ impl GitHostingProvider for Gitlab {
.base_url()
.join(&format!("{owner}/{repo}/-/blob/{sha}/{path}"))
.unwrap();
+ if path.ends_with(".md") {
+ permalink.set_query(Some("plain=1"));
+ }
permalink.set_fragment(
selection
.map(|selection| self.line_fragment(&selection))