Re: Highlighting interactive REPL sessions.

Guenter Milde <[email protected]>
Newsgroups gmane.text.docutils.user
Message-ID <[email protected]>
On 2016-02-15, Oleksandr Gavenko wrote:
> How can I highlight interactive REPL sessions? Like:

>   bash# cd ~/sql
>   bash# mysql
>   Password:

>   [mariadb]> select 1;

> Among:

>   http://pygments.org/docs/lexers/

> I see possibility to use various:

>   .. code:: bash
>   .. code:: console
>   .. code:: pycon
>   .. code:: postgresql-console

The last one seems quite near to me...

> but even with Bash it only highlight "$" sign and think my "bash#" prompt as
> output...

> I see a way to add to "code" additional parameter (prompt regex):

>   http://docutils.sourceforge.net/docs/ref/rst/directives.html#code

> and implement parser in pygments

This should work - maybe postgresql-console is a good starting point.
Look/ask the Pygments community for details.

With a new parser/lexer "repl-console", the rst syntax would be::

   .. code:: postgresql-console

      bash# cd ~/sql

As docutils calls the external Pygments for syntax highlight, this should be
available to Docutils if it works with Pygments.
There is no need to
>  make own directive


Günter


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Docutils-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.