mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
Supports base64 images now
This commit is contained in:
parent
05cf475742
commit
8019335da0
@ -77,7 +77,12 @@ func serveStaticFile(c *gin.Context, option string) {
|
||||
|
||||
func renderMarkdown(c *gin.Context, currentText string, title string) {
|
||||
unsafe := blackfriday.MarkdownCommon([]byte(currentText))
|
||||
html := bluemonday.UGCPolicy().SanitizeBytes(unsafe)
|
||||
pClean := bluemonday.UGCPolicy()
|
||||
pClean.AllowElements("img")
|
||||
pClean.AllowAttrs("alt").OnElements("img")
|
||||
pClean.AllowAttrs("src").OnElements("img")
|
||||
pClean.AllowDataURIImages()
|
||||
html := pClean.SanitizeBytes(unsafe)
|
||||
html2 := string(html)
|
||||
r, _ := regexp.Compile("\\$\\$(.*?)\\$\\$")
|
||||
for _, s := range r.FindAllString(html2, -1) {
|
||||
|
@ -34,7 +34,7 @@
|
||||
body {
|
||||
margin: 0;
|
||||
background: #fff;
|
||||
max-width: 700px;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user