Convert title and description to plain text
This commit is contained in:
		| @@ -20,3 +20,16 @@ func ConvertToHTML(md string) (string, error) { | ||||
|  | ||||
| 	return html, nil | ||||
| } | ||||
|  | ||||
| func ConvertToPlain(md string) (string, error) { | ||||
| 	var buf bytes.Buffer | ||||
|  | ||||
| 	if err := goldmark.Convert([]byte(md), &buf); err != nil { | ||||
| 		return "", fmt.Errorf("error converting markdown to html: %v", err) | ||||
| 	} | ||||
|  | ||||
| 	p := bluemonday.StrictPolicy() | ||||
| 	plain := p.Sanitize(buf.String()) | ||||
|  | ||||
| 	return plain, nil | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user