Move code rendering to the backend & frontend improvements (#176)

Added Chroma & Goldmark

Added Mermaidjs

More languages supported

Add default values for gist links input

Added copy code from markdown blocks
This commit is contained in:
Thomas Miceli
2023-12-19 02:47:14 +01:00
parent eff88711ea
commit 845e28dd59
24 changed files with 511 additions and 143 deletions

View File

@ -149,6 +149,25 @@ func GetFileContent(user string, gist string, revision string, filename string,
return content, truncated, nil
}
func GetFileSize(user string, gist string, revision string, filename string) (int64, error) {
repositoryPath := RepositoryPath(user, gist)
cmd := exec.Command(
"git",
"cat-file",
"-s",
revision+":"+filename,
)
cmd.Dir = repositoryPath
stdout, err := cmd.Output()
if err != nil {
return 0, err
}
return strconv.ParseInt(strings.TrimSuffix(string(stdout), "\n"), 10, 64)
}
func GetLog(user string, gist string, skip int) ([]*Commit, error) {
repositoryPath := RepositoryPath(user, gist)