nobiot / md-roam

Use Org-roam with markdown files by adding Md-roam as a plug-in. Mix org and markdown files in a single Org-roam database.
GNU General Public License v3.0
333 stars 15 forks source link

question on how to use md-roam #77

Open randomwangran opened 1 year ago

randomwangran commented 1 year ago

I have a file, generated by interaction with chatgpt-arcana.el .

The file name is: 2023-03-05-12-33-51-emacs-chatgpt-arcana-chat-mode-introduction-and-description.chatgpt-arcana.md

------- system:

You are a large language model living inside Emacs, and an excellent conversation partner. Respond concisely.  Current Emacs major mode: chatgpt-arcana-chat-mode. Respond in well-formatted markdown, with headers, tables, lists, and so on.

------- user:

who are you?

------- assistant:

# Introduction

I am a large language model living inside Emacs, designed to engage in conversation and assist you with a variety of tasks. Whether you need help with coding, or writing, or simply want to chat, I am here to help!

# About Me

As an AI language model, I am constantly learning and evolving based on the input I receive from users like you. I am designed to understand and generate natural language, and I can help with a wide range of tasks, including:

- Answering questions
- Generating text
- Providing suggestions and recommendations
- And much more!

# How to Use Me

To use me, simply activate chatgpt-arcana-chat-mode in your Emacs buffer, and start typing. I will respond to your messages and provide suggestions and feedback as needed. If you need assistance or have any questions, simply ask and I will do my best to help!

I would like to use md-roam as connector to Org-roam, so that I can use it to index all the conversions with ai.com.

I installed md-roam with following setup:

(require 'org-roam)
(setq org-roam-directory (file-truename "path/to/org-roam-directory")) 
;; file-truename is optional; it seems required when you use symbolic
;; links, which Org-roam does not resolve
(setq org-roam-file-extensions '("org" "md")) ; enable Org-roam for a markdown extension
(add-to-list 'load-path "path/to/md-roam") ; installation as above
(require 'md-roam)
(md-roam-mode 1) ; md-roam-mode must be active before org-roam-db-sync
(setq md-roam-file-extension "md") ; default "md". Specify an extension such as "markdown"
(org-roam-db-autosync-mode 1) ; autosync-mode triggers db-sync. md-roam-mode must be already active

Then force change the font matter as:

title: Guide to Markdown Mode for Emacs
id: 2021-11--7T185856
category: \#markdown
------- system:

Nothing happens, the file name is like: 2023-03-05-12-33-51-emacs-chatgpt-arcana-chat-mode-introduction-and-description.chatgpt-arcana.md, so maybe that is the issue?

Do you have any suggestions on how mark-down file should be called and store? The file is generated in this snippet:

https://github.com/CarlQLange/chatgpt-arcana.el/blob/9d35495b1dbbe9a6a9b82ab732a8b1bc33fac6e1/chatgpt-arcana.el#L95-L109

nobiot commented 1 year ago

You need a yaml frontmatter on top of the file. The first line must be “---“ (three hyphens). And close the front matter with “---“ (three hyphens).

randomwangran commented 1 year ago

Thanks for sharing it.

After adding this info, I still can not find it via org-roam-node-find. Here's how I do it:

  1. Turn off org-roam-db-autosync-mode
  2. Switch to 2023-03-05-12-33-51-emacs-chatgpt-arcana-chat-mode-introduction-and-description.chatgpt-arcana.md
  3. Modify the buffer and save the change.
  4. M-x org-roam-node-find
  5. There is no Guide to Markdown Mode for Emacs
---
title: Guide to Markdown Mode for Emacs
id: 2021-11--7T185856
category: \#markdown
---

------- system:

You are a large language model living inside Emacs, and an excellent conversation partner. Respond concisely.  Current Emacs major mode: chatgpt-arcana-chat-mode. Respond in well-formatted markdown, with headers, tables, lists, and so on.

------- user:

who are you?
nobiot commented 1 year ago
  • Turn off org-roam-db-autosync-mode
  • Switch to 2023-03-05-12-33-51-emacs-chatgpt-arcana-chat-mode-introduction-and-description.chatgpt-arcana.md
  • Modify the buffer and save the change.

Kill the markdown buffer first. org-roam-db-autosync-mode adds find-file hook for the function to register the current node into the database. If the buffer is already open, no matter what you do to it won’t go into the database. Therefore, combined with md-roam, the sequence must be like this:

  1. Ensure the markdown buffer (note) is not open. If it is, kill it
  2. Activate md-roam-mode
  3. Activate org-roam-db-autosunc-mode
  4. Find-file and open the markdown buffer (this way, find-file hook adds some functions to after-save-hook — have a look)
  5. Modify the markdown buffer and save