Improved asciidoc, asciidoctor and pandoc support

199 views
Skip to first unread message

Edward K. Ream

unread,
Oct 7, 2019, 11:31:52 AM10/7/19
to leo-editor
There are several major features here, spanning several issues, both open and closed.

This post will be pre-writing for Leo's documentation.

Support for @language pandoc

leo/modes/pandoc.py is based on leo/modes/md.py.

Live rendering of asciidoc and pandoc markup

The VR plugin recognizes @adoc nodes, @pandoc nodes (see below) and @language pandoc and @language md.

The VR plugin renders only p.b. Read on if you want render entire files...

Improved adoc command

Given an @adoc node of the form @adoc <full path>, this command does the following:

1. Scan the @adoc tree, writing the result to adoc_test.adoc.

The scan converts headlines to section markup. See help-for-command for adoc for more details.

2. Calls asciidoctor or asciidoc3 to convert adoc_test to adoc.html.

This command prefers asciidoctor to to asciidoc3 if both exist. 

New adoc-with-preview command

Runs the adoc command, then shows the resulting html in the default browser.

New pandoc and pandoc-with-preview commands

Much like the corresponding adoc commands, but uses pandoc markup, which is a variant of markdown.

The pandoc tool must exist.

Summary

Leo now supports @language pandoc.

The VR pane now renders asciidoc or pandoc markup live, but only for p.b.

The new adoc, adoc-with-preview,  pandoc, and pandoc-with-preview commands work on @adoc or @pandoc trees.

Please report your experiences with these new features.

Edward

Offray Vladimir Luna Cárdenas

unread,
Oct 7, 2019, 12:39:37 PM10/7/19
to leo-e...@googlegroups.com

Hi,

Nice to see those additions. In the Leo's documentation, I would expand about why the "pandoc tool must exist".

Cheers,

Offray

--
You received this message because you are subscribed to the Google Groups "leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/5af2ac1d-ccf7-4f15-8301-efdcfff26828%40googlegroups.com.

Matt Wilkie

unread,
Oct 7, 2019, 3:08:24 PM10/7/19
to leo-editor
Please report your experiences with these new features.

For me the external file is not created. See the desktop-integration.leo file at rev f0c07886d25ea892b15159d00f4ef531aae8a723 in devel.

Leo Log Window
Leo 6.1-devel, devel branch, build bd1ac64b20
2019-10-07 10:51:57 -0500
Python 3.6.9, PyQt version 5.13.0
Windows 10 AMD64 (build 10.0.18362) SP0
read
4 files in 0.03 seconds
read outline
in 0.06 seconds
 saved
: Desktop-integration.leo
 saved
: Desktop-integration.leo
 saved
: Desktop-integration.leo

-matt

Edward K. Ream

unread,
Oct 7, 2019, 4:42:15 PM10/7/19
to leo-editor
On Mon, Oct 7, 2019 at 11:39 AM Offray Vladimir Luna Cárdenas <off...@riseup.net> wrote:

Nice to see those additions. In the Leo's documentation, I would expand about why the "pandoc tool must exist".

Done in devel.

Edward

Edward K. Ream

unread,
Oct 10, 2019, 12:39:05 PM10/10/19
to leo-editor
On Mon, Oct 7, 2019 at 2:08 PM Matt Wilkie <map...@gmail.com> wrote:
Please report your experiences with these new features.

For me the external file is not created. See the desktop-integration.leo file at rev f0c07886d25ea892b15159d00f4ef531aae8a723 in devel.

Matt, what's the status of this now?

Edward

Matt Wilkie

unread,
Oct 10, 2019, 4:18:34 PM10/10/19
to leo-editor

For me the external file is not created. See the desktop-integration.leo file at rev f0c07886d25ea892b15159d00f4ef531aae8a723 in devel.

Matt, what's the status of this now?

It works after installing asiidoc3. I didn't understand that @adoc is fundamentally different from @file/clean/asis/etc. I've not worked with it's family (@rst, @pandoc) in a real way and was unaware of the very different workflow required.

-matt

Edward K. Ream

unread,
Oct 10, 2019, 5:48:56 PM10/10/19
to leo-editor
Thanks for this report. Glad all is well.

Edward

Chris George

unread,
Oct 11, 2019, 11:03:09 AM10/11/19
to leo-editor


