note-refactor-obsidian
note-refactor-obsidian copied to clipboard
Content loss when extract to new file
I am a new user. I tried to extract a selection with heading and content to a new note, with heading as file name by calling out the command pallet, chose note refractor: extract to new note with header as file name. The plug-in create a new file with the heading as name, put a link to that file in my original file BUT all other content below the heading is missing. I cannot redo or do anything else to retrieve my content back again. It has gone!
Please advise if I did something wrong or I just use the incorrect command. If so, what is the correct one to accomplish what I intend to do?
Anyway, it is a pity that my thoughtful writing has gone forever!!!
I don't know what happened in your case, but just a quick tip is trying the file recovery (core plugin), if you loose anything (error/bug/manual mistake, etc.). It basically takes snapshot of your file "as is", every NN time (see settings). Docs here: https://help.obsidian.md/Plugins/File+recovery
And quick comment to your issue; If I do a selection in any note, and use the note refactor option "extract selection to new note - first line as file name", it does exactly that; extract my selection, first line (heading or not) as title, and includes the content (again, based on the previous selection), just fine. Also verified the split note by headings - h2, and that also works as expected (splits the note by h2 headings, and content is preserved, just fine). So basically, it seems to work as expected, for me.
Hope you find your content within file recovery :-).
I don't know what happened in your case, but just a quick tip is trying the file recovery (core plugin), if you loose anything (error/bug/manual mistake, etc.). It basically takes snapshot of your file "as is", every NN time (see settings). Docs here: https://help.obsidian.md/Plugins/File+recovery
And quick comment to your issue; If I do a selection in any note, and use the note refactor option "extract selection to new note - first line as file name", it does exactly that; extract my selection, first line (heading or not) as title, and includes the content (again, based on the previous selection), just fine. Also verified the split note by headings - h2, and that also works as expected (splits the note by h2 headings, and content is preserved, just fine). So basically, it seems to work as expected, for me.
Hope you find your content within file recovery :-).
Thanks. I will look at the file recovery plugin.
For the issue with refractor, it is unfortunate that it seems all of the options have the same problem to me. I tried to extract without file name, it asked me to type in the file name to append or to create, I create a new file and ... no content. What it did is:
- Created a new file with the file name I typed in
- Included the link from the original file in the new file
- Included the link of the new file in the original file where text was extracted
- No text or content in the new file Luckily, I have learned from the mistake and copied the content beforehand. So I pasted it in and move on with the task I was doing. But the problem is so weird... !
@lynguyen81 you should always be able to just "undo" whatever edits have happened in a document by pressing Ctrl/Cmd+Z as long as the file remains open.
If you split and close the file, this undo history is broken, so always check first that your refactoring did work. This standard undo history is taken care of by Obsidian even if you don't have the backup plugin enabled. (I can't recall if it was enabled by default; it should if it isn't)
I can feel the pain of losing data as it happened to me several times of the past decades! so here's the most simple tip: make backups before refactoring, which is by definition destructive editing. Not trying to be sarcastic, but I hope you learned something from this for the future!
Tip #2: You're on Github, so you might thinking about using Git to create a local Git repository for your files first and in the folder they are in. Then commit after every refactoring step, so you don't loose anything should things go south again.
You can still loose the repo's .git
folder after you're done refactoring, if you don't want to waste the disk space.
I have a consistent error with a refactoring of a very large file on H2 causing some but not all of the created notes to be empty.
I pulled the file back and reset some things and looked for obvious issues in the file and tried again with the same results.
In the attached file everything from the H1 header of Sheep Specific Tables and below has an empty note
Original file is AnimalTrakker_DB_V3 AnimalTrakker_DB_V3.md
Created top file is AnimalTrakker_Database_Creation_V3 AnimalTrakker_Database_Creation_V3.md
Examples of created empty notes. 2022-10-02_sheep_ebv_nsip_cross_reference_table.md 2022-10-02_codon136_table.md 2022-10-02_codon171_table.md 2022-10-02_temp_registration_cross_ref_table.md