didix21 / mdutils

Python package contains a set of basic tools that can help to create a markdown file.
https://pypi.org/project/mdutils
MIT License
201 stars 48 forks source link

Reading existing markdown should populate headers for the TOC #33

Open symbiont-jon-bogaty opened 4 years ago

symbiont-jon-bogaty commented 4 years ago

Currently as of May 26th, 2020, on version 1.2.1, if I read an existing markdown file in and then generate a table of contents the table of contents is either blank or just contains new headers.

This makes it impossible to source an existing markdown file as a template, build off of it, and create an encompassing table of contents.

The underlying data store for the read markdown appears to be the generated text store with no attempt made to parse the underlying existing structures. One thought I had was perhaps as a compromise to avoid having to fully parse existing markdown, a regular expression could fire after reading existing markdown to at least ensure the TOC is correct?

didix21 commented 4 years ago

mdutils was not intended for parsing markdown files. But the thruth seems a good feature. So a good start as you say can be a parser for getting all Headers of an existing Markdown file.

Roman-Ka commented 4 years ago

Hi! If this is still relevant, can I have a stab? I would love to have this feature. I am new to open source, so it's not going to be quick but it seems there isn't a massive rush :)

didix21 commented 4 years ago

All yours! @Roman-Ka Thank you for contributing! I think it can be an interesting feature.

widal001 commented 3 years ago

@didix21 I came to this project looking for a similar set of functionality. I've been looking for a library that can can parse and manipulate markdown without first having to convert it to html like most existing parsers do (python-markdown, mistune, marko, etc.) Is this something you'd be willing to include into the roadmap of this project? If you'd be open to supporting that functionality, I'd be happy to create a separate issue dedicated to starting that effort.

Also understand if this feels outside the scope of mdutils. This just happens to be library I've found that is closest to supporting that use case.

didix21 commented 3 years ago

@widal001 it's an interesting feature, unfortunately I don't have much time for developing such feature. Right now I'm only doing the necessary maintenance of this repo. I hope having more time in the future but now impossible. In any case, I think we can define the requirements and use cases of it in this issue.