[go: up one dir, main page]

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 - directive to create TOC #136

Open
melck opened this issue Dec 5, 2019 · 6 comments
Open

Feature - directive to create TOC #136

melck opened this issue Dec 5, 2019 · 6 comments
Labels
better-for-plugin It should be better as Marpit plugin

Comments

@melck
Copy link
melck commented Dec 5, 2019

I would like to have a directive to show a TOC with page numbers and link to slide.

Ideally with options to customize level of toc or ignore some title.

What do you think about that ?

@yhatt
Copy link
Member
yhatt commented Dec 11, 2019

Marp Core is hesitant adding any more features without consensus by community. Marp's built-in feature must be based on CommonMark, and we think that built-in features to enhance Markdown would have to be well-known syntax in Markdown and around communities.

TOC is available in over 15 markdown-it plugins, and Marp (Marpit) parser can extend by plugin. You can try to add TOC feature through available plugin by yourself (or can create another TOC plugin optimized for Marp).

// An example of engine.js for Marp CLI's custom engine
const { Marp } = require('@marp-team/marp-core')
const markdownItTableOfContents = require('markdown-it-table-of-contents')

module.exports = opts => new Marp(opts).use(markdownItTableOfContents)

We may consider to add if our community showed TOC plugin is worth to add as built-in feature of Marp.

@melck
Copy link
Author
melck commented Dec 13, 2019

Yes atm i have setup TOC like this, but i think it could be worth to add it as built-in plugin.

@yhatt
Copy link
Member
yhatt commented Dec 17, 2019

I don't think that. Our core must keep simple and the least features to be continued maintenance. We don't want burning out again by much requests just like an old Marp. It's a reason why adopted pluggable architecture.

Marp would have taken TOC plugin feature as built-in if it was well-known and taken in a lot of Markdown communities, but actually it does not. We are thinking users who want TOC are in the minority so it should provide as a third-party plugin.

@melck
Copy link
Author
melck commented Dec 17, 2019

I understand better. This is mainly for use in vscode and at the moment external plugins are not supported. I will wait for the external engine support by the vscode plugin.

@yhatt yhatt added the better-for-plugin It should be better as Marpit plugin label Dec 30, 2019
@cmi1993
Copy link
cmi1993 commented Mar 22, 2023

If I use Marp in vscode ,if there has any vscode plugins that can offer TOC feature?any Recommend?

@Chiogros
Copy link
Chiogros commented Jul 12, 2024

A tip to get a clickable TOC: use links to page's anchors.

<!-- _class: toc -->

# Table of content

1. [What is Marp](#what-is-marp)
2. [Why this theme](#why-this-theme)
3. [Available features](#available-features)

---

# What is Marp

---

# Why this theme

---

# Available features

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
better-for-plugin It should be better as Marpit plugin
Projects
None yet
Development

No branches or pull requests

4 participants