mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-17 22:34:25 +01:00
remove a unused function.
This commit is contained in:
14
markdown.go
14
markdown.go
@@ -27,16 +27,6 @@ var mdrenderer = html.NewRenderer(html.RendererOptions{
|
||||
},
|
||||
})
|
||||
|
||||
func stripLinksFromMarkdown(md string) string {
|
||||
// Regular expression to match Markdown links and HTML links
|
||||
linkRegex := regexp.MustCompile(`\[([^\]]*)\]\([^)]*\)|<a[^>]*>(.*?)</a>`)
|
||||
|
||||
// Replace both Markdown and HTML links with just the link text
|
||||
strippedMD := linkRegex.ReplaceAllString(md, "$1$2")
|
||||
|
||||
return strippedMD
|
||||
}
|
||||
|
||||
var tgivmdrenderer = html.NewRenderer(html.RendererOptions{
|
||||
Flags: html.CommonFlags | html.HrefTargetBlank,
|
||||
RenderNodeHook: func(w io.Writer, node ast.Node, entering bool) (ast.WalkStatus, bool) {
|
||||
@@ -85,10 +75,6 @@ func mdToHTML(md string, usingTelegramInstantView bool) string {
|
||||
// create HTML renderer with extensions
|
||||
output := string(markdown.Render(doc, renderer))
|
||||
|
||||
if skipLinks {
|
||||
output = stripLinksFromMarkdown(output)
|
||||
}
|
||||
|
||||
// sanitize content
|
||||
output = sanitizeXSS(output)
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ func renderEvent(w http.ResponseWriter, r *http.Request) {
|
||||
if data.event.Kind == 30023 || data.event.Kind == 30024 {
|
||||
// Remove duplicate title inside the body
|
||||
data.content = strings.ReplaceAll(data.content, "# "+data.event.subject, "")
|
||||
data.content = mdToHTML(data.content, data.templateId == TelegramInstantView, false)
|
||||
data.content = mdToHTML(data.content, data.templateId == TelegramInstantView)
|
||||
} else if data.event.Kind == 30818 {
|
||||
data.content = asciidocToHTML(data.content)
|
||||
} else {
|
||||
|
||||
2
utils.go
2
utils.go
@@ -343,7 +343,7 @@ func renderQuotesAsHTML(ctx context.Context, input string, usingTelegramInstantV
|
||||
|
||||
var content string
|
||||
if event.Kind == 30023 {
|
||||
content = mdToHTML(event.Content, usingTelegramInstantView, false)
|
||||
content = mdToHTML(event.Content, usingTelegramInstantView)
|
||||
} else {
|
||||
content = basicFormatting(event.Content, false, usingTelegramInstantView, false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user