diary icon indicating copy to clipboard operation
diary copied to clipboard

Import diaries from existing markdown files

Open Weiming-Hu opened this issue 3 years ago • 8 comments

Thank you for publishing it on the app store. I have installed it and I like the calendar view!

I have a few questions and perhaps a request:

  1. Where are the markdown stored? I know some other apps just creates a root folder in files and store them there. How are files stored for Diary?
  2. Is it possible to import from existing markdown files? I have a large number of past diaries that I would like to somehow link them to this app. They are written in markdown and the file names are 'YYYYMMDD.md'. They are saved in Nextcloud Files.

Although I do not know JS very well, I regularly code in Python/C++ and I would love to contribute. If you could give me instructions, I might be able to figure out the details and submit PRs. Let me know how I can help.

Thanks!

Weiming-Hu avatar Mar 12 '22 18:03 Weiming-Hu

Hi @Weiming-Hu It's stored in the database, not in the file system. My plans are:

  1. Having an option to download single entries, years, months, and custom time frames as PDFs, Markdowns, and/or ODTs
  2. Having a sychronized PDF or Markdown in a "Diary" folder
  3. Having some kind of encryption, so that these personal entries are not in plaintext in a database. Although, no one should really have access to these entries, except for the admin and they can read all your files anyways, but I would like to have an additional layer of security here.

The export function is on my todo list for the near future.

I am a backend developer myself, and the frontend part does not come naturally for me. I've written a short blog entry about my setup

danielroehrig avatar Mar 12 '22 19:03 danielroehrig

How hard is it to index files from the file system? For example, users can select a root folder in the file system, perhaps "Diary". And then, when users select a date on the calendar, Diary just tries to find the file under the root folder. If it exists, it renders the content; if it does not exist, it creates an empty entry. Would something like this be along the lines you are working on? Thank you.

Regarding #3, I think it is always good to have a second layers of security. But as you've mentioned, admin already has the permission anyway. And actually this is just my personal instance. So I guess this is not a direct concern of mine.

Thank you.

Weiming-Hu avatar Mar 12 '22 22:03 Weiming-Hu

How would you map a file to a date? By creation timestamp, headline, filename? This might get complicated as not every country uses the same format to display dates.

danielroehrig avatar Mar 13 '22 19:03 danielroehrig

Thank you for mentioning that. I agree with you that date formats can be different for various countries. The easier thing I can think of is, maybe there could be an option for whether to store files in a database (as it is right now), or to store files in the File app by specified the root directory, like /Diary, and the date format, like %Y%m%d.md. This way, the app just tries to find the corresponding file to a date if it exists, otherwise the file will be created.

If you think this is worth doing, I can actually help with the implementation. I just need some instructions of what I should do. Thank you very much!

Weiming-Hu avatar Mar 14 '22 06:03 Weiming-Hu

The current version features a simple markdown export (and pdf export). If this is something that is really wanted, we can add the functionality to export directly into a folder structure in nextcloud.

danielroehrig avatar May 17 '22 18:05 danielroehrig

Thank you for your reply. Actually, I was more talking about import because I have a bunch of markdown files already. They are organized as such:

Root/
|-- 2022
|---- 0101.md
|---- 0102.md
....

The structure and filenames can definitely be changed. I'm just wondering whether there is a way for the app to be "pointed" to the root folder and detect markdown files within, so that I don't have to manually copy and paste all my past documents into the app.

Thank you

Weiming-Hu avatar May 17 '22 18:05 Weiming-Hu

Hello. That's a long topic, but I'd like to jump in as well. It would be really great to have a possibility to move import existing diary. I do have markdown files from 2016 and would like to be able to import them into diary app. Absolute best would be to use folders as for the notes app!

foegra avatar Sep 29 '23 19:09 foegra

My intentions with using the database and not the filesystem were

  • I know more about the database than nextclouds file system
  • I wanted to add meta data to the entries, which is easy if it's in a database

But currently I am stuck, because I don't have the time and experience to deal with the frontend and without a partner that can help me with that, I will try my best to keep the app working, but I won't expand it much further.

danielroehrig avatar Oct 07 '23 20:10 danielroehrig