On Monday, April 9, 2018 at 8:37:18 PM UTC-5, Edward K. Ream wrote:

A new command, say insert-md-toc, would be better. It would insert the toc 
> at the cursor.

Recent revs replace the @toc hack with the insert-jupter-toc command. 

I spent more than an hour experimenting with what should be allowed in 
urls.  This is quite tricky, and depends on undocumented features of 
Jupyter.  The present code generates toc lines as follows:
line = '%s- [%s](#%s)\n' % (
    ' '*4*(level-1),
    clean_headline(p.h.replace(' ','-')))


def clean_headline(s):
    # Surprisingly tricky.
    # This could remove too much, but better to be safe.
    aList = [ch for ch in s if ch in '-: ' or ch.isalnum()]
    return ''.join(aList).rstrip('-').strip()


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+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to