{"id":13716195,"url":"https://github.com/sethyuan/logseq-plugin-tocgen","last_synced_at":"2025-05-07T05:32:23.069Z","repository":{"id":41499351,"uuid":"440004444","full_name":"sethyuan/logseq-plugin-tocgen","owner":"sethyuan","description":"Generate a TOC of any page anywhere to quickly access the page's content.","archived":false,"fork":false,"pushed_at":"2024-09-27T06:02:04.000Z","size":6368,"stargazers_count":145,"open_issues_count":3,"forks_count":10,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-14T04:34:38.582Z","etag":null,"topics":["logseq","logseq-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sethyuan.png","metadata":{"files":{"readme":"README.en.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-12-20T01:00:11.000Z","updated_at":"2024-11-09T13:11:55.000Z","dependencies_parsed_at":"2023-12-26T02:26:09.471Z","dependency_job_id":"96abdd08-db82-493d-871b-b30040cda647","html_url":"https://github.com/sethyuan/logseq-plugin-tocgen","commit_stats":null,"previous_names":[],"tags_count":130,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sethyuan%2Flogseq-plugin-tocgen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sethyuan%2Flogseq-plugin-tocgen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sethyuan%2Flogseq-plugin-tocgen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sethyuan%2Flogseq-plugin-tocgen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sethyuan","download_url":"https://codeload.github.com/sethyuan/logseq-plugin-tocgen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252823164,"owners_count":21809702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["logseq","logseq-plugin"],"created_at":"2024-08-03T00:01:07.970Z","updated_at":"2025-05-07T05:32:22.821Z","avatar_url":"https://github.com/sethyuan.png","language":"JavaScript","funding_links":["https://ko-fi.com/R5R213X8MC'"],"categories":["Rambdax"],"sub_categories":["sethyuan/logseq-plugin-tocgen"],"readme":"[中文](README.md) | English\n\n# logseq-plugin-tocgen\n\nGenerate a TOC of any page/block and quickly access the page/block's content. Buttons that go to top and bottom are also provided. Notice that the TOC is generated based on block levels.\n\n## Feature Highlights\n\n- Sync with content automatically\n- Shift click to open in the sidebar\n- Multiple ways to expand and collapse\n- Alt+Click to expand/collapse all descendants\n- Realtime tracking and highlighting of the current editing position in TOC\n- Embedded blocks and pages are supported\n- Drag and drop in TOC to organize the document structure\n- Dynamic TOC that follows the main page being edited\n- Fixed height TOC that scrolls in sync with the content\n- Quickly open an TOC to the right sidebar through the toolbar or the page's context menu\n- A \"back to top\" and \"go down\" button for easier jumping (optional)\n- Automatically go to the top or the position when you last left when switching pages (optional setting)\n\nFor details please go to the plugins settings.\n\n## Usage\n\n### Scenario 0, context menu\n\n![image](https://user-images.githubusercontent.com/3410293/230697775-bcca87fd-64a3-4c5c-9fc0-5f166fcedf59.png)\n\nhttps://user-images.githubusercontent.com/3410293/216609543-9edcf0de-6a87-441a-a599-0b50511bb713.mp4\n\n### Scenario 1, dynamic TOC\n\nhttps://user-images.githubusercontent.com/3410293/196385678-ba12ad05-6729-4909-b527-83f5d062fd07.mp4\n\n### Scenario 2, inline TOC\n\n![demo](demo_inline_toc.gif)\n\n### Support generating TOC entries for embedded blocks/pages\n\n![demo](demo_embed.gif)\n\nThe demo above used the plugin [Another Embed](https://github.com/sethyuan/logseq-plugin-another-embed), you're welcome to try it. The namespace collapsing behavior is part of my `custom.js`, you can find the code [here](https://gist.github.com/sethyuan/4ea9ed4305d0145ad565b2128ae6cef4).\n\n## Examples\n\nIf you want to generate a TOC that dynamically changes according to what page you're currently working on, you can use `*` as page name. Recommended.\n\n```\n{{renderer :tocgen2, *}}\n\nSpecify a height for the TOC and its content will scroll in sync with the page content. CSS height units are accepted. `auto` means height is dependant on content.\n{{renderer :tocgen2, *, auto}}\n{{renderer :tocgen2, *, 300px}}\n```\n\n```\nGenerate a TOC for the page where block belongs to.\n{{renderer :tocgen2}}\n{{renderer :tocgen2, [[]]}}\n\nCreate a TOC for a page, you can use \"[[\" to help find the page.\n{{renderer :tocgen2, pagename}}\n{{renderer :tocgen2, [[pagename]]}}\n\nYou can also create a TOC for a block, just paste its reference in.\n{{renderer :tocgen2, ((block-reference))}}\n\nYou can specify how many levels to generate.\n{{renderer :tocgen2, [[]], auto, 2}}\n{{renderer :tocgen2, [[pagename]], auto, 2}}\n{{renderer :tocgen2, ((block-reference)), auto, 2}}\n\nIf you want to include only H1-Hn headings (h), that is, `#` to `######` in markdown,\nor if you want any content be treated like a heading (any),\nyou need to use a third argument.\n{{renderer :tocgen2, [[page name]], auto, 1, h}}\n{{renderer :tocgen2, [[page name]], auto, 1, any}}\n```\n\nIf there is a block that you don't want it to appear in TOC, you can give it a `toc:: no` block property.\n\n## Style Customization\n\nYou can customize styles using the following CSS classes, `kef-tocgen-page` for page, `kef-tocgen-block` for block, `.kef-tocgen-active-block` for active block. Refer to Logseq's document for how to customize styles, place your modifications in `custom.css`.\n\n```css\n.kef-tocgen-page {\n  cursor: pointer;\n  line-height: 2;\n}\n.kef-tocgen-block {\n  line-height: 1.7;\n}\n.kef-tocgen-active-block {\n  font-size: 1.1em;\n  font-weight: 600;\n}\n```\n\nYou can also use `kef-tocgen-noactivepage` to customize dynamic TOC's (see Examples section above) content and style when no active page is detected.\n\n```css\n.kef-tocgen-noactivepage::before {\n  content: \"🈚️\";\n}\n```\n\n## Buy me a coffee\n\nIf you think the software I have developed is helpful to you and would like to give recognition and support, you may buy me a coffee using following link. Thank you for your support and attention.\n\n\u003ca href='https://ko-fi.com/R5R213X8MC' target='_blank'\u003e\u003cimg height='36' style='border:0px;height:36px;' src='https://storage.ko-fi.com/cdn/kofi1.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsethyuan%2Flogseq-plugin-tocgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsethyuan%2Flogseq-plugin-tocgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsethyuan%2Flogseq-plugin-tocgen/lists"}