diff options
author | 2021-07-29 13:18:22 +0200 | |
---|---|---|
committer | 2021-07-29 13:18:22 +0200 | |
commit | a940a520d301d00f42012743b3999a73f7180848 (patch) | |
tree | 50bdd749381d6f773df46dbc4cc33a9b533a4e7b /internal/text/formatter.go | |
parent | Link parsing (#120) (diff) | |
download | gotosocial-a940a520d301d00f42012743b3999a73f7180848.tar.xz |
Link hashtag bug (#121)
* link + hashtag bug
* remove printlns
* tidy up some duplicated code
Diffstat (limited to 'internal/text/formatter.go')
-rw-r--r-- | internal/text/formatter.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/text/formatter.go b/internal/text/formatter.go index f8cca6675..39aaae559 100644 --- a/internal/text/formatter.go +++ b/internal/text/formatter.go @@ -31,6 +31,13 @@ type Formatter interface { FromMarkdown(md string, mentions []*gtsmodel.Mention, tags []*gtsmodel.Tag) string // FromPlain parses an HTML text from a plaintext. FromPlain(plain string, mentions []*gtsmodel.Mention, tags []*gtsmodel.Tag) string + + // ReplaceTags takes a piece of text and a slice of tags, and returns the same text with the tags nicely formatted as hrefs. + ReplaceTags(in string, tags []*gtsmodel.Tag) string + // ReplaceMentions takes a piece of text and a slice of mentions, and returns the same text with the mentions nicely formatted as hrefs. + ReplaceMentions(in string, mentions []*gtsmodel.Mention) string + // ReplaceLinks takes a piece of text, finds all recognizable links in that text, and replaces them with hrefs. + ReplaceLinks(in string) string } type formatter struct { |