mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +00:00
feature: subject presenter supports inline codeblock
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
9efbc7dd7a
commit
8c4362a98d
7 changed files with 289 additions and 119 deletions
|
@ -117,6 +117,6 @@ namespace SourceGit.Models
|
|||
public class CommitFullMessage
|
||||
{
|
||||
public string Message { get; set; } = string.Empty;
|
||||
public List<Hyperlink> Links { get; set; } = [];
|
||||
public List<InlineElement> Inlines { get; set; } = [];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,27 @@
|
|||
namespace SourceGit.Models
|
||||
{
|
||||
public class Hyperlink
|
||||
public enum InlineElementType
|
||||
{
|
||||
None = 0,
|
||||
Keyword,
|
||||
Link,
|
||||
CommitSHA,
|
||||
Code,
|
||||
}
|
||||
|
||||
public class InlineElement
|
||||
{
|
||||
public InlineElementType Type { get; set; } = InlineElementType.None;
|
||||
public int Start { get; set; } = 0;
|
||||
public int Length { get; set; } = 0;
|
||||
public string Link { get; set; } = "";
|
||||
public bool IsCommitSHA { get; set; } = false;
|
||||
|
||||
public Hyperlink(int start, int length, string link, bool isCommitSHA = false)
|
||||
public InlineElement(InlineElementType type, int start, int length, string link)
|
||||
{
|
||||
Type = type;
|
||||
Start = start;
|
||||
Length = length;
|
||||
Link = link;
|
||||
IsCommitSHA = isCommitSHA;
|
||||
}
|
||||
|
||||
public bool Intersect(int start, int length)
|
|
@ -46,7 +46,7 @@ namespace SourceGit.Models
|
|||
set => SetProperty(ref _urlTemplate, value);
|
||||
}
|
||||
|
||||
public void Matches(List<Hyperlink> outs, string message)
|
||||
public void Matches(List<InlineElement> outs, string message)
|
||||
{
|
||||
if (_regex == null || string.IsNullOrEmpty(_urlTemplate))
|
||||
return;
|
||||
|
@ -81,8 +81,7 @@ namespace SourceGit.Models
|
|||
link = link.Replace($"${j}", group.Value);
|
||||
}
|
||||
|
||||
var range = new Hyperlink(start, len, link);
|
||||
outs.Add(range);
|
||||
outs.Add(new InlineElement(InlineElementType.Link, start, len, link));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue