Coder Social home page Coder Social logo

logseq-toc-plugin's Introduction

💝 Sponsor this project on Github or ☕ Get me a coffee if you like this plugin!

Introduction

Interactive (style-able), real-time rendering of Table of Contents from markdown headers (#, ##, ###, ####, #####, ######).

Usage

Page-level table of contents

This is enabled by default. When encountering a page with markdown headers, a table of contents will be displayed on the left sidebar. You may change the header text (e.g. Table of Contents) in the plugin settings.

Inserting inline table of contents

Simply type /Insert inline Table of Contents and a Table of Contents will be generated based on the nested blocks under the Table of Contents block. Structure will follow the level of markdown headers.

Installation

This plugin is available on the marketplace.

Changing Colours

The CSS classes to change the look of the TOC are as follows. Please add them to your custom.css file to make the changes. Do note that you have to add !important so as to override the existing plugin style.

.toc {
  border: 1px solid #a2a9b1;
  padding: 10px;
  font-size: 80%;
  margin: 10px;
}

.toc-header {
  text-align: center;
  font-weight: bold;
  margin-bottom: 10px;
}

.toc ul {
  list-style-type: none;
  margin-left: 0;
}

.toc-item {
  color: #0645ad;
  text-decoration: none;
  color: var(--lx-accent-11,var(--ls-link-text-color,hsl(var(--primary)/.8)));
}

.toc-item:hover {
  text-decoration: underline;
  cursor: pointer;
}

.indent-1 { margin-left: 0; }
.indent-2 { margin-left: 1.5em; }
.indent-3 { margin-left: 3em; }
.indent-4 { margin-left: 4.5em; }
.indent-5 { margin-left: 6em; }
.indent-6 { margin-left: 7.5em; }

logseq-toc-plugin's People

Contributors

benjypng avatar

Stargazers

Constantinos avatar Charlie avatar  avatar Lisa Reiber avatar  avatar Kyle L. Davis avatar  avatar Sheldonimo avatar Minseok Kim avatar Feng Lu avatar Jeremy Zhang avatar Alberto Leal avatar Heng Dong avatar Bruno Melo avatar Lever avatar Alan avatar Douglas Camata avatar Jeremy Pinnix avatar Candide U avatar skyy avatar Feng Zeng avatar Gaga Pan avatar Claudia Doppioslash avatar  avatar Sergi avatar  avatar yuluo avatar Andy Huynh avatar  avatar jenn ❥  avatar laike9m avatar  avatar  avatar jjaychen avatar ori avatar Clifford Fajardo  avatar Devon Zuegel avatar Fastidious avatar Healer avatar Lee SeongWon avatar Hernán Manuel avatar  avatar  avatar

Watchers

 avatar Robert Barat avatar  avatar

logseq-toc-plugin's Issues

toc plugin will clear up some sub-blocks

Hi, I'm using ver 0.6.1 on Win10. I found out that the toc plugin will randomly eat up some sub-blocks under the toc parent blocks after collapsing and expanding.
Fortunately, this action will also create a duplicate file before action, so there is still some ways to revert the action.
Is there any conflictions between the plugin and the 0.6.1 version?

Custom css rules applied to table of contents aren't persisted across sessions

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'custom.css' file of the specific graph
  2. Add custom css rules to modify table of content style
    e.g. red border
.tocBoard {
  display: flex;
  flex-direction: column;
  padding: 1em;
  border: 1px solid #FF0000;
}

The custom.css reloads and shows the changed style until the graph is closed again. After closing and reopening the logseq graph the changes are lost even though they are saved in the custom.css file.

Expected behavior
As described in logseq-toc-plugin#changing-colours styling of table of contents should inherit styles as defined in custom.css and be persisted across sessions.

Screenshots
Custom styling rule for .tocBoard as defined in the custom.css is ignored
image

Desktop (please complete the following information):

  • OS: Windows
  • Logseq Version: 0.5.9

TOC scrolling after click doesn't work for large pages

TOC plugin scrolling doesn't work for large pages which use lazy-loading.
Scrolling to the section works only for blocks that are already loaded. If you open page that uses lazy-loading and you click on some block that is not loaded yet, it does nothing.

[FEATURE REQUEST] TOC for the page

Just like the plugin todo-master, rendering can apply to sub blocks and also the whole page.

TOC for sub block may break the hierarchy. For example, I write a page first, and if I want to use TOC, I must move whole page into the TOC block.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.