Re: Markdown format output for psql, design notes

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: "Lætitia Avrot" <laetitia(dot)avrot(at)gmail(dot)com>
Cc: "Pg Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Markdown format output for psql, design notes
Date: 2018-11-29 12:43:38
Message-ID: 7b92d4f6-c454-4fd7-8158-3d8b44be3b27@manitou-mail.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Lætitia Avrot wrote:

> I suppose you mean in the standard output when the screen is too short to
> print the whole line ?
> Because if the output is redirected to a file (with `\o myfile` for
> example), the line end naturally when the row ends.

No I meant independently of the screen, if there's an LF character
in a cell. Or a '|' character, since that's the same problem: an
element of structure happening to be in the contents.
The specs mentioned upthread don't seem to give any indication
about that being supported.

Say we have:
SELECT E'foo\nbar' as "Header1", 'foo|bar' as "Header2"

If the markdown output was produced for the sole purpose of being
converted to HTML in the end, which is often the case, it would work
to use HTML entities in the output, for instance:

Header1|Header2
---|---
foo<br>bar|foo&#x7C;bar

This piece seems to be properly processed and rendered by markdown
processors I can try (pandoc, grip, github).

But then we'd also need to convert < > and & in the original contents
to the equivalent HTML entities, and that would really be
markdown-for-html instead of just markdown, I guess.

Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dmitry Dolgov 2018-11-29 12:45:15 Re: [HACKERS] WIP: long transactions on hot standby feedback replica / proof of concept
Previous Message Dmitry Dolgov 2018-11-29 12:36:21 Re: Configuring messages language on Windows