On Wednesday, September 3, 2025 at 11:23:48 AM UTC-4 brian wrote:

I don't want the person to be able to modify the outline.  That is what I 
meant by "read only".  I want someone to view a representation in a browser 
that is similar to how it looks in the installed version of Leo and without 
having to install the leo executable.  I do want expand and collapse.  I 
know how to create expand and collapse in html but I'm not sure how to get 
the content out of Leo.  


Getting output from Leo is easy.  You walk the tree and for each node 
output headline and body text with whatever format you like.  The hard part 
is working out what the HTML should be, including how to manage and display 
the nesting level.
 ...
> I'm only concerned about exporting the outlines I create.  My outlines 
mostly have text but a few nodes have markdown.  

Do you want those markdown nodes to look as they do in the body editor, or 
do you want them rendered by a Markdown processor?

>  I'm not sure what you mean by "write the outline in RsT" and run rst3.  
When I ran Rst3, all the content in the html was on the left margin and it 
got confused about some of the node headlines (e.g., something like "I.  
Learn about leo").  I don't want a lot of constraints on the outlines I 
create.  I'm fine with minor edits but I don't want have to rework every 
node.  After trying Rst3, I assumed it could not do the task.  If rst3 can 
do this, I'd rather not write a plugin.  Can you point me in the right 
direction to get rst3 to do what I want?  

The rst3 command is oriented to creating an overall tree of 
RestructuredText (RsT) files in a form that Sphinx will be able to process 
to produce a set of documentation files, which are usually HTML but could 
also be pdf or other formats. The command by itself isn't going to create a 
nice finished HTML file. For this to make sense, the nodes in an @rst tree 
need to be written using RsT (Sphinx can be made to use Markdown files too, 
but the rst3 command only knows about RsT).

> I looked at VR3 and I could figure out how to export my entire outline.  
The documentation I found was sparse and I didn't dig into the source 
code.    

VR3 renders the tree's body, creating headlines using the text of each 
node's headline. It sounds like you want to include an outline panel, and 
VR3 won't do that.

> I've written the HTML with a hard coded outline where nodes will expand 
and collapse (used Bootstrap).  I just need to get my data out of Leo and 
into my html.  I planned on using the Django template engine to generate 
the html.  I assumed this would be an easy task.  LeoJS is a huge 
undertaking.  It seems tweaking rst3 to export to the Django template 
engine would be simple tweak of rst3.  If I'm missing something, let me 
know.    

As I said, you walk the tree of nodes in your outline, and output whatever 
you want based on the output format you want to create.  Walking the tree 
is easy. I've never used Django templates and I don't know what they should 
look like. To process the tree starting at the currently selected node 
(c.p), your script could look like this:

    for p1 in c.p.subtree():
        headline = p1.h
        text = p1.b
        # Do something with the the headline and text
        # Indentation level is p1.level()

> I'm looking for the easiest path to go from my Leo outline to html in a 
format I want.         
... It looks like I’ll have to write a plugin.  Would RST3 be the best 
place to start?  

You don't need a plugin, as best I can see, certainly not for experimenting 
until you can produce what you want.  You only need a Leo script, which you 
can attach to a button. Then select the top node you want to start from, 
and press the button to run the script. You could develop the whole thing 
in Leo's workbook. 

As I said, the hard part is figuring out what the output should look like. 
Anything that links two different nodes together is going to be harder.  
Anything that assembles several pieces of information (like tooltips that 
can optionally be made visible ) is going to be harder.  But those are not 
Leo issues. They are format and output issues.  That's what you need to 
figure out first.

-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/leo-editor/6347509e-592d-484a-ac77-7c3b88056973n%40googlegroups.com.

Reply via email to