everruler12 / roam2github

Automatic backups from Roam Research into your private GitHub repo
MIT License
151 stars 32 forks source link

Is it possible to extract markdown in user specific folder. #20

Open tharansakthi opened 2 years ago

tharansakthi commented 2 years ago

I am using your script. But I want to extract markdown to my _notes folder of Jekyll based project. Is it possible ?

No formatting needed. Just extract or move extracted markdown files to specific location.

Thanks a lot in advance.

everruler12 commented 2 years ago

You could try forking https://github.com/everruler12/roam2github/blob/main/roam2github.js then replace line 409 const markdown_dir = path.join(backup_dir, 'markdown', graph_name) with const markdown_dir = path.join(backup_dir, '_notes')

Then in your Actions repo, in main.yml line 30, replace: git clone -q https://github.com/everruler12/roam2github.git roam2github with git clone -q https://github.com/tharansakthi/roam2github.git roam2github and add th following after line 37:

          BACKUP_EDN: false
          BACKUP_JSON: false
          BACKUP_MARKDOWN: true

But I see you're using roam-to-git to generate notes, in which case this wouldn't work. There's probably a way after the "Generate notes" task in main.yml to add a run a task that does the renaming and moving. That would probably be easiest.

tharansakthi commented 2 years ago

Unfortunately, I am using this fork of roam-to-git -> https://github.com/DoomHammer/roam-to-git/tree/roam-to-garden

The formatter code inside this transforms the .md files and its file names when moving to "_notes" folder in Jekyll. But the template (https://github.com/maximevaillancourt/digital-garden-jekyll-template) I'm using doesn't need any formatting. Also the code doesn't publish entire roam graph, instead it only converts the notes referred under Public.md file.

So, I am thinking about moving to roam-to-git, but I don't how to move the extracted .md files in /markdown/ to _notes folder.

It would be nice to get an option to mention the location folder through git secrets or something like that in your original repo, so that many people like me benefit.

tharansakthi commented 2 years ago

You could try forking https://github.com/everruler12/roam2github/blob/main/roam2github.js then replace line 409 const markdown_dir = path.join(backup_dir, 'markdown', graph_name) with const markdown_dir = path.join(backup_dir, '_notes')

The above code didn't work as expected. It again stores content inside markdown/ directory. Did I do anything wrong?

const markdown_dir = path.join(backup_dir, '_notes', graph_name) - also not working.

Is there any other way?

tharansakthi commented 2 years ago

https://github.com/tharansakthi/roam2github/blob/main/backup.js code line number 413. replacing to -> const markdown_dir = path.join(backup_dir, '_notes')

Worked successfully

everruler12 commented 2 years ago

It would be nice to get an option to mention the location folder through git secrets or something like that in your original repo, so that many people like me benefit.

I have since moved on from Roam to Obsidian. Roam2Github was only intended for backups, not digital gardens. Roam has since released their own automatic backup solution. So I no longer use Roam2Github, and unfortunately don't plan on adding more features.

code line number 413. replacing to -> const markdown_dir = path.join(backup_dir, '_notes')

Ah, I missed line 413 which still included the graph name. Good catch! So are things working the way you want now? If not, there should still be a way using main.yml to move files.

tharansakthi commented 2 years ago

It worked like a charm. Thanks a lot for the help.