Closed antistereov closed 10 months ago
The same thing is happening to me. It was working this afternoon, after first install, but I updated, and now the contents are showing as a code block.
Hey! Can you past here the markdown that is generating the output from your screenshot? (This part 👇)
Hi Johan, I'm not the original poster, but I can provide ref of what's happening above.
By testing things out I think i have found the problem :
If heading 1 is not used, the contents page does not work and results in a code block:
Markdown:
Below is a test showing on my system the contents pages working when including heading 1
Markdown:
This solves my issue, but an unexpected quirk for users
Thanks (love the contents tree!)
Thanks! Indeed it looks like the generated markdown is not valid if the document doesn't contain a first-level heading (or if the hierarchy is not "respect", in a more general way)
I'll need to come up with a strategy to handle this case gracefully
minLevel
option as suggested in #11 it seems to me like instead of using the header level to absolutely define the TOC level, it should detect the delta of the header level to inform if the TOC level should be incremented or decremented.. this way a level 1 header followed by a level 4 header will just be detected as a delta and inform you to step down one TOC level.. i think that should handle all cases gracefully, so long as you clamp the TOC level to never increment or decrement above 1 or below some minLevel
Codeblock instead of usable TOC here too. Agggrrrhhh!
Codeblock instead of usable TOC here too. Agggrrrhhh!
Have you made sure you are using heading 1?
Have you made sure you are using heading 1?
I use H1 quite rarely, so no. For example, there is a page where I save various apps settings: H2 is used for each app name, H3 is used if there are too many settings (Firefox addons, Firefox themes). So far non-automatic TOC generator for Obsidian comes in handy for such a scenario.
I'll need to come up with a strategy to handle this case gracefully
- Start from second-level heading if no first-level is found in the page
- Introduce some
minLevel
option as suggested in minLevel #11- Other ideas are welcome!
@johansatge please don't hardcode or make it config, it will always be the wrong answer for someone or some use case. The easiest strategy is to scan the doc, find the min heading level and use that as the baseline for your indent... Confluence's TOC works the same way and just works.
Oh and forgot to say thank you for spending the time working on this!
I'm in exactly the same situation. H1 fixes the problem but I almost never use H1. The plugin is really great and I'm looking forward to using it! Thank you so much.
I'm in exactly the same situation. H1 fixes the problem but I almost never use H1.
My current workaround is to put an empty #
near the top of my page which renders the TOC with a double indent, but it's not the end of the world:
Hey! Thx for the feedbacks everyone 🙏
The easiest strategy is to scan the doc, find the min heading level and use that as the baseline for your indent...
Sounds like the most solid approach indeed - implemented in 1.0.4
. Please let me know if this version solved the issue.
Sounds like the most solid approach indeed - implemented in
1.0.4
. Please let me know if this version solved the issue.
Thx, works great!
The headings are correct and display the links perfectly. I can't click on it though since it's embedded in a code block.
I've been waiting for a plugin like this for so long! Thank you so much for putting in the effort and time!