Public Access
Implement meeting assistant v1
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
namespace MeetingAssistant.MeetingNotes;
|
||||
|
||||
public static class ObsidianLink
|
||||
{
|
||||
public static string ToWikiLink(string pathOrLink, string sourceNotePath, string label)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(pathOrLink) || pathOrLink.StartsWith("[[", StringComparison.Ordinal))
|
||||
{
|
||||
return pathOrLink;
|
||||
}
|
||||
|
||||
var sourceFolder = Path.GetDirectoryName(sourceNotePath) ?? "";
|
||||
var relativePath = Path.GetRelativePath(sourceFolder, pathOrLink);
|
||||
var withoutExtension = Path.Combine(
|
||||
Path.GetDirectoryName(relativePath) ?? "",
|
||||
Path.GetFileNameWithoutExtension(relativePath))
|
||||
.Replace(Path.DirectorySeparatorChar, '/')
|
||||
.Replace(Path.AltDirectorySeparatorChar, '/');
|
||||
|
||||
return $"[[{withoutExtension}|{label}]]";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user