Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Make Tags optionally visible in TOC items, from a toggle option in config settings #33

Closed
acsr opened this issue Jun 13, 2022 · 4 comments

Comments

@acsr
Copy link

acsr commented Jun 13, 2022

I have (imported) content using tags in headlines to be displayed as TOC entries to make them useful (tags are part of readable text)

For me modifying the local ~/.logseq/plugins/logseq-tocgen/dist/index.****.js by commenting out the line containing the code from the source linked below works as workaround but will not survive updates.

content = content.replace(/(?:^|\s)#\S+/g, "")

Origin of code: https://github.com/sethyuan/logseq-plugin-tocgen/blob/master/src/utils.js#L25

I would be great to make the filtering of tags optionally to be disabled from the config.

@acsr
Copy link
Author

acsr commented Jun 13, 2022

Alternatively wrap the tags in a html span with class markup to toggle them from css. Should not be a performance killer.

@sethyuan
Copy link
Owner

Can you try to use the page reference syntax [[]] instead of tags #? tocgen was designed with the following facts in mind:

  • Page reference is used when it's part of the content.
  • Tag is used when an "extra" label for the content is needed.

That's why I left page references content intact while I removed tags from the TOC.

@acsr
Copy link
Author

acsr commented Jun 14, 2022

I completely agree with you, I have a customer delivering content to me, that rised that issue and I wanted to keep that in sync without change. Your excellent tool helped me a lot to keep the overview on those external topics.

One of the challenges of mastering Logseq for people not aware of consequences of their markup is when their experience grows later.

So creating on the fly transformations to clean up markup later are big helpers (for me) but also can create great damage.

To be honest or the TOC I had to prefix the corresponding lines with preceeding headline levels as well (aka #### etc.)
So for now forget the request, but it is a challenge to meet the restrictions to get a nice TOC anyway.

Since the TOC is not rendered on mobile and during export, I am rethinking the approach and trying to figure out to "hardrender" a copy of the TOC for Export and how to manage that. Logseq is still beta and there are lots of challenges and I agree in not bloating options resulting in dead ends later.

@sethyuan
Copy link
Owner

OK, I'm gonna close this issue then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants