aboutsummaryrefslogtreecommitdiff
path: root/web/view/markdown.scm
diff options
context:
space:
mode:
authorPjotr Prins2023-09-14 12:17:19 -0500
committerPjotr Prins2023-09-14 12:17:19 -0500
commit2a75f39404519ae6697c90a703e61fa65452872e (patch)
tree76bde978b1f0a47d90d588391de0e3af225143c0 /web/view/markdown.scm
parent46a218730028f7c3aedeabf62f47883752651fb4 (diff)
downloadgn-guile-2a75f39404519ae6697c90a703e61fa65452872e.tar.gz
Added edit button
Diffstat (limited to 'web/view/markdown.scm')
-rw-r--r--web/view/markdown.scm11
1 files changed, 9 insertions, 2 deletions
diff --git a/web/view/markdown.scm b/web/view/markdown.scm
index c0cb992..4dbedb2 100644
--- a/web/view/markdown.scm
+++ b/web/view/markdown.scm
@@ -39,8 +39,15 @@
(define (form-github-raw-url project repo page)
(string-append "https://raw.githubusercontent.com/" project "/" repo "/master/" (string-join page "/")))
+(define (form-github-edit-url project repo page)
+ (string-append "https://github.com/" project "/" repo "/edit/master/" (string-join page "/")))
+
(define (markdown-github->sxml path)
"Parse a github markdown file that is formed like genenetwork/gn-docs/general/brand/aging/home.md"
(match-let (((project repo page ...) (string-split path #\/)))
- (commonmark->sxml
- (fetch-raw-file (pk (form-github-raw-url project repo (pk page)))))))
+ `(div (@ (class "markdown"))
+ (div (@ (class "button_align_right"))
+ (a (@ (href ,(form-github-edit-url project repo page)) (role "button")) "edit text"))
+ ,(commonmark->sxml
+ (fetch-raw-file (pk (form-github-raw-url project repo (pk page)))))))
+)