List for cgit developers and users
 help / color / mirror / Atom feed
* RFE: render MD/RST documents in tree view
@ 2016-08-23 21:37 mricon
  2016-08-24  4:41 ` jea-signup-cgit
  2016-08-24  7:19 ` wub
  0 siblings, 2 replies; 5+ messages in thread
From: mricon @ 2016-08-23 21:37 UTC (permalink / raw)


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).

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.

-K
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20160823/c6e01697/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot from 2016-06-09 13-33-43.png
Type: image/png
Size: 11206 bytes
Desc: not available
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20160823/c6e01697/attachment.png>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RFE: render MD/RST documents in tree view
  2016-08-23 21:37 RFE: render MD/RST documents in tree view mricon
@ 2016-08-24  4:41 ` jea-signup-cgit
  2016-08-24  8:35   ` hjemli
  2016-08-24  7:19 ` wub
  1 sibling, 1 reply; 5+ messages in thread
From: jea-signup-cgit @ 2016-08-24  4:41 UTC (permalink / raw)


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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* RFE: render MD/RST documents in tree view
  2016-08-23 21:37 RFE: render MD/RST documents in tree view mricon
  2016-08-24  4:41 ` jea-signup-cgit
@ 2016-08-24  7:19 ` wub
  2016-08-24 18:47   ` john
  1 sibling, 1 reply; 5+ messages in thread
From: wub @ 2016-08-24  7:19 UTC (permalink / raw)


source-filter is good enough? I don't want cgit to become a GitLab-ish
platform with all this featuritis.

Do one thing and do it well; leave Markdown rendering to a seperate
program. Nobody can really even agree to how Markdown and its quirks
should be rendered, so we have tens of variants. CommonMark is not
stable yet.

(I'd actually wish cgit had a better config structure with less
options, or something like OpenBSD pf does.)

Please.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RFE: render MD/RST documents in tree view
  2016-08-24  4:41 ` jea-signup-cgit
@ 2016-08-24  8:35   ` hjemli
  0 siblings, 0 replies; 5+ messages in thread
From: hjemli @ 2016-08-24  8:35 UTC (permalink / raw)


On Wed, Aug 24, 2016 at 6:41 AM, Joe Anakata
<jea-signup-cgit at anakata.org> wrote:
> On 08/23/2016 02:37 PM, Konstantin Ryabitsev wrote:
>> 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.

Actually, this is not a hack but an intended feature, see
https://git.zx2c4.com/cgit/commit/?id=e1782fff8a78b7f265432603351281ad2988bb40

You can also use a dedicated branch for your about-pages, see
https://git.zx2c4.com/cgit/commit/?id=379e80e3a83481d3639c5d312eeddcce57c486b2

In cgit, the 'wiki' branch contains all the files available from the
about-page: https://git.zx2c4.com/cgit/tree/?h=wiki

--
larsh


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RFE: render MD/RST documents in tree view
  2016-08-24  7:19 ` wub
@ 2016-08-24 18:47   ` john
  0 siblings, 0 replies; 5+ messages in thread
From: john @ 2016-08-24 18:47 UTC (permalink / raw)


On Wed, Aug 24, 2016 at 07:19:20AM +0000, Juuso Lapinlampi wrote:
> source-filter is good enough? I don't want cgit to become a GitLab-ish
> platform with all this featuritis.

source-filter doesn't suppress the line numbers, which render as a
separate table cell, and it wraps the content in <pre></pre>.  I'm
guessing the intent here is to avoid that.

> Do one thing and do it well; leave Markdown rendering to a seperate
> program. Nobody can really even agree to how Markdown and its quirks
> should be rendered, so we have tens of variants. CommonMark is not
> stable yet.

I don't think anyone is suggesting that, just provide a way to replace
the entire page content with a rendered version (presumably via a new
filter).

I can't immediately think of a nice way to achieve this; I think there
are two possible interfaces:

a) We decide what to do based on the MIME type of the file, and then
   invoke render-filter (for lack of a better name) where relevant

b) We always try to render the file but the filter can exit immediately
   with an error in which case we carry on with the current code

In either case we then need to provide a way to switch back to the
current source view for the file.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-08-24 18:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-23 21:37 RFE: render MD/RST documents in tree view mricon
2016-08-24  4:41 ` jea-signup-cgit
2016-08-24  8:35   ` hjemli
2016-08-24  7:19 ` wub
2016-08-24 18:47   ` john

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).