-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Generate TOC when exporting to HTML/PDF #80
Comments
weird, I can not add a Label. |
@joe223 Do you mean to write HTML directly in Mark Text? |
@Jocs just write example markdown content: [toc]
# Chapter 1
## Chapter 1.1
## Chapter 1.2
# Chapter 2 finally, we got <ul class="toc">
<li><a href="#1">Chapter 1</a></li>
<ul class="toc">
<li><a href="#1-1">Chapter 1-1</a></li>
<li><a href="#1-2">Chapter 1-2</a></li>
</ul>
<li><a href="#2">Chapter 2</a></li>
</ul>
# Chapter 1
## Chapter 1.1
## Chapter 1.2
# Chapter 2 |
|
I think there's an easier way to set a TOC within the text editor, like the VSCode extension does. Instead of adding a HTML string, just add more Markdown stuff inside some marked comments. |
TOC is not defined in GFM, so I suggest to only add this as export option. Because how do you want to keep the table of contents up-to-date if there is already one inserted. You have to delete the old one and insert it again. An export option for instance by replacing a special string like But this is a non-critical feature, it does not make Mark Text more stable. Why is it selected for A more stable Mark Text . How about adding adding a Feature Wishlist project for the fun stuff. |
Why hasn't the TOC function been implemented? |
@Jocs Why was this issue closed, it's still not implemented? I think it would be a good idea and would definitely prefer @gitfineon idea to generate the TOC when exporting a document to HTML/PDF and replace the
|
@fxha Yes, it is not implemented, because TOC is not the syntax in the GFM standard, and we also implemented TOC navigation in the sidebar, so I thought it was not necessary to implement it. When exporting, I think we can add an option. Whether to export the TOC. This is a good idea, maybe add it later when optimizing the export feature. |
It is important to allow the user to set the TOC Levels. Something like |
The GFM should be considered minimal requirements, not maximum allowed. Additional features will not harm its use. There are other additional features in Marktext that are not part of GFM so I don't see why this can't be an editor feature. The sidebar navigation feels very much like an addon and removes the clean interface of seeing only the document itself how the author intended. Many documents are created using [TOC] which is supported on other editors. |
I certainly do NOT agree with that, and it definitely does NOT remove the clean interface: the width can be set by the user. The sidebar navigation is a very useful feature and the devs have done a very good job implementing it. What's more, for those who do not like the side bar or temporarily do not need it, they can turn it off in the menu, View, Toggle Side Bar. |
@Jocs There doesn't need to be any extra syntax. Just ask if a TOC should be included on export. stackedit.io allows for this: The result adds a navigational sidebar to the html like this: |
I also hope it doesn't define the maximum that is possible. A Edit: I think it should be possible to discuss features in an open source community though. Dorian-DS expresses a valid view in my opinion and I would as well prefer to have a |
Hello, This feature is not yet implemented? I am trying for hours to find a way to generate a TOC here... |
I already have a basic implementation for this locally and can create a draft PR in the following days. It's not feature rich but works for navigating the file. |
Could Mark Text export pdf with the index? |
Please give us a choice in Preference to enanle [toc] on Editor. It's simply a pain to go deal with a big markdown without [toc] jumps. Otherwise I may have to find another alternative... |
GitLab has [TOC] implemented now. Would be really helpful to see it implemented in marktext, since I'm writeng quite extensive documentations for my projects. |
WE NEED IT ,THANKS |
I dug through the code a bit; even though the implementation for exports is "there", it seems that the option is disabled. Is that intentional? marktext/src/renderer/util/pdf.js Line 93 in 2bb405a
tocList is empty, and that method is called bymarktext/src/renderer/util/pdf.js Line 120 in 2bb405a
toc is passed to generateHtmlToc.This is then called by
this.editor.toc , which is created by
Several places also use marktext/src/muya/lib/utils/exportHtml.js Line 133 in 2bb405a
|
Hello, This feature is not yet implemented? I am trying for hours to find a way to generate a TOC too. |
Hi guys, thanks for your excellent work! Do you have any update? |
@allenzt have a look at this: #1290 (comment) |
A new feature:TOC
If there is a way to generator TOC automatically. Or, I just type
[toc]
in the first line,it will turn to A catalog and update while content is changing.The text was updated successfully, but these errors were encountered: