diff --git a/readme.md b/readme.md
index 837ad21e..c6e08c87 100644
--- a/readme.md
+++ b/readme.md
@@ -269,11 +269,13 @@ namespace MarkdownSnippets
public enum LinkFormat
{
GitHub,
- Tfs
+ Tfs,
+ Bitbucket,
+ GitLab
}
}
```
-[snippet source](/src/MarkdownSnippets/Processing/LinkFormat.cs#L1-L8) / [anchor](#snippet-LinkFormat.cs)
+[snippet source](/src/MarkdownSnippets/Processing/LinkFormat.cs#L1-L10) / [anchor](#snippet-LinkFormat.cs)
@@ -287,8 +289,16 @@ if (linkFormat == LinkFormat.Tfs)
{
return $"{path}&line={snippet.StartLine}&lineEnd={snippet.EndLine}";
}
+if (linkFormat == LinkFormat.Bitbucket)
+{
+ return $"{path}#lines={snippet.StartLine}:{snippet.EndLine}";
+}
+if (linkFormat == LinkFormat.GitLab)
+{
+ return $"{path}#L{snippet.StartLine}-{snippet.EndLine}";
+}
```
-[snippet source](/src/MarkdownSnippets/Processing/SnippetMarkdownHandling.cs#L72-L81) / [anchor](#snippet-buildlink)
+[snippet source](/src/MarkdownSnippets/Processing/SnippetMarkdownHandling.cs#L72-L89) / [anchor](#snippet-buildlink)
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 617f2d55..36a3d34e 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -2,7 +2,7 @@
CS1591
- 16.2.0
+ 16.3.0
Markdown, Snippets, mdsnippets, documentation, MarkdownSnippets
Extracts snippets from code files and merges them into markdown documents.
diff --git a/src/MarkdownSnippets/Processing/LinkFormat.cs b/src/MarkdownSnippets/Processing/LinkFormat.cs
index 2357a6a9..7ab7ccf6 100644
--- a/src/MarkdownSnippets/Processing/LinkFormat.cs
+++ b/src/MarkdownSnippets/Processing/LinkFormat.cs
@@ -3,6 +3,8 @@ namespace MarkdownSnippets
public enum LinkFormat
{
GitHub,
- Tfs
+ Tfs,
+ Bitbucket,
+ GitLab
}
}
\ No newline at end of file
diff --git a/src/MarkdownSnippets/Processing/SnippetMarkdownHandling.cs b/src/MarkdownSnippets/Processing/SnippetMarkdownHandling.cs
index dec2f6bb..d910da9f 100644
--- a/src/MarkdownSnippets/Processing/SnippetMarkdownHandling.cs
+++ b/src/MarkdownSnippets/Processing/SnippetMarkdownHandling.cs
@@ -78,6 +78,14 @@ string BuildLink(Snippet snippet, string path)
{
return $"{path}&line={snippet.StartLine}&lineEnd={snippet.EndLine}";
}
+ if (linkFormat == LinkFormat.Bitbucket)
+ {
+ return $"{path}#lines={snippet.StartLine}:{snippet.EndLine}";
+ }
+ if (linkFormat == LinkFormat.GitLab)
+ {
+ return $"{path}#L{snippet.StartLine}-{snippet.EndLine}";
+ }
#endregion
throw new Exception($"Unknown LinkFormat: {linkFormat}");