UtilHtmlLinkify(FileInfo, LinkifyInterfaceType, LinkifyPlugins, LinkifyFormatOptions, Encoding) Method
Highlights links within strings that contain HTML markup,
or replace links in plain-text strings with anchor (<a>) tags.
The behavior depends on the
interfaceType parameter.
This function internally uses linkify JavaScript library (
https://linkify.js.org/).
Namespace: DevCase.Core.DataProcessing.HtmlAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
static member Linkify :
file : FileInfo *
interfaceType : LinkifyInterfaceType *
?plugins : LinkifyPlugins *
?formatOptions : LinkifyFormatOptions *
?encoding : Encoding
(* Defaults:
let _plugins = defaultArg plugins LinkifyPlugins.None
let _formatOptions = defaultArg formatOptions null
let _encoding = defaultArg encoding null
*)
-> string
No code example is currently available or this language may not be supported.
- file FileInfo
-
The source html or plain-text document file.
- interfaceType LinkifyInterfaceType
-
A interface type that defines how to parse the file content specified in file parameter.
If this value is Html,
this function will highlight links within strings that contain HTML markup.
If this value is Html,
this function will replace links in plain-text strings with anchor (<a>) tags.
- plugins LinkifyPlugins (Optional)
-
Optional LinkifyPlugins flags that adds additional linkify capabilities.
By default this function only linkifies domain urls and email addresses.
Default value: None
- formatOptions LinkifyFormatOptions (Optional)
-
Optional LinkifyFormatOptions object that adds additional formatting capabilities to links.
- encoding Encoding (Optional)
-
Optionally specifies the text encoding used to read the markdown document.
Default value: Default
String
The resulting linkified text.
This is a code example.
No code example is currently available or this language may not be supported.
Dim doc As New FileInfo(".\document.html")
Dim interfaceType As LinkifyInterfaceType = LinkifyInterfaceType.Html
Dim plugins As LinkifyPlugins = LinkifyPlugins.All
Dim options As New LinkifyFormatOptions
options.UrlProtocol = Uri.UriSchemeHttps
options.TruncateLength = 50
options.TargetAttribute =
Function(linkType As LinkifyLinkType, href As String) As String
Return "_blank"
End Function
options.FormatHref =
Function(linkType As LinkifyLinkType, href As String) As String
Select Case linkType
Case LinkifyLinkType.Hashtag
Return "https://twitter.com/hashtag/" & href.Substring(1)
Case LinkifyLinkType.Mention
Return "https://github.com" & href
Case LinkifyLinkType.Ticket
Return "https://github.com/Hypercontext/linkifyjs/issues/" & href.Substring(1)
Case Else
Return href ' no formatting
End Select
End Function
Dim linkifiedHtml As String = Linkify(doc, interfaceType, plugins, options, Encoding.UTF8)
Console.WriteLine(linkifiedHtml)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.