feat: Add support for rendering .ipynb Jupyter/IPython notebooks (#491)
This commit is contained in:
committed by
GitHub
parent
53ce41e0e4
commit
c02bf97b63
@@ -202,6 +202,11 @@ func CatFileBatch(user string, gist string, revision string, truncate bool) ([]*
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Don't truncate Jupyter notebooks
|
||||
if strings.HasSuffix(file.Name, ".ipynb") {
|
||||
truncate = false
|
||||
}
|
||||
|
||||
sizeToRead := size
|
||||
if truncate && sizeToRead > truncateLimit {
|
||||
sizeToRead = truncateLimit
|
||||
|
||||
@@ -58,6 +58,9 @@ func (s *Server) setFuncMap() {
|
||||
"isMarkdown": func(i string) bool {
|
||||
return strings.ToLower(filepath.Ext(i)) == ".md"
|
||||
},
|
||||
"isJupyter": func(i string) bool {
|
||||
return strings.ToLower(filepath.Ext(i)) == ".ipynb"
|
||||
},
|
||||
"httpStatusText": http.StatusText,
|
||||
"loadedTime": func(startTime time.Time) string {
|
||||
return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms"
|
||||
|
||||
Reference in New Issue
Block a user