From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/15008 Path: news.gmane.org!not-for-mail From: BPJ Newsgroups: gmane.text.pandoc Subject: Re: Markdown, tables and CSV Date: Thu, 26 May 2016 14:50:02 +0200 Message-ID: References: <047d7b86ebe83c062b05332eab9b@google.com> <20BF19CB-A2B0-4B19-A749-D750CDD89736@martinfenner.org> <1463766905.1918988.613990665.6CD67781@webmail.messagingengine.com> <471daa3c-e2ec-4445-b4fd-44e5c8a3fd6b@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c33d5e9216f10533be3ac5 X-Trace: ger.gmane.org 1464267020 21914 80.91.229.3 (26 May 2016 12:50:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 26 May 2016 12:50:20 +0000 (UTC) To: "pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org" Original-X-From: pandoc-discuss+bncBCWMVYEK54FRB67BTO5AKGQEKGWOERI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu May 26 14:50:09 2016 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-wm0-f62.google.com ([74.125.82.62]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b5ujp-000212-QO for gtp-pandoc-discuss@m.gmane.org; Thu, 26 May 2016 14:50:09 +0200 Original-Received: by mail-wm0-f62.google.com with SMTP id n129sf17326157wmn.0 for ; Thu, 26 May 2016 05:50:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:to:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=orG6N2sXJpPKFQ0cViEmmYqpf0vZUGW/S6KJSV8FWB4=; b=e/F5n47Bs132j2b2Wj/a818PZXsZXmokHpeW3wTP4J0HwFe+/vjGertS4BVFRhTxWp BzzU65cKwv+RYb5Ollzlkw6yfy/mmh5tiBBna3fP42vJgY95XfaF2CtmYfrFMv1mtGnS h0XrZFNQGNLShQPsLF0tTBSzpn65pBpWjbowOPftopq2ul6o074Bks47YzcDjnxRuUOc cOKw00/h8K65cF51KxANXuTaAUx2Zqn7VnLm9aW+PIAoSEADKm9c/Qeu0TsONZeKE5Ik Ekgw/N5nBWWzmY29U34ObZeTyNvKFhi3v4kd/hLe1pNYxXKfeXKODRPuzFGNLu4KV163 teXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:sender:in-reply-to :references:date:message-id:subject:from:to:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=orG6N2sXJpPKFQ0cViEmmYqpf0vZUGW/S6KJSV8FWB4=; b=DogaXIUev4I7ux9XEs/uNcbJkklhrZRO3AXfrB1iAV/65SQCL5B2A/DGOKmf68gwx7 r/oe5O1nul9HiZjoIUbr41l6DIXkRlTDybAAw3wCDpSnZ+7G7Fj1hiJgmGuTwrx/gRQj FIZ75awEzKEa+qr10UVC2AmnSOJuvvkzFDiA1MIJoA7WHDAG/z7mHTY4oWJJHQTj11b/ tDc0N8fznWrTJuLy8vg6WovE8LcZHFdZ3hakA4+KDfhP5FEMBqdD2k9m84s97TmGNwC9 856QMgMQUuR85aXT1sdOd8/79/MWNknGB/1DTyYO7WgcLjNHY566cUlDlO8toSSuBnf1 UJQA== X-Gm-Message-State: ALyK8tIVuzMFUUL9JzjCOnRbWUZiURQwCOWKF8Eowh1KZx1oZPCbZwWuLzCAywACXqymJw== X-Received: by 10.46.9.198 with SMTP id 189mr1286ljj.0.1464267004449; Thu, 26 May 2016 05:50:04 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.25.153.140 with SMTP id b134ls347737lfe.43.gmail; Thu, 26 May 2016 05:50:03 -0700 (PDT) X-Received: by 10.112.210.102 with SMTP id mt6mr1065130lbc.21.1464267003438; Thu, 26 May 2016 05:50:03 -0700 (PDT) Original-Received: from mail-lb0-x232.google.com (mail-lb0-x232.google.com. [2a00:1450:4010:c04::232]) by gmr-mx.google.com with ESMTPS id ai9si611984lbc.2.2016.05.26.05.50.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 May 2016 05:50:03 -0700 (PDT) Received-SPF: pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4010:c04::232 as permitted sender) client-ip=2a00:1450:4010:c04::232; Original-Received: by mail-lb0-x232.google.com with SMTP id sh2so24644203lbb.1 for ; Thu, 26 May 2016 05:50:03 -0700 (PDT) X-Received: by 10.112.141.8 with SMTP id rk8mr2796628lbb.91.1464267003007; Thu, 26 May 2016 05:50:03 -0700 (PDT) Original-Sender: melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Original-Received: by 10.25.77.71 with HTTP; Thu, 26 May 2016 05:50:02 -0700 (PDT) In-Reply-To: X-Original-Sender: melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4010:c04::232 as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Spam-Checked-In-Group: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.org gmane.text.pandoc:15008 Archived-At: --001a11c33d5e9216f10533be3ac5 Content-Type: text/plain; charset=UTF-8 While I appreciate the intent behind the suggestion to use protocols like this i still think that a pseudo-attribute 'format' which can/will be discarded is preferable to pseudo-protocols because (1) if you are going to use a URL rather than a path most include files will properly have a `file://` URL and (2) in principle it should be possible to include a markdown/csv/whatever file from a remote location, and in that case there will be a different protocol like http or ftp. thus something like this is safer, more robust, and clearer: ![file description or caption](path/or/url){format=markdown} torsdag 26 maj 2016 skrev Sergio Correia : > A bit late to the party, but: > > 1) An alternative to using extensions to indicate the required action > would be to use protocols. > For instance, this example pandoc filter: > > http://scorreia.com/software/panflute/guide.html#calling-external-programs > > Thus, you can do > > [Caption of the Table](csv://some/path.csv) > > Or maybe > > [some/path.md](include://) > > > > 2) For tables, I would also suggest to take a look at this filter: > > http://scorreia.com/software/panflute/guide.html#yaml-code-blocks > > It allows markdown like this: > > Some text > > ~~~ csv > title: Some Title > has-header: True > --- > Col1, Col2, Col3 > 1, 2, 3 > 10, 20, 30 > ~~~ > > More text > > > This combines pure CSV with options set up in YAML, so you can add > captions and customize the table. > > Since the CSV is handled by python's CSV library, it is quite powerful. > Also, complex things like selecting a subset of rows/cols, or adding > format, could be done in 1-2 lines of code. If you are interested, shoot me > an email and I can add a more complex working example. > > Cheers, > S > > > On Wednesday, May 25, 2016 at 7:18:10 AM UTC-7, Frank Colcord wrote: >> >> I'd like to second this proposal. As a simple Pandoc user, these would be >> very helpful: >> >> >> ![an image](foo.jpg) >> >> ![an include](foo.txt) >> >> ![a csv to be rendered as a table](foo.csv) >> >> thanks for all the development. >> >> Frank >> >> On Friday, May 20, 2016 at 6:55:10 PM UTC+1, jgabriele wrote: >>> >>> Hi Martin, >>> >>> There's also [issue 553](https://github.com/jgm/pandoc/issues/553 >>> >>> ). >>> >>> Personally, I think I like (from that issue thread) anton-k's original >>> idea: >>> >>> ![an image](foo.jpg) >>> >>> ![an include](foo.txt) >>> >>> ![a csv to be rendered as a table](foo.csv) >>> >>> (that is, based on filename extension) >>> >>> Those seem sensible, symmetrical, easy to remember, and I think fit well >>> with what pandoc already does (`![]()` is already like an include). >>> >>> As for a syntax to allow writing your csv data right into your md file, >>> ... Pandoc already supports a generous number of table formats that are >>> pretty easy to type. And for larger tables that you might be tempted to >>> copy/paste in, might be better easier to bang-include them (as in, >>> `![]()`), rather than muck up your pretty markdown file with a giant bunch >>> of csv data. :) >>> >>> -- John >>> >>> >>> >>> >>> On Fri, May 20, 2016, at 05:38 AM, Martin Fenner wrote: >>> >>> Dear group, >>> >>> The topic of CSV support in Pandoc has come up several times on this >>> list, includes this thread from 2014: >>> https://groups.google.com/forum/#!topic/pandoc-discuss/kBdJU_JktzI >>> >>> Since last year I work for an organisation that frequently deals with >>> tabular data (and helped organize CSVconf earlier this month), and I have >>> done some thinking on how CSV could fit into Pandoc. I see two important >>> use cases: >>> >>> * CSV reader that converts to tables in HTML, docx, latex, etc. >>> * CSV has a format to describe tables in markdown >>> >>> For the first use case I wrote a hack for the Jekyll blogging platform >>> this week that turns CSV files into markdown grid tables format that is >>> then processed by Pandoc (https://github.com/datacite/jekyll-csvy). I >>> would rather use Pandoc with a CSV reader, but my Haskell isn't good enough >>> to write one. But for now I can generate blog posts directly from CSV >>> files. Other people have done similar things with Pandoc and CSV. >>> >>> For the second use case I see a clear advantage of CSV over the various >>> attempts to format tables in markdown (simple_tables, multiline_tables, >>> grid_tables, pipe_tables). Everyone (and many tools) understands the CSV >>> format, and you can do most of the things with CSV that the other table >>> formats allow (multi-column formats and column alignment are a bit >>> trickier). This has been done before using Pandoc filters, but I think a >>> Pandoc "csv_tables" Pandoc extension would make this easier for the casual >>> user. Using the grid_tables example from the Pandoc documentation, this >>> could look like this: >>> >>> : Sample csv table. >>> >>> ,,, >>> Fruit,Price,Advantages >>> Bananas,$1.34,- built-in wrapper\n- bright color >>> Oranges,$2.10, - cures scurvy\n- tasty >>> ,,, >>> >>> I like three commas on a new line to indicate the start and end of a >>> table, but that is of course open for discussion. The format is much easier >>> to read and edit for humans compared to grid tables, the only tricky bit is >>> maybe the \n for multiline columns. I would think we could add metadata to >>> the fenced table blog similar to code blocks, e.g. >>> >>> ,,,{ #mytable .numberRows } >>> >>> One challenge with CSV is that it is an ill-defined format somewhat >>> similar to markdown before CommonMark. It may make things easier to only >>> support a specific CSV variant (e.g. comma as separator, header required, >>> comment lines not allowed). >>> >>> Thoughts? >>> >>> Best, >>> >>> Martin >>> >>> >>> >>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "pandoc-discuss" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/pandoc-discuss/20BF19CB-A2B0-4B19-A749-D750CDD89736%40martinfenner.org >>> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >>> >>> >> -- > You received this message because you are subscribed to the Google Groups > "pandoc-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > . > To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > . > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/b9147aed-bf8e-4136-8fd2-949dea1034ea%40googlegroups.com > > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhATyS6Nu49vbs-zp5UU2_05_dsPtzV2VHEsJ-q7i2VZPg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout. --001a11c33d5e9216f10533be3ac5 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable While I appreciate the intent behind the suggestion to use protocols like t= his i still think that a pseudo-attribute 'format'=C2=A0which can/w= ill be discarded is preferable to pseudo-protocols because (1) if you are g= oing to use a URL rather than a path most include files will properly=C2=A0= have a `file://` URL and (2) in principle it should be possible to include = a markdown/csv/whatever file from a remote location, and in that case there= will be a different protocol like http or ftp. thus something like this is= safer, more robust, and clearer:

=C2=A0 =C2=A0 ![file d= escription or caption](path/or/url){format=3Dmarkdown}

= torsdag 26 maj 2016 skrev Sergio Correia <sergio.correia-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
A bit late to the party, but:

1)= An alternative to using extensions to indicate the required action would b= e to use protocols.
For instance, this example pandoc filter:


= Thus, you can do

[Caption of the Table](csv://some= /path.csv)

Or maybe

<= div>[some/path.md](include= ://)



2) Fo= r tables, I would also suggest to take a look at this filter:

It allows markdown= like this:
Some text

~~~ csv
title: Some Title
has-header: True
---
Col1, Col2, Col3
1, 2, 3
10, 20, 30
~~~

More text

This combines pure CSV with option= s set up in YAML, so you can add captions and customize the table.

Since the CSV is handled by python's CSV library, it i= s quite powerful. Also, complex things like selecting a subset of rows/cols= , or adding format, could be done in 1-2 lines of code. If you are interest= ed, shoot me an email and I can add a more complex working example.

Cheers,
S


On Wednesday, May 25, 2016 at 7:18:10 AM UTC-7, Frank Colcord wrote:
I'd like to second= this proposal. As a simple Pandoc user, these would be very helpful:
<= br>
=C2=A0
=C2=A0=C2=A0=C2=A0 ![an image](foo.jpg)
=C2=A0
=C2=A0= =C2=A0=C2=A0 ![an include](foo.txt)
=C2=A0
=C2=A0=C2=A0=C2=A0 ![a csv = to be rendered as a table](foo.csv)
=C2=A0
thanks for all the deve= lopment.

Frank

On Friday, May 20, 2016 at 6:55:10 PM UTC+1, = jgabriele wrote:
Hi Martin,
=C2=A0
=C2=A0
Personally, I think I like (from that issu= e thread) anton-k's original idea:
=C2=A0
=C2=A0=C2=A0=C2=A0 ![an image](foo.jpg)
=C2=A0
=C2=A0=C2=A0=C2=A0 ![an include](foo.txt)<= br>
=C2=A0
=C2=A0=C2=A0=C2=A0 ![a csv to be rendered = as a table](foo.csv)
=C2=A0
(that is, based on filename extension)
=
=C2=A0
Those seem sensible, symmetrical, easy to = remember, and I think fit well with what pandoc already does (`![]()` is al= ready like an include).
=C2=A0
As for a syntax to allow writing your csv = data right into your md file, ... Pandoc already supports a generous number= of table formats that are pretty easy to type. And for larger tables that = you might be tempted to copy/paste in, might be better easier to bang-inclu= de them (as in, `![]()`), rather than muck up your pretty markdown file wit= h a giant bunch of csv data. :)
=C2=A0
-- John
=C2=A0
=C2=A0
=C2=A0
=C2=A0
On Fri, May 20, 2016, at 05:38 AM, Martin Fenner wrote:
Dear group,
<= /div>
=C2=A0
The topic of CSV support in Pandoc has come up several times on this l= ist, includes this thread from 2014:
=C2=A0
Since last year I work for an organisation that frequently deals with = tabular data (and helped organize CSVconf earlier this month), and I have d= one some thinking on how CSV could fit into Pandoc. I see two important use= cases:
=C2=A0
* CSV reader that converts to tables in HTML, docx, latex, etc.
* CSV has a format to describe tables in markdown
=C2=A0
For the first use case I wrote a hack for the Jekyll blogging platform= this week that turns CSV files into markdown grid tables format that is th= en processed by Pandoc (https://github.com/datacite/jekyll-csvy= ). I would rather use Pandoc with a CSV reader, but my Haskell isn'= t good enough to write one. But for now I can generate blog posts directly = from CSV files. Other people have done similar things with Pandoc and CSV.<= br>
=C2=A0
For the second use case I see a clear advantage of CSV over the variou= s attempts to format tables in markdown (simple_tables, multiline_tables, g= rid_tables, pipe_tables). Everyone (and many tools) understands the CSV for= mat, and you can do most of the things with CSV that the other table format= s allow (multi-column formats and column alignment are a bit trickier). Thi= s has been done before using Pandoc filters, but I think a Pandoc "csv= _tables" Pandoc extension would make this easier for the casual user. = Using the grid_tables example from the Pandoc documentation, this could loo= k like this:
=C2=A0
: Sample csv table.
=C2=A0
,,,
Fruit,Price,Advantages
Bananas,$1.34,- built-in wrapper\n- bright color
Oranges,$2.10, - cures scurvy\n- tasty
,,,
=C2=A0
I like three commas on a new line to indicate the start and end of a t= able, but that is of course open for discussion. The format is much easier = to read and edit for humans compared to grid tables, the only tricky bit is= maybe the \n for multiline columns. I would think we could add metadata to= the fenced table blog similar to code blocks, e.g.
=C2=A0
,,,{ #mytable .numberRows }
=C2=A0
One challenge with CSV is that it is an ill-defined format somewhat si= milar to markdown before CommonMark. It may make things easier to only supp= ort a specific CSV variant (e.g. comma as separator, header required, comme= nt lines not allowed).
=C2=A0
Thoughts?
=C2=A0
Best,
=C2=A0
Martin
=C2=A0
=C2=A0
=C2=A0


--
You received this message because you are= subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop r= eceiving emails from it, send an email to pandoc-discus= ...@googlegroups.com.
To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://gr= oups.google.com/d/optout.
=C2=A0

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pandoc-discuss+uns= ubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to pan= doc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https:= //groups.google.com/d/msgid/pandoc-discuss/b9147aed-bf8e-4136-8fd2-949dea10= 34ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.= google.com/d/msgid/pandoc-discuss/CADAJKhATyS6Nu49vbs-zp5UU2_05_dsPtzV2VHEs= J-q7i2VZPg%40mail.gmail.com.
For more options, visit http= s://groups.google.com/d/optout.
--001a11c33d5e9216f10533be3ac5--