From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/24449 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Lucas Escot Newsgroups: gmane.text.pandoc Subject: Re: Adding the highlight directive to the rST reader Date: Thu, 13 Feb 2020 04:44:54 -0800 (PST) Message-ID: References: <9e025799-6d50-40a9-b8ab-a075437cb2b9@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_3066_452751520.1581597894196" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="46166"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDZ7ZA4N5AOBBR4JSXZAKGQE64XBEEA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Feb 13 13:44:59 2020 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oi1-f186.google.com ([209.85.167.186]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1j2DrW-000Brx-UP for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 13 Feb 2020 13:44:59 +0100 Original-Received: by mail-oi1-f186.google.com with SMTP id d9sf2697349oij.4 for ; Thu, 13 Feb 2020 04:44:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=k/KpcQOqMR6pXk5kIiGM0Pfijb1N4oGcP12j7oSp+1g=; b=TkxhSAQeZPK9M6gddK3rdgT9Mb3Cf6U6C9vq0/ZkeL10SJFb67N6Noxta5IrxMhzVa rxGqieg9iOka+uKodveuktLpbkTJ938I6R697HF5miIGA5SQOfNvbA1FFcbqmxg4P0y3 UoQIT+zNzgWmQUhVDIpOCrDkJ23Ph9hMW8SmV3/0rduhXym7dapCk6+wbtmS9us+82MH dgXd0WxCxYq2llcZmJQc+ypKgbGETYXsaJFBrSCQfDKGLUHsfahkoB2mcZ4/2ixQ0faa nynhe8YuDf5vx9rRgMm5XG078e6dg+njjpy4Gy0m6W15eAmWZ02ZiwFiWa+vOvNZePov xP5w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=k/KpcQOqMR6pXk5kIiGM0Pfijb1N4oGcP12j7oSp+1g=; b=HUWG4ukVSpXDiv6ZugKjFn10vBJx21eXyVbYGsA6iXYzqxqZCyomBTEKyUQ+JiQwlW jgB0tvunb+MPv+dq9jMpzys1/a8NrySiFiMdodzSo3M0N33o3/Ze7+9tll+0uxTcHTL8 OtWSRB/W8Gwv9HH0bzNSJnnuIgS4iP64hvyBFZxSWAj3c5rf2Ski9fKgHa3OJM2hJBbF ZVLhjPimAT4+EnNGQgPnF3vldKwDIZGSv4BjCw7BMhyZx0h1e+RTmQNL1oXr9nbAn7pi GFddxYbpf8RDXPnawgmJj/beopAN4giRNEUorX7dN+/i/64bnPClYqN0yPR+GGI7LNBT bpzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:date:from:to:message-id:in-reply-to :references:subject:mime-version:x-original-sender:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=k/KpcQOqMR6pXk5kIiGM0Pfijb1N4oGcP12j7oSp+1g=; b=QEV5V4Ovj4MYxQKVyyYkb2iTdT36CuJ2Jr7H7ZkFxILVZxhxn0Gpckn3PzZDQB3sgW sDszru2BFIDbFlP0qH9jO3LGpEAXyVymFccicJIFliSRYNJmzFf6BkD/c4sLJJCp6Hc9 KfbzhGyJ52OnXyIIhbCpnwZl47rNygLW4eYrKCmhzNk5kzuS1/6Ln8VdtkdJIeEKF8ra l8/rORiphqvy9AGkpq5coE2Ki4GZdvtPKhSRIKnapKtBqiXZQk2hlL7hhpBwa7gJ6urH i2M7HwQbAB2vwPEZ4OB0iNy0X62SFsJPxJ5+gKPxzgEi5gR3IaPmsAkwsWjiiyTNUY19 qQlg== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: APjAAAU0co25u1OwYa6kmZLGT7vpILAnPLd4pOvGOsV3VGXKfEKfrQ7B t0Q5ktdcrf7IxLGl7u4PJCE= X-Google-Smtp-Source: APXvYqycEkxLHA4R5LuW6sdMbw94WBeAR2aYplLDRYmtWRFJK0Kv2bGEpzGb72e1aX8bn3vSx5aIYw== X-Received: by 2002:aca:cd46:: with SMTP id d67mr2793159oig.156.1581597897855; Thu, 13 Feb 2020 04:44:57 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a9d:7dd6:: with SMTP id k22ls36992otn.5.gmail; Thu, 13 Feb 2020 04:44:55 -0800 (PST) X-Received: by 2002:a05:6830:1050:: with SMTP id b16mr13349446otp.140.1581597894931; Thu, 13 Feb 2020 04:44:54 -0800 (PST) In-Reply-To: X-Original-Sender: lucas.escot-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-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:24449 Archived-At: ------=_Part_3066_452751520.1581597894196 Content-Type: multipart/alternative; boundary="----=_Part_3067_1945794860.1581597894196" ------=_Part_3067_1945794860.1581597894196 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > > However, this may be a case where it could help to control the Sphinx=20 > extensions via Pandoc's extensions mechanism, e.g. '-f rst-sphinx' to get= =20 > the docutils behavior? > That's a good idea! At first I was reluctant to add extensions for things= =20 that are specific to a single input format, but it seems there are already= =20 some language-specific extensions so this should not be a problem. I am willing to try and implement the rest of them then. Here are the ones= =20 that I find relevant: - note - warning - seealso? - rubric - hlist - literal-include - glossary? - tabularcolumns? And roles: - term Let me know if there is more I should know about. Le jeudi 13 f=C3=A9vrier 2020 11:37:20 UTC+1, latk a =C3=A9crit : > > From the perspective of a Pandoc user, adding more Sphinx extensions woul= d=20 > be extremely useful. Most RST documents seem to target Sphinx, and many o= f=20 > the extensions are also really convenient. > > However, this may be a case where it could help to control the Sphinx=20 > extensions via Pandoc's extensions mechanism, e.g. '-f rst-sphinx' to get= =20 > the docutils behavior? > > On Thu, 13 Feb 2020 at 10:30, Lucas Escot > wrote: > >> Hello everyone, >> >> I just implemented the highlight directive=20 >> =20 >> to the pandoc rST reader. >> This allows one to specify the default language to use when highlighting= =20 >> literal blocks. >> It is especially useful when writing rST in a literate agda or literate= =20 >> haskell file, where it is undesirable to have to specify the language at= =20 >> every code block. >> >> .. highlight:: haskell >> >> From now on code will be highlighted as haskell:: >> >> data Tree =3D Leaf | Node Tree Tree >> >> An other exemple too show how terse using literal blocks becomes:: >> >> main :: IO () >> main =3D putStrLn "Hello World!" >> >> We can change the language at any point in the document. >> >> .. highlight:: python >> >> So this block contains python code:: >> >> def main(): >> print("OK") >> >> An we can still disable having a default language: >> >> .. highlight:: >> >> This directive comes from the Sphinx extended rST (which argueably is on= e=20 >> of the most popular use case of rST out here, see readthedocs.io), >> this is why I am wondering *what is your stance on adding directives to= =20 >> the pandoc reader?* (which are not specified in the docutils reference) >> >> My opinion is that such an addition is quite reasonable, and most people= =20 >> use rST with sphinx and are therefore accustomed with said directive=20 >> already. >> >> You can see my implementation here: https://github.com/flupe/pandoc >> >> If you all agree it can be merged, what is the process? Should I create= =20 >> an issue mentionning the problem or just make a PR? >> >> Best, >> Lucas >> >> --=20 >> You received this message because you are subscribed to the Google Group= s=20 >> "pandoc-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send a= n=20 >> email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org . >> To view this discussion on the web visit=20 >> https://groups.google.com/d/msgid/pandoc-discuss/9e025799-6d50-40a9-b8ab= -a075437cb2b9%40googlegroups.com=20 >> >> . >> > --=20 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 e= mail to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/ef12ef00-1ff4-4b45-81fc-c8bfb2262efe%40googlegroups.com. ------=_Part_3067_1945794860.1581597894196 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
=
However, this may be a case where it could help to=20 control the Sphinx extensions via Pandoc's extensions mechanism, e.g.= =20 '-f rst-sphinx' to get the docutils behavior?
=
That's a good idea! At first I was reluctant to add exte= nsions for things that are specific to a single input format, but it seems = there are already some language-specific extensions so this should not be a= problem.