Live rendering of asciidoc and pandoc markup

The VR plugin recognizes @adoc nodes, @pandoc nodes (see below) and @language pandoc and @language md.

The VR plugin renders only p.b. Read on if you want render entire files...



While this work is fresh in your mind is there any possibility of doing live rendering of Sphinx in the VR plugin?

Chris

Edward K. Ream

unread,
Oct 14, 2019, 3:05:58 AM10/14/19
to leo-editor
On Fri, Oct 11, 2019 at 10:03 AM Chris George <techn...@gmail.com> wrote:

While this work is fresh in your mind is there any possibility of doing live rendering of Sphinx in the VR plugin?

As I said in #333 (now renamed) Sphinx uses reStructuredText as its markup language, and Leo already renders rST live.

Oh, I suppose Leo could run the rST through the sphinx tool chain, and render the resulting html, or better, open the resulting page in a browser.  Rather than reopening #333, I have just created #1388.  It's schedule for Leo 6.1, but no guarantees.

Edward

jkn

unread,
Oct 16, 2019, 6:04:03 AM10/16/19
to leo-editor
I for one would appreciate a bit of an explanation of the 'very different workflow required'; I am kinda used to using @file etc. but abit unclear as to how @adoc and @pandoc change thigs (and I would like to use them)

Is it intentional that the {{sep}} mechanism doesn't seem to work with @adoc, for instance?

Thanks, J^n

Edward K. Ream

unread,
Oct 16, 2019, 7:24:16 AM10/16/19
to leo-editor
On Wed, Oct 16, 2019 at 5:04 AM jkn <jkn...@nicorp.f9.co.uk> wrote:

> I for one would appreciate a bit of an explanation of the 'very different workflow required'; I am kinda used to using @file etc. but abit unclear as to how @adoc and @pandoc change thigs (and I would like to use them)

The workflow is similar to the rst3 command and @rst nodes.

We don't want to run docutils, asciidoctor, asciidoc3, pandoc or sphinx every time we save @rst, @adoc,  @pandoc, or @sphinx nodes.

> Is it intentional that the {{sep}} mechanism doesn't seem to work with @adoc, for instance?

No.  I've just created #1398 for this.

Edward

jkn

unread,
Oct 17, 2019, 4:51:45 AM10/17/19
to leo-editor
Hi Edward
    Thanks for #1398.
I can see things a bit clearer after starting to read about rst3 and @rst nodes. To date (for creating PDF files from eg mediawiki files) I have been using @file and pandoc running externally. It will be good to get a handle on more automatic options.

    J^n

Edward K. Ream

unread,
Oct 17, 2019, 6:59:49 AM10/17/19
to leo-editor
On Thu, Oct 17, 2019 at 3:51 AM jkn wrote:

Thanks for #1398.

You're welcome.  It should happen in a few days.

Edward

Chris George

unread,
Oct 17, 2019, 9:42:14 AM10/17/19
to leo-editor


Oh, I suppose Leo could run the rST through the sphinx tool chain, and render the resulting html, or better, open the resulting page in a browser.  Rather than reopening #333, I have just created #1388.  It's schedule for Leo 6.1, but no guarantees.

Edward

The browser based rendering of the html works but wasn't the goal.

There simply is no other "live preview" sphinx editor out there and having Leo support it would be another "selling" feature for people, like me, who have been looking for one.

Chris

Edward K. Ream

unread,
Oct 17, 2019, 10:43:48 AM10/17/19
to leo-editor
#1388 Will happen for 6.1 b1.

Edward

jkn

unread,
Nov 12, 2019, 7:54:39 AM11/12/19
to leo-editor
Hi Edward
    Thanks for addressing #1398. I am getting to grips with using adoc a bit better now.

One thing though - the path for @adoc is relative to the base ('home') directory (confirmed by 'help-for-command adoc')  --- but for @file etc, it is relative to the directory containing the .leo file (https://leoeditor.com/directives.html#path-expressions)

Is there a reason for this difference?

    Thanks
    Jon N


jkn

unread,
Nov 21, 2019, 4:49:59 PM11/21/19
to leo-editor
Hi Edward

I've just added a comment to #1398, with a problem (or two) and a possible fix. I mention it here because I don't know if you get notification of comments.

Regards, Jon N

Reply all
Reply to author
Forward
0 new messages