RFE: render MD/RST documents in tree view

Joe Anakata jea-signup-cgit at anakata.org
Wed Aug 24 06:41:11 CEST 2016


On 08/23/2016 02:37 PM, Konstantin Ryabitsev wrote:
> Hello, all:
>
> A recurring request is to implement a github-ish feature to render 
> MD/RST documents instead of showing them as source code (not the same 
> as about-filter, as the request is to render any *.md document, not 
> just a README in the about tab).
Ideally, if you're going crazy, this could also include rendering for 
images and other things too.  Basically I'm imagining that any file 
could be viewed in one of four ways:  raw (just serve to browser with 
correct content-type; existing raw support), cooked (markdown, rst, 
image with cgit styling, etc), plain text (with optional syntax 
highlighting where appropriate), or hex blob. Config vars would control 
which extensions & mime types got which view by default, but you could 
in theory force any file any way.  Just a thought.
> I tried using a source-filter to render markdown, but the results were 
> not quite there (see attachment). :) I don't think there's currently a 
> way to do it, but it would be pretty nice to have it
We also did a source filter and observed what you saw.  Then we 
discovered a hack that works on our install (currently at version v0.12) 
which may (or may not) be helpful to you in the meantime if it works for 
your version.

IF (and only if) you have a toplevel README.md or similar about file in 
your repo, then you can render any markdown file in the repo, like so:

http://cgit.example.com/users/joe/test.git/about/filetypes/markdown.markdown

that is, just append the path you want to render in the repo to the 
"about" link of your repo, and voila, better markdown rendering. (In 
this example, my test repo "users/joe/test.git" has a directory 
"filetypes" which has lots of various types of files, handy for testing 
this sort of stuff.)

Thanks
-Joe



More information about the CGit mailing list