Skip to content

Commit

Permalink
markdown: more file exts, fix img
Browse files Browse the repository at this point in the history
  • Loading branch information
icyphox committed Dec 26, 2022
1 parent 49b8b29 commit 7a512b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions routes/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,11 @@ func (d *deps) RepoIndex(w http.ResponseWriter, r *http.Request) {
content, _ := gr.FileContent(readme)
if len(content) > 0 {
switch ext {
case ".md":
unsafe := blackfriday.Run([]byte(content), blackfriday.WithExtensions(blackfriday.CommonExtensions))
case ".md", ".mkd", ".markdown":
unsafe := blackfriday.Run(
[]byte(content),
blackfriday.WithExtensions(blackfriday.CommonExtensions),
)
html := bluemonday.UGCPolicy().SanitizeBytes(unsafe)
readmeContent = template.HTML(html)
default:
Expand Down
4 changes: 4 additions & 0 deletions static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ a:hover {
padding: revert;
}

.readme img {
max-width: 100%;
}

.diff {
margin: 1rem 0 1rem 0;
padding: 1rem 0 1rem 0;
Expand Down

0 comments on commit 7a512b1

Please sign in to comment.