From mboxrd@z Thu Jan 1 00:00:00 1970 From: andy at warmcat.com (Andy Green) Date: Mon, 18 Jun 2018 10:22:01 +0800 Subject: Rendering of README.md inline with inner tree view dirs In-Reply-To: <20180616173515.GK1922@john.keeping.me.uk> References: <20180611093152.4821159f@leda> <20180611095343.2865c71d@leda> <20180611153858.GJ1922@john.keeping.me.uk> <20180612093145.GL1922@john.keeping.me.uk> <29df7d5c-2556-86e7-45bd-08e1e71a1e57@warmcat.com> <20180616141209.GQ1922@john.keeping.me.uk> <20180616173515.GK1922@john.keeping.me.uk> Message-ID: On 06/17/2018 01:35 AM, John Keeping wrote: > On Sat, Jun 16, 2018 at 03:12:09PM +0100, John Keeping wrote: >> However, I'm not sure how to handle relative links: do we need to pass >> additional parameters for this? Or can we rely on a render filter doing >> the right thing? > > Modifying md2html to use the extension API is reasonably > straightforward. Below is a modified version which remaps the "src" > attribute on elements according to a second command line argument, > you can try it out with: > > md2html > The trailing "/" is important. > > The differences are the AssetMapping classes at the top and the > extension setup at the bottom; the rest is unchanged from the version in > CGit's source tree. > > -- >8 -- > #!/usr/bin/env python3 > import markdown > import sys Thanks a lot for that... I patchified it under your name / email and added your signed-off-by on it. It works, but it's missing a trick, cgit URLs may have a postfix like ?h=branch which controls the context shown. I added a patch-on-top of the python and another on the C to generate and use prefix and postfix args. Now it can show completely relative markdown assets in the correct context seamlessly, served from git... so you can see easily the picture in the v3.0-stable branch git https://libwebsockets.org/git/libwebsockets/tree/README.md?h=v3.0-stable has been updated in master https://libwebsockets.org/git/libwebsockets/tree/README.md ...even though in both cases the markdown is ![lws-overview](./doc-assets/lws-overview.png) ...ie, is not contaminated with any virtual path, versioning or url info... this is pretty nice! -Andy