Re: Other formats in pset like markdown, rst, mediawiki

From: Jan Michálek <godzilalalala(at)gmail(dot)com>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Other formats in pset like markdown, rst, mediawiki
Date: 2017-04-23 19:17:23
Message-ID: CAAYBy8aZ7oZYPTrY5n54siZLc+rceCWR8Q+3NXmL7z+v_Rx5HA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2017-04-19 10:05 GMT+02:00 Jan Michálek <godzilalalala(at)gmail(dot)com>:

> 2017-04-19 9:18 GMT+02:00 Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>:
>
>>
>> I still do not understand "why" this variant vs CommonMark or whatever
>>>> other version.
>>>>
>>>
>>> Because of simply implementation and readability (looks similar to
>>> aligned
>>> format) and it is comfortable to edit generated table (changing values,
>>> aligning columns etc.).
>>>
>>
>> Hmmm. Why not.
>>
>> Sorry, maybe I`m not understanding, there is problems with characters like
>>> pipe in cells, pipe should be escaped. What other special markdown
>>> characters? Escaping html code in cells?
>>>
>>
>> Markdown include characters/sequences which are interpreted as markers:
>> _Italic_, **Bold**, *** => horizontal rules, > block quote... `inline
>> code`... If they are interpreted within a table cell then probably they
>> should be escaped somehow.
>>
>
>
I have treated "_*|<>"

jelen=# SELECT E'**1**</br>\nrrr';
| **RECORD 1** | |
|--------------|------------------------------|
| ?column? | \*\*1\*\*&lt;/br&gt;</br>rrr |

jelen=#

> I`m able to sanitize characters, but complex sequences will be problem. I
> will look on this, but I don`t know, if I`m able to do this.
>
> My main interest on this was in rst. I`m using markdown only in github
> issues and my knowldge about md is poor.
>
>
>>
>> Main of the functionality is used from aligned format. I tested returned
>>>>> tables in retext and it works. If i have another character than
>>>>> standart
>>>>> pipe, it shouldn`t work.
>>>>>
>>>>> Sure. ISTM that you are currently using U+2502 instead of pipe, hence
>>>> my
>>>> point.
>>>>
>>>
>>> Could you send me example where?
>>>
>>
>> I already did in the first mail with the example output copy pasted from
>> psql. Some characters are pipe and others are BOX DRAWINGS LIGHT VERTICAL
>> characters.
>>
>> Maybe this is because I have in my ~/.psqlrc:
>>
>> \pset linestyle unicode
>> \pset border 2
>>
>
>> in which case your reuse of the the aligned stuff should take care of the
>> border setting to avoid using special UTF8 characters..
>>
>
I corrected it.

jelen=# \pset linestyle unicode
Line style is unicode.
jelen=# SELECT 1,2,3,4;
| **RECORD 1** | |
|--------------|---|
| ?column? | 1 |
| ?column? | 2 |
| ?column? | 3 |
| ?column? | 4 |

jelen=#

Regards
Jan

>
> Yes, it looks it is done by linestyle.
>
>
> jelen=# SELECT 1;
>
> | ?column? |
> |----------|
> | 1 |
>
>
> (1 row)
>
> jelen=# \pset linestyle unicode
> Line style is unicode.
> jelen=# SELECT 1;
>
> │ ?column? │
> |----------|
> │ 1 │
>
>
> (1 row)
>
> jelen=#
>
> I have prepared linestyle for rst and md, but I can`t switch linestyle
> outside, because if i did it
> \pset linestyle
> wrote "markdown" or "rst".
> I see, problem is only in cells borders, I will correct this.
>
> Jan
>
>
>>
>> --
>> Fabien.
>>
>
>
>
> --
> Jelen
> Starší čeledín datovýho chlíva
>

--
Jelen
Starší čeledín datovýho chlíva

Attachment Content-Type Size
psql-markdown-rst.patch text/x-patch 43.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2017-04-23 20:02:25 Re: pgbench tap tests & minor fixes
Previous Message chiru r 2017-04-23 18:55:59 pg_basebackup issue