markdown: more file exts, fix img

This commit is contained in:
Anirudh Oppiliappan 2022-12-26 12:04:09 +05:30
parent 49b8b29289
commit 7a512b1da6
No known key found for this signature in database
GPG Key ID: 8A93F96F78C5D4C4
2 changed files with 9 additions and 2 deletions

View File

@ -110,8 +110,11 @@ func (d *deps) RepoIndex(w http.ResponseWriter, r *http.Request) {
content, _ := gr.FileContent(readme) content, _ := gr.FileContent(readme)
if len(content) > 0 { if len(content) > 0 {
switch ext { switch ext {
case ".md": case ".md", ".mkd", ".markdown":
unsafe := blackfriday.Run([]byte(content), blackfriday.WithExtensions(blackfriday.CommonExtensions)) unsafe := blackfriday.Run(
[]byte(content),
blackfriday.WithExtensions(blackfriday.CommonExtensions),
)
html := bluemonday.UGCPolicy().SanitizeBytes(unsafe) html := bluemonday.UGCPolicy().SanitizeBytes(unsafe)
readmeContent = template.HTML(html) readmeContent = template.HTML(html)
default: default:

View File

@ -162,6 +162,10 @@ a:hover {
padding: revert; padding: revert;
} }
.readme img {
max-width: 100%;
}
.diff { .diff {
margin: 1rem 0 1rem 0; margin: 1rem 0 1rem 0;
padding: 1rem 0 1rem 0; padding: 1rem 0 1rem 0;