Add '?plain=1' to Permalinks on GitLab/GitHub for md files (#18241)
Improve our Permalinks to markdown files. GitHub/GitLab supports the same URL syntax.
This commit is contained in:
parent
1ff10b71c8
commit
e95e1c9ae5
2 changed files with 6 additions and 0 deletions
|
@ -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))
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue