diff options
author | 2022-07-19 15:21:17 +0200 | |
---|---|---|
committer | 2022-07-19 15:21:17 +0200 | |
commit | c84384e6608368a13a774d6d33a8cc32da7cf209 (patch) | |
tree | a18aa9c1ced1299d2682c1993e1ba38f46448dba /internal/text/markdown.go | |
parent | [chore] use our own logging implementation (#716) (diff) | |
download | gotosocial-c84384e6608368a13a774d6d33a8cc32da7cf209.tar.xz |
[bugfix] html escape special characters in text instead of totally removing them (#719)
* remove minify dependency
* tidy up some tests
* remove pre + postformat funcs
* rework sanitization + formatting
* update tests
* add some more markdown tests
Diffstat (limited to 'internal/text/markdown.go')
-rw-r--r-- | internal/text/markdown.go | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/internal/text/markdown.go b/internal/text/markdown.go index 01238954f..a5c62f23f 100644 --- a/internal/text/markdown.go +++ b/internal/text/markdown.go @@ -26,13 +26,11 @@ import ( ) func (f *formatter) FromMarkdown(ctx context.Context, md string, mentions []*gtsmodel.Mention, tags []*gtsmodel.Tag) string { - content := preformat(md) - // do the markdown parsing *first* - contentBytes := blackfriday.Run([]byte(content)) + contentBytes := blackfriday.Run([]byte(md)) // format tags nicely - content = f.ReplaceTags(ctx, string(contentBytes), tags) + content := f.ReplaceTags(ctx, string(contentBytes), tags) // format mentions nicely content = f.ReplaceMentions(ctx, content, mentions) |