Finally I found the solution.
Please take a looks how Microsoft had implement it at link below:
https://github.com/aspnet/Mvc/blob/1c4b0fcdf38320b2f02c0bb7c31df5bd391ace07/src/Microsoft.AspNetCore.Mvc.Razor/TagHelpers/UrlResolutionTagHelper.cs#L47
I had take a copy of this class and I renamed that to this:
[HtmlTargetElement("link", Attributes = "[href^='%/']", TagStructure = TagStructure.WithoutEndTag)]
[HtmlTargetElement("script", Attributes = "[src^='%/']")]
....
public class ThemeUrlResolutionTagHelper : TagHelper
{
/*Implement tag helper here*/
}
And before creating trimmed string I insert my Theme URL
url = url.Remove(start, 2).Insert(start, $"~/themes/{Theme.Key}/");
var trimmedUrl = CreateTrimmedString(url, start);
And I changed the ~ to % in FindRelativeStart method
// Before doing more work, ensure that the URL we're looking at is app-relative.
if (url[start] != '%' || url[start + 1] != '/')
{
return -1;
}
And Done!