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

TOC Navigator #62

Open
diethardsteiner opened this issue Jul 14, 2014 · 6 comments
Open

TOC Navigator #62

diethardsteiner opened this issue Jul 14, 2014 · 6 comments

Comments

@diethardsteiner
Copy link

When writing longer documents, I'd like to be able to jump quickly to a specific section of the document by just clicking on a link within a TOC (table of contents) navigator - this could be a heads up display or a side panel. The only Markdown Editor that currently implements this is MultiMarkdown Composer. This is the basic functionality I'd like to see. In a second phase, reorganising the content by dragging the headers within the TOC Navigator panel could be implemented.

@uranusjr
Copy link
Member

The HUD window used by MultiMarkdown Composer seems nice. We might just implement a read-only (clickable) tree structure.

@diethardsteiner
Copy link
Author

Sound great! The read-only clickable tree structure is the most important part for me.

@uranusjr uranusjr modified the milestone: 0.3 Jul 16, 2014
@masukomi
Copy link

I'd appreciate an optional clickable tree structure.

The HUD from MMC is nice too, but what I frequently end up wanting is

  • the ability to navigate between the headings in a large document
  • the ability to generate a TOC at the top of the document that links to the headers in the rest of the document.

Sadly the latter involves creating "<a name..." tags in the html for the "<a href..." tags to link to, and that's beyond the capabilities of a markdown parser that honors the spec (without getting ugly about your markdown code).

@diethardsteiner
Copy link
Author

I am not too sure if you are ware of it, but there is already a TOC feature available by using the [TOC] syntax. I requested this in another issue some time ago.
The HUD TOC display I asked for here doesn't have anything to do with the output, so maybe we can keep these topics separate. Ideally I suggest creating a new issue if you require some additional functionality, just to keep the purpose of this issue clear/focused. Thanks!

@aarononeal
Copy link

I was hoping it would be straightforward to implement an NSOutlineView for the TOC but it looks like:

  1. This requires implementation of a custom hoedown renderer.
  2. There is no easy way to get the markdown line numbers back from hoedown to know where to scroll the document view to (short of counting lines for each render call that comes through).

Any thoughts on approach?

@uranusjr
Copy link
Member

MacDown already uses a modified renderer for the main HTML content. As long as we don’t need to touch the parser it is perfectly fine to substitute something in Hoedown.

The second part is tricky. It used to be that Hoedown manipulates the input before processing it, so the original position is already lost before it reaches the renderer. I’m not sure whether it is still the case now though. Either way, it is currently very difficult (if not impossible) to implement this without serious hackery.

The people behind Hoedown is developing a version 4 that should resolve the issue, but that’s not nearly done as of now. My advice would be to just implement a read-only outline view for now, and maybe allow jumping to a header in preview. The rest can be filled in later.

(Also please, please don’t hesitate to lend a hand to Hoedown itself if you have an idea in C. It is a very nice library with very clean, readable source.)

@FranklinYu FranklinYu changed the title New Feature: TOC Navigator TOC Navigator Mar 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants