sethyuan / logseq-plugin-tocgen

Generate a TOC of any page anywhere to quickly access the page's content.
MIT License
144 stars 10 forks source link

[FEATURE REQUEST] add auto-numbering #67

Closed DutchPete closed 1 year ago

DutchPete commented 1 year ago

I am reading a book and simultaneously highlighting with the PDF viewer. I nest my blocks under headings and subheadings. But when the page becomes long with many headings, it is easy to get the indentations and heading levels (the number of #) out of kilter, which means that the ToC, like me 😀, gets confused and leaves headings out.

To correct that, I keep having to count the indentation levels and the heading hashes to make sure they match. It would be useful to have automatic heading numbering, that way you don't have to count. Note: the numbers should not be embedded in the note, they should be more like an overlay.

In Obsidian there is a plug-in that deals with it, perhaps it could help in modifying it for Logseq. obsidian-heading-count-plugin.zip

sethyuan commented 1 year ago

I believe what you want is the "auto heading" feature in Logseq.

In the block's context menu, choose "auto heading":

image

This is how it looks like with "Woz theme":

image

In case you have the "Another Embed" plugin (my other plugin) installed, it has a customizable shortcut key that you can use to toggle the auto heading.

DutchPete commented 1 year ago

Thanks for the suggestion, but that is not what I am after. I am after auto-numbering. Like this:

## 2. Header title
    ### 2.1. Subheader title
        #### 2.1.1. Sub-subheader title
## 3. Another header title
etc.

Auto-heading could used in an ancillary function to make visible which heading is used. So in my example above the 3. Another header title could lead one to believe it is an H3 heading, when in fact it is an H2 âž™ auto-heading can help.

sethyuan commented 1 year ago

I see. I have another plugin that does numbered lists, https://github.com/sethyuan/logseq-plugin-ol

With it, you can achieve something like this:

image

But as you can see, currently it's not aligned to the heading's font style. This can be solved by a newer version of Logseq later (when it updates its Electron version).

DutchPete commented 1 year ago

I only want the headings to be numbered, not the blocks nested below them. Can the plug-in do that? If so, how do I do it?

sethyuan commented 1 year ago

Oh, I'm afraid it's not possible.

DutchPete commented 1 year ago

Yep, that's what I thought. Thanks for your suggestions anyway.

sethyuan commented 1 year ago

Maybe I can create another plugin especially to deal with this.

DutchPete commented 1 year ago

TBH, I don’t know if it is worth your while. I say that because I wonder if any other people have raised this issue with you. Sometimes though, you don’t know you need something, or don’ realize how your workflow could be improved a bit by a new thing. Perhaps it is worth waiting to see if others show an interest?