Skip to content

Commit eec737c

Browse files
committed
remove a unused function.
1 parent a91d516 commit eec737c

File tree

3 files changed

+2
-16
lines changed

3 files changed

+2
-16
lines changed

markdown.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,6 @@ var mdrenderer = html.NewRenderer(html.RendererOptions{
2727
},
2828
})
2929

30-
func stripLinksFromMarkdown(md string) string {
31-
// Regular expression to match Markdown links and HTML links
32-
linkRegex := regexp.MustCompile(`\[([^\]]*)\]\([^)]*\)|<a[^>]*>(.*?)</a>`)
33-
34-
// Replace both Markdown and HTML links with just the link text
35-
strippedMD := linkRegex.ReplaceAllString(md, "$1$2")
36-
37-
return strippedMD
38-
}
39-
4030
var tgivmdrenderer = html.NewRenderer(html.RendererOptions{
4131
Flags: html.CommonFlags | html.HrefTargetBlank,
4232
RenderNodeHook: func(w io.Writer, node ast.Node, entering bool) (ast.WalkStatus, bool) {
@@ -85,10 +75,6 @@ func mdToHTML(md string, usingTelegramInstantView bool) string {
8575
// create HTML renderer with extensions
8676
output := string(markdown.Render(doc, renderer))
8777

88-
if skipLinks {
89-
output = stripLinksFromMarkdown(output)
90-
}
91-
9278
// sanitize content
9379
output = sanitizeXSS(output)
9480

render_event.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ func renderEvent(w http.ResponseWriter, r *http.Request) {
235235
if data.event.Kind == 30023 || data.event.Kind == 30024 {
236236
// Remove duplicate title inside the body
237237
data.content = strings.ReplaceAll(data.content, "# "+data.event.subject, "")
238-
data.content = mdToHTML(data.content, data.templateId == TelegramInstantView, false)
238+
data.content = mdToHTML(data.content, data.templateId == TelegramInstantView)
239239
} else if data.event.Kind == 30818 {
240240
data.content = asciidocToHTML(data.content)
241241
} else {

utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ func renderQuotesAsHTML(ctx context.Context, input string, usingTelegramInstantV
343343

344344
var content string
345345
if event.Kind == 30023 {
346-
content = mdToHTML(event.Content, usingTelegramInstantView, false)
346+
content = mdToHTML(event.Content, usingTelegramInstantView)
347347
} else {
348348
content = basicFormatting(event.Content, false, usingTelegramInstantView, false)
349349
}

0 commit comments

Comments
 (0)