Add toc sidebar+dropdown (#272)

* Replace markdown-it-table-of-contents with markdown-it-toc-done-right

Co-authored-by: Erik Michelson <github@erik.michelson.eu>
Co-authored-by: Philip Molares <philip.molares@udo.edu>

Extract render window code

Co-authored-by: Erik Michelson <github@erik.michelson.eu>
Co-authored-by: Philip Molares <philip.molares@udo.edu>

add new package

fix stickyness

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>

show toc sidebar only if there is enough space

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>

* add min height class

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>

* Move markdown toc into own component

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>

* add sidebar buttons

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>

* Use other button color

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>

* Change name of component

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>

* Fix merge issues and make toc work again

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>

* pin dependencies

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>

* remove blank line

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>

* pin dependency

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>

* Fix anchors

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>

* Add use memo

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>

* Add change log entry for removal of custom slugify
This commit is contained in:
mrdrogdrog 2020-06-29 17:51:40 +02:00 committed by GitHub
parent 8ab7776a82
commit 50b04c8403
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 505 additions and 110 deletions

View file

@ -1,6 +0,0 @@
declare module 'markdown-it-table-of-contents' {
import MarkdownIt from 'markdown-it/lib'
import { TOCOptions } from './interface'
const markdownItTableOfContents: MarkdownIt.PluginWithOptions<TOCOptions>
export = markdownItTableOfContents
}

View file

@ -1,12 +0,0 @@
export interface TOCOptions {
includeLevel: number[]
containerClass: string
slugify: (s: string) => string
markerPattern: RegExp
listType: 'ul' | 'ol'
format: (headingAsString: string) => string
forceFullToc: boolean
containerHeaderHtml: string
containerFooterHtml: string
transformLink: (link: string) => string
}

View file

@ -0,0 +1,6 @@
declare module 'markdown-it-toc-done-right' {
import MarkdownIt from 'markdown-it/lib'
import { TocOptions } from './interface'
const markdownItTocDoneRight: MarkdownIt.PluginWithOptions<TocOptions>
export = markdownItTocDoneRight
}

View file

@ -0,0 +1,19 @@
export interface TocOptions {
placeholder: string
slugify: (s: string) => string
containerClass: string
containerId: string
listClass: string
itemClass: string
linkClass: string
level: number | number[]
listType: 'ol' | 'ul'
format: (s: string) => string
callback: (tocCode: string, ast: TocAst) => void
}
export interface TocAst {
l: number
n: string
c: TocAst[]
}