hipstersmoothie / obsidian-plugin-toc

Create a tables of contents for a note.
286 stars 20 forks source link

Add MD link option and GH link option (closes #30 and #8) #33

Closed 4very closed 1 year ago

4very commented 1 year ago

Added option for Markdown link format [Header](#header) in Obsidian format or Github format.

For Markdown section links Obsidian URL Encodes the section text to determine the proper link text.

Implementation: https://github.com/4very/obsidian-plugin-toc/blob/6d518849ba223aea1d09f8fa93bfa241153543eb/src/create-toc.ts#L87-L88

But section links in Github is a massive headache, luckily other people have already solved this problem in anchor-markdown-header. If you want to see how bad of a problem this is look at, https://github.com/thlorenz/anchor-markdown-header/issues/36.

Implementation: https://github.com/4very/obsidian-plugin-toc/blob/6d518849ba223aea1d09f8fa93bfa241153543eb/src/create-toc.ts#L85-L86

Currently anchor-markdown-header has no Typescript support, so commit https://github.com/4very/obsidian-plugin-toc/commit/db257e0bdcf42d37eba6520b83a7c78b6eb8402b is temporary until https://github.com/thlorenz/anchor-markdown-header/pull/50 gets merged.

Thank you and let me know if you need any more information. ❤️

Closes #30 and #8

github-actions[bot] commented 1 year ago

:rocket: PR was released in 0.2.0 :rocket: