From 300c0194c72c78a8f51e574323ea593526009d84 Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 27 Nov 2020 03:22:41 +0100 Subject: [PATCH] add inline markdown plugins --- .vscode/launch.json | 2 + copyparty/__main__.py | 1 + copyparty/httpcli.py | 1 + copyparty/web/md.html | 5 +- copyparty/web/md.js | 56 +++++++++++++++++- copyparty/web/mde.html | 5 +- srv/extend.md | 127 +++++++++++++++++++++++++++++++++++++++++ 7 files changed, 193 insertions(+), 4 deletions(-) create mode 100644 srv/extend.md diff --git a/.vscode/launch.json b/.vscode/launch.json index baa51a4e..9ad233f0 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,6 +10,8 @@ "cwd": "${workspaceFolder}", "args": [ //"-nw", + "-ed", + "-emp", "-a", "ed:wark", "-v", diff --git a/copyparty/__main__.py b/copyparty/__main__.py index a69e060d..a0d7251d 100644 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -136,6 +136,7 @@ def main(): ap.add_argument("-v", metavar="VOL", type=str, action="append", help="add volume") ap.add_argument("-q", action="store_true", help="quiet") ap.add_argument("-ed", action="store_true", help="enable ?dots") + ap.add_argument("-emp", action="store_true", help="enable markdown plugins") ap.add_argument("-nw", action="store_true", help="disable writes (benchmark)") ap.add_argument("-nih", action="store_true", help="no info hostname") ap.add_argument("-nid", action="store_true", help="no info disk-usage") diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 9bd9e1e2..46fd96c8 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -963,6 +963,7 @@ class HttpCli(object): "edit": "edit" in self.uparam, "title": html_escape(self.vpath), "lastmod": int(ts_md * 1000), + "md_plug": "true" if self.args.emp else "false", "md": "", } sz_html = len(template.render(**targs).encode("utf-8")) diff --git a/copyparty/web/md.html b/copyparty/web/md.html index b9545cad..fced2989 100644 --- a/copyparty/web/md.html +++ b/copyparty/web/md.html @@ -123,8 +123,11 @@ write markdown (most html is 🙆 too)