Fancier Source view [Was: Re: [PATCH v4 00/16] Render READMEs inline in tree view]

Jason A. Donenfeld Jason at
Wed Jun 27 19:26:13 CEST 2018

Splitting out this issue into a different thread, because I think it's
orthogonal to the other topic.

On Wed, Jun 27, 2018 at 7:18 PM Jason A. Donenfeld <Jason at> wrote:
> In adding rendering of arbitrary files in blob view, this is
> essentially a fancy source view, with the one caveat of our
> interesting handling of line numbers.

People click a .c file and they get pygments highlighting. That's
good. People click a .pdf or a .md and they get either a hexdump or a
highlighted .md source. Github has made different behavior more
popular -- namely, rendering the .pdf and the .md. The obvious way to
handle this is augmenting the source-view to spit something different

Alternatively, my previously proposed readme-filter could be renamed
to render-filter, and we could do everything in one place with one
filter, and decide exclusively on the basis of filetype.

Either way, we have this issue of line numbers. We have a few ways of
handling this:

a. Not print them ever when a source-filter/render-filter is
specified, leaving that up to the renderer to do.
b. If the renderer doesn't want line numbers, it can return a special
exit code (197, for example) to indicate that to cgit.
c. If the renderer doesn't want line numbers, it can just omit some
!important css to remove them at the end.
d. We introduce a maze of filetype selection rendering logic options.
e. Something else?

I'm most inclined to go with a or b, but neither seems entirely
appealing. Thoughts?


More information about the CGit mailing list