I am willing to try and implement the re= st of them then. Here are the ones that I find relevant:

- note
- warning
- seealso?
- rubric
- hlist
- literal-include
- glossary?
- tabularcolumns?

And roles:

- term

Let me know if there is more I should= know about.

Le jeudi 13 f=C3=A9vrier 2020 11:37:20 UTC+1, lat= k a =C3=A9crit=C2=A0:
From the perspective of a Pandoc user, adding more Sphinx ext= ensions would be extremely useful. Most RST documents seem to target Sphinx= , and many of the extensions are also really convenient.

However, this may be a case where it could help to control the Sphin= x extensions via Pandoc's extensions mechanism, e.g. '-f rst-sphinx= ' to get the docutils behavior?

On Thu, 13 Feb 2020 at 10:30, Lucas Escot <lucas...@g= mail.com> wrote:
Hello everyone,

I ju= st implemented the highlight directive to the pandoc rST reader.
This allows one to specify the default language to use when highlighting = literal blocks.
It is especially useful when writing rST in a lit= erate agda or literate haskell file, where it is undesirable to have to spe= cify the language at every code block.

..<= /span> highlight:: haskell
From now on code will be highlighted as haskell::
=

=C2=A0 data
Tree= =3D Leaf | Node Tree Tree

An other exemple too= show how terse using literal blocks becomes
::

=C2= =A0 main
:: IO ()
=C2=A0 main
=3D putStrLn = "Hello World!"

We can change the language = at any point in the document.

.. highlight<= /span>:: python

So this block contains python code= ::

=C2=A0
def main():
=C2=A0 =C2=A0 print("OK")

An we can still disable having a default langua= ge:

.. highlight
::

This directive comes from the Sphinx extended rST (which ar= gueably is one of the most popular use case of rST out here, see readthedocs.io),
this i= s why I am wondering what is your stance on adding directives to the pan= doc reader? (which are not specified in the docutils reference)

My opinion is that such an addition is quite reasonable, = and most people use rST with sphinx and are therefore accustomed with said = directive already.

You can see my implementation h= ere: https://github.com/flupe/pandoc

=
If you all agree it can be merged, what is the process? Should I= create an issue mentionning the problem or just make a PR?

<= /div>
Best,
Lucas

--
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-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pand= oc-discuss/9e025799-6d50-40a9-b8ab-a075437cb2b9%40googlegroups.co= m.

--
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 view this discussion on the web visit https://groups.google.com/d/= msgid/pandoc-discuss/ef12ef00-1ff4-4b45-81fc-c8bfb2262efe%40googlegroups.co= m.
------=_Part_3067_1945794860.1581597894196-- ------=_Part_3066_452751520.1581597894196--