snosov1 / toc-org

toc-org is an Emacs utility to have an up-to-date table of contents in the org files without exporting (useful primarily for readme files on GitHub)
GNU General Public License v3.0
287 stars 29 forks source link

If the org file has no headers, everything is deleted #81

Closed dmgerman closed 2 years ago

dmgerman commented 2 years ago

I wrote a document with no headers (I forgot to add them), then added

at the top.

The moment I saved the file, everything was deleted.

It might be useful to have some type of marker to delimite where the old header ends, so it does not delete text beyond that.

snosov1 commented 2 years ago

Hey, @dmgerman !

Well, Org does have a marker for that. Namely, a star character * to start a new header. I'm not sure Org has anything else and in that case, I'm not sure toc-org needs to invent/introduce a way to do this. Please, let me know if you have some specific ideas

dmgerman commented 2 years ago

One idea I have: if the file has no header (*, except for the :toc: one), then do nothing.