Closed kl2111 closed 1 year ago
@dom8509 hello, can you give me some advice.
Hi, the script only exports public pages. Have you set the property "public:: true" at the pages you want to export to markdown?
Hi, the script only exports public pages. Have you set the property "public:: true" at the pages you want to export to markdown? hi there:
Thank you for your prompt response. I appreciate your insights regarding the issues discussed.
Firstly, regarding the property public:: true
, I understand that it was not present in the test folder I used.
My main objective is to transform Logseq notes into a more conventional Markdown format. I would greatly appreciate it if you could offer any suggestions or recommendations in this regard. I am open to exploring different approaches or techniques to achieve the desired outcome.
Thank you for your attention and support.
Did it work if you add the property for a test note? I can add an option to export all notes (also not public ones) if you like. Then I will turn this into a feature request.
Did it work if you add the property for a test note? I can add an option to export all notes (also not public ones) if you like. Then I will turn this into a feature request.
Hi, there
Thank you for your reply.
I am writing to discuss some issues I encountered while exporting Logseq markdown files and the resulting empty output folders.
Firstly, I attempted Method A by opening the folder where the exported Logseq markdown files are stored (e.g., /users/Afolder/Blogseq
) in the terminal. Then, I ran the command logseq-to-markdown -o /users/Afolder/output -b -t Blogseq
in that directory. However, this resulted in an error, as shown below .
ohyoungdeMacBook-Pro:convert ohyoung$ logseq-to-markdown -o /Users/ohyoung/Downloads/convert -b -t logseq
Loading graph.
node:internal/process/esm_loader:42
internalBinding('errors').triggerUncaughtException(
^
yl [Error]: EISDIR: illegal operation on a directory, read
at new yl (file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@dom8509/nbb-logseq/lib/nbb_core.js:177:94)
at $APP.rn.j (file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@dom8509/nbb-logseq/lib/nbb_core.js:1420:319)
at mr (file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@dom8509/nbb-logseq/lib/nbb_core.js:314:130)
at file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@dom8509/nbb-logseq/lib/nbb_core.js:602:14
at O (file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@dom8509/nbb-logseq/lib/nbb_core.js:296:469)
at file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@dom8509/nbb-logseq/lib/nbb_core.js:602:286
at O (file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@dom8509/nbb-logseq/lib/nbb_core.js:296:469)
at file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@dom8509/nbb-logseq/lib/nbb_core.js:453:244
at O (file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@dom8509/nbb-logseq/lib/nbb_core.js:296:469)
at file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@dom8509/nbb-logseq/lib/nbb_core.js:544:322 {
data: {
K: null,
O: 6,
H: [
{
Hc: null,
name: 'type',
S: 'type',
Tc: 1174270348,
I: 2153775105,
N: 4096
},
{
Hc: 'sci',
name: 'error',
S: 'sci/error',
Tc: -979082803,
I: 2153775105,
N: 4096
},
{
Hc: null,
name: 'line',
S: 'line',
Tc: 212345235,
I: 2153775105,
N: 4096
},
57,
{
Hc: null,
name: 'column',
S: 'column',
Tc: 2078222095,
I: 2153775105,
N: 4096
},
24,
{
Hc: null,
name: 'message',
S: 'message',
Tc: -406056002,
I: 2153775105,
N: 4096
},
'EISDIR: illegal operation on a directory, read',
{
Hc: 'sci.impl',
name: 'callstack',
S: 'sci.impl/callstack',
Tc: -1621010557,
I: 2153775105,
N: 4096
},
mh {
state: {
K: null,
first: {
K: null,
O: 5,
H: [Array],
C: null,
I: 16647951,
N: 139268
},
Tb: {
K: null,
first: [Object],
Tb: [Object],
count: 3,
C: null,
I: 65937646,
N: 8192
},
count: 4,
C: null,
I: 65937646,
N: 8192
},
I: 32768,
N: 0
},
{
Hc: null,
name: 'file',
S: 'file',
Tc: -1269645878,
I: 2153775105,
N: 4096
},
'/Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/src/logseq_to_markdown/graph.cljs'
],
C: null,
I: 16647951,
N: 139268
},
sg: Error: EISDIR: illegal operation on a directory, read
at Object.readSync (node:fs:757:3)
at tryReadSync (node:fs:438:20)
at Module.readFileSync (node:fs:484:19)
at Yba (file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@dom8509/nbb-logseq/lib/nbb_core.js:319:112)
at fca (file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@dom8509/nbb-logseq/lib/nbb_core.js:344:28)
at file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@dom8509/nbb-logseq/lib/nbb_core.js:636:100
at O (file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@dom8509/nbb-logseq/lib/nbb_core.js:296:469)
at file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@dom8509/nbb-logseq/lib/nbb_core.js:407:307
at file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@dom8509/nbb-logseq/lib/nbb_core.js:601:485
at O (file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@dom8509/nbb-logseq/lib/nbb_core.js:296:469) {
errno: -21,
syscall: 'read',
code: 'EISDIR'
},
description: undefined,
number: undefined,
fileName: undefined,
lineNumber: undefined,
columnNumber: undefined
}
Node.js v20.1.0
Secondly, I tried Method B by creating a script where each individual note file is processed using logseq-to-markdown
. Although the script appeared to run successfully, it generated empty "assets" and "pages" folders. It is worth noting that some of the notes being processed in this manner include markdown notes with the public:: true
attribute.
The script is batch_convert.sh
#!/bin/bash
folder_path="/Users/ohyoung/Downloads/Documents_markdown_1684156680/pages"
output_path="/Users/ohyoung/Downloads/Documents_markdown_1684156680/output_path"
for file in "$folder_path"/*.md
do
if [ -f "$file" ]; then
filenameA=$(basename -- "$file")
filenameB="${filenameA%.*}"
logseq-to-markdown -o "$output_path" -v "$filenameB"
fi
done
The original question was the result of running the software this way:https://github.com/dom8509/logseq-to-markdown/issues/4#issue-1710316470
I have attached relevant screenshots for your reference. I would greatly appreciate any insights or assistance you can provide to help resolve these issues and ensure the successful export of Logseq markdown files.
Thank you for your attention to this matter.
Let me take a look at it this weekend😊
Let me take a look at it this weekend😊
Haha, I'm still waiting for your help~
Hi @KL2101, I updated the nbb-logseq package to the latest version. I also included a new command line arg -a to export all pages and fixed the queries. You can give it a try in the branch export-private-pages.
Let me know if it fixed the problem😉
Hi @KL2101, I updated the nbb-logseq package to the latest version. I also included a new command line arg -a to export all pages and fixed the queries. You can give it a try in the branch export-private-pages.
Let me know if it fixed the problem😉
Thank you for your assistance so far. Here is a summary of my current situation:
logseq-to-markdown
npm package and installed the logseq-nbb
npm package.logseq-to-markdown
tool, I've managed to convert the notes in the pages
directory successfully.However, I'm currently facing a few issues:
a. The tool doesn't export notes from the journals
directory, only those in the pages
directory. To circumvent this, I'm considering moving the notes from the journals
directory to the pages
directory.
b. The tool only exports notes marked as "public". I'm trying to find a way for the tool to export all notes, not just the "public" ones.
c. When exporting notes, the tool only removes the "+" symbol at the first level, not at all levels. I'm looking for a way to have the tool remove the "+" symbol at all levels.
I appreciate any further guidance you can provide on these matters.
have you set the -a command line argument to export all pages? This should export the journal pages as well.
I have tried just now, but Prompt error
Seems like you are still using the old version of the script. I created a new release v0.4.0. You can install the new version and then the cli arg should work.
Regarding the "+" symbol, I recommend creating a post-processing script to customize the exported Markdown files to your needs, as everyone has different needs and the export script generally maintains the outline structure at lower levels.
Seems like you are still using the old version of the script. I created a new release v0.4.0. You can install the new version and then the cli arg should work.
Regarding the "+" symbol, I recommend creating a post-processing script to customize the exported Markdown files to your needs, as everyone has different needs and the export script generally maintains the outline structure at lower levels.
Hi there, bother you again.
I've done the following steps:
logseq-to-markdown
through the terminal using npm."version": "0.4.0"
was displayed in the package-lock.json
file.logseq-to-markdown -a -o /Users/ohyoung/Downloads/Markdown Documents
.Please guide me: if I were to start from scratch, and instead of downloading the package through npm, I directly downloaded the logseq-to-markdown-0.4.0.zip
file, what should I do?
Thank you very much.
Can you give me the full error log? seems like you have some conditions in your graph that I didn't handle.
Can you give me the full error log? seems like you have some conditions in your graph that I didn't handle.
ohyoungdeMacBook-Pro:Documents ohyoung$ logseq-to-markdown -a -o /Users/ohyoung/Downloads/Markdown Documents
Loading graph.
Graph Documents loaded successfully.
Exporting data to /Users/ohyoung/Downloads/Markdown ...
In get-all-public-and-private-pages
node:internal/process/esm_loader:42
internalBinding('errors').triggerUncaughtException(
^
el [Error]: Index out of bounds
at new el (file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:179:94)
at $APP.Sm.j (file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:1267:319)
at file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:332:310
at Jq (file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:332:319)
at file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:563:399
at Q (file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:308:469)
... 3 lines matching cause stack trace ...
at Q (file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:308:469) {
data: {
K: null,
O: 6,
H: [
{
Nc: null,
name: 'type',
S: 'type',
Vc: 1174270348,
I: 2153775105,
M: 4096
},
{
Nc: 'sci',
name: 'error',
S: 'sci/error',
Vc: -979082803,
I: 2153775105,
M: 4096
},
{
Nc: null,
name: 'line',
S: 'line',
Vc: 212345235,
I: 2153775105,
M: 4096
},
42,
{
Nc: null,
name: 'column',
S: 'column',
Vc: 2078222095,
I: 2153775105,
M: 4096
},
40,
{
Nc: null,
name: 'message',
S: 'message',
Vc: -406056002,
I: 2153775105,
M: 4096
},
'Index out of bounds',
{
Nc: 'sci.impl',
name: 'callstack',
S: 'sci.impl/callstack',
Vc: -1621010557,
I: 2153775105,
M: 4096
},
Hh {
state: {
K: null,
first: {
K: null,
O: 5,
H: [Array],
D: null,
I: 16647951,
M: 139268
},
'$b': {
K: null,
first: [Object],
'$b': [Object],
count: 4,
D: null,
I: 65937646,
M: 8192
},
count: 5,
D: null,
I: 65937646,
M: 8192
},
I: 32768,
M: 0
},
{
Nc: null,
name: 'file',
S: 'file',
Vc: -1269645878,
I: 2153775105,
M: 4096
},
'/Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/src/logseq_to_markdown/graph.cljs'
],
D: null,
I: 16647951,
M: 139268
},
cause: Error: Index out of bounds
at si (file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:124:286)
at $APP.bm.j (file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:998:325)
at file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:563:324
at Q (file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:308:469)
at file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:562:321
at Q (file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:308:469)
at file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:1719:281
at Q (file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:308:469)
at file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:1721:157
at Q (file:///Users/ohyoung/.nvm/versions/node/v20.1.0/lib/node_modules/@dom8509/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:308:469),
description: undefined,
number: undefined,
fileName: undefined,
lineNumber: undefined,
columnNumber: undefined
}
Node.js v20.1.0
I added some debug output to the Script. Can you checkout the branch https://github.com/dom8509/logseq-to-markdown/tree/bugfix-index-out-of-bound and run the script again and send me the output.
You can run it now via package.json script without installing it:
example with your commands:
yarn
or npm
npm run dev -- -a -o /Users/ohyoung/Downloads/Markdown Documents
- npm run dev -- -a -o /Users/ohyoung/Downloads/Markdown Documents
Hi there,
I hope this email finds you well. First of all, I would like to express my gratitude for your assistance and patience in helping me with the logseq-to-markdown script. Your support is greatly appreciated.
I would like to report an issue I encountered while using the script. I followed the steps outlined below:
Created a folder named test
and placed the exported and extracted Markdown notes folder Documents
from Logseq into the test
folder. The Documents
folder contains two subfolders, journeys
and pages
which include Markdown notes.
Accessed the test
folder through the terminal and downloaded the script file using the following command:
npm install @dom8509/logseq-to-markdown
Additionally, based on your provided link https://github.com/dom8509/logseq-to-markdown/tree/bugfix-index-out-of-bound, I separately downloaded the package.json
file and replaced the existing one in the test
folder.
Executed the following command in the terminal:
npm run dev -- -a -o /Users/ohyoung/Downloads/Markdown Documents
In the "Downloads" folder, I obtained a folder named markdown
containing two subfolders, assets
and pages
However, these folders are empty.
Here is the error log:
ohyoungdeMacBook-Pro:test ohyoung$ npm install @dom8509/logseq-to-markdown
added 78 packages in 6s
10 packages are looking for funding
run `npm fund` for details
ohyoungdeMacBook-Pro:test ohyoung$ npm run dev -- -a -o /Users/ohyoung/Downloads/Markdown Documents
> @dom8509/logseq-to-markdown@0.4.0 dev
> node index.mjs -a -o /Users/ohyoung/Downloads/Markdown Documents
node:internal/modules/cjs/loader:1085
throw err;
^
Error: Cannot find module '/Users/ohyoung/Desktop/test/index.mjs'
at Module._resolveFilename (node:internal/modules/cjs/loader:1082:15)
at Module._load (node:internal/modules/cjs/loader:928:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v20.1.0
Why didn't you just checkout the branch? Try it this way:
- npm run dev -- -a -o /Users/ohyoung/Downloads/Markdown Documents
Hi there,
I hope this message finds you well.
I wanted to extend my sincerest gratitude for your detailed guidance. It has been incredibly helpful for a computer newbie like me. I appreciate your help so much that I was wondering, could I buy you a coffee as a token of my gratitude?
Following your instructions, I performed the operation and noticed a different response this time. For instance, it displayed "args: [-a -o /Users/ohyoung/Downloads/Markdown Documents]", and the Page Map presented my complete markdown notes.
However, the newly generated markdown folder remains empty. Here are the error messages that appeared (I have shortened the Page Map):
ohyoungdeMacBook-Pro:test ohyoung$ ls
Documents
ohyoungdeMacBook-Pro:test ohyoung$ git clone https://github.com/dom8509/logseq-to-markdown.git
Cloning into 'logseq-to-markdown'...
remote: Enumerating objects: 249, done.
remote: Counting objects: 100% (84/84), done.
remote: Compressing objects: 100% (59/59), done.
remote: Total 249 (delta 26), reused 40 (delta 22), pack-reused 165
Receiving objects: 100% (249/249), 95.38 KiB | 324.00 KiB/s, done.
Resolving deltas: 100% (112/112), done.
ohyoungdeMacBook-Pro:test ohyoung$ ls
Documents logseq-to-markdown
ohyoungdeMacBook-Pro:test ohyoung$ cd logseq-to-markdown
ohyoungdeMacBook-Pro:logseq-to-markdown ohyoung$ ls
CHANGELOG README.md deps.edn package.json yarn.lock
LICENSE bb.edn index.mjs src
ohyoungdeMacBook-Pro:logseq-to-markdown ohyoung$ git checkout bugfix-index-out-of-bound
Branch 'bugfix-index-out-of-bound' set up to track remote branch 'bugfix-index-out-of-bound' from 'origin'.
Switched to a new branch 'bugfix-index-out-of-bound'
ohyoungdeMacBook-Pro:logseq-to-markdown ohyoung$ npm install
added 77 packages, and audited 78 packages in 14s
10 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
ohyoungdeMacBook-Pro:logseq-to-markdown ohyoung$ npm run dev -- -a -o /Users/ohyoung/Downloads/Markdown Documents
> @dom8509/logseq-to-markdown@0.4.0 dev
> node index.mjs -a -o /Users/ohyoung/Downloads/Markdown Documents
Running logseq-to-markdown version 0.4.1
args: [-a -o /Users/ohyoung/Downloads/Markdown Documents]
Loading graph.
Graph Documents loaded successfully.
Exporting data to /Users/ohyoung/Downloads/Markdown ...
In get-all-public-and-private-pages
Page Map:
([{:db/id 3521, :block/created-at 1676994906961, :block/journal? false, :block/name 茶叶, :block/original-name 茶叶, :block/updated-at 1676994906961, :block/uuid #uuid "63f4e95a-775c-4020-8b1b-481e47d7b331"}] [{:db/id 5185, :block/created-at 1676994911127, :block/journal? false, :block/name 古严, :block/original-name 古严, :block/updated-at 1676994911127, :block/uuid #uuid "63f4e96a-2305-4d9e-adeb-1aa9064d63f3"}] [{:db/id 4797, :block/created-at 1676994910373, :block/journal? false, :block/name 三重心智模型, :block/original-name 三重心智模型, :block/updated-at 1676994910373, :block/uuid #uuid "63f4e95e-b9f5-4aed-b6f1-bfce6a06bbed"}] ……(**WAS SHORTEN**)
node:internal/process/esm_loader:42
internalBinding('errors').triggerUncaughtException(
^
el [Error]: Index out of bounds
at new el (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:179:94)
at $APP.Sm.j (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:1267:319)
at file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:332:310
at Jq (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:332:319)
at file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:563:399
at Q (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:308:469)
... 3 lines matching cause stack trace ...
at Q (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:308:469) {
data: {
K: null,
O: 6,
H: [
{
Nc: null,
name: 'type',
S: 'type',
Vc: 1174270348,
I: 2153775105,
M: 4096
},
{
Nc: 'sci',
name: 'error',
S: 'sci/error',
Vc: -979082803,
I: 2153775105,
M: 4096
},
{
Nc: null,
name: 'line',
S: 'line',
Vc: 212345235,
I: 2153775105,
M: 4096
},
42,
{
Nc: null,
name: 'column',
S: 'column',
Vc: 2078222095,
I: 2153775105,
M: 4096
},
40,
{
Nc: null,
name: 'message',
S: 'message',
Vc: -406056002,
I: 2153775105,
M: 4096
},
'Index out of bounds',
{
Nc: 'sci.impl',
name: 'callstack',
S: 'sci.impl/callstack',
Vc: -1621010557,
I: 2153775105,
M: 4096
},
Hh {
state: {
K: null,
first: {
K: null,
O: 5,
H: [Array],
D: null,
I: 16647951,
M: 139268
},
'$b': {
K: null,
first: [Object],
'$b': [Object],
count: 4,
D: null,
I: 65937646,
M: 8192
},
count: 5,
D: null,
I: 65937646,
M: 8192
},
I: 32768,
M: 0
},
{
Nc: null,
name: 'file',
S: 'file',
Vc: -1269645878,
I: 2153775105,
M: 4096
},
'/Users/ohyoung/Desktop/test/logseq-to-markdown/src/logseq_to_markdown/graph.cljs'
],
D: null,
I: 16647951,
M: 139268
},
cause: Error: Index out of bounds
at si (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:124:286)
at $APP.bm.j (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:998:325)
at file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:563:324
at Q (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:308:469)
at file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:562:321
at Q (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:308:469)
at file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:1719:281
at Q (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:308:469)
at file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:1721:157
at Q (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:308:469),
description: undefined,
number: undefined,
fileName: undefined,
lineNumber: undefined,
columnNumber: undefined
}
Node.js v20.1.0
I'm unsure of how to resolve this issue. Any further assistance you could provide would be greatly appreciated.
Looking forward to hearing from you.
Thank you!
Sure: https://www.buymeacoffee.com/dom8509 😄
I did some changes, can you try if it works now? I think I found the problem. Just go into the folder and run:
Sure: https://www.buymeacoffee.com/dom8509 😄
I did some changes, can you try if it works now? I think I found the problem. Just go into the folder and run:
- git pull
- npm run dev -- -a -o /Users/ohyoung/Downloads/Markdown Documents
Thank you, this script really works, I bought some coffee for you, hope you like it.https://www.buymeacoffee.com/dom8509
npm run dev -- -a -o /Users/ohyoung/Downloads/Markdown Documents
Greetings!
I've been experiencing some difficulties while converting Markdown format files. The original folder contains 967 Markdown notes, however, post-conversion, I can only see 706 notes. I am curious about the potential reasons for this. Could it be due to errors in certain files, or is there an issue within my conversion process?
My second question concerns terminal run logs. In the logs, I noticed data like :block/created-at 1676994902903. I'm wondering if it's possible to extract these data with basic Python and use them to name my converted files. If there isn't a better way, I plan on organizing the file names using the information from the operational records.
Here are my terminal run logs:
ohyoungdeMacBook-Pro:test ohyoung$ ls
Documents
ohyoungdeMacBook-Pro:test ohyoung$ git clone https://github.com/dom8509/logseq-to-markdown.git
Cloning into 'logseq-to-markdown'...
remote: Enumerating objects: 254, done.
remote: Counting objects: 100% (89/89), done.
remote: Compressing objects: 100% (62/62), done.
remote: Total 254 (delta 29), reused 43 (delta 23), pack-reused 165
Receiving objects: 100% (254/254), 95.70 KiB | 209.00 KiB/s, done.
Resolving deltas: 100% (115/115), done.
ohyoungdeMacBook-Pro:test ohyoung$ cd logseq-to-markdown
ohyoungdeMacBook-Pro:logseq-to-markdown ohyoung$ logseq-to-markdown ohyoung$ git checkout bugfix-index-out-of-bound
-bash: logseq-to-markdown: command not found
ohyoungdeMacBook-Pro:logseq-to-markdown ohyoung$ git checkout bugfix-index-out-of-bound
Branch 'bugfix-index-out-of-bound' set up to track remote branch 'bugfix-index-out-of-bound' from 'origin'.
Switched to a new branch 'bugfix-index-out-of-bound'
ohyoungdeMacBook-Pro:logseq-to-markdown ohyoung$ npm install
added 77 packages, and audited 78 packages in 13s
10 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
ohyoungdeMacBook-Pro:logseq-to-markdown ohyoung$ npm run dev -- -a -o /Users/ohyoung/Downloads/Markdown Documents
> @dom8509/logseq-to-markdown@0.4.0 dev
> node index.mjs -a -o /Users/ohyoung/Downloads/Markdown Documents
Running logseq-to-markdown version 0.4.1
args: [-a -o /Users/ohyoung/Downloads/Markdown Documents]
Loading graph.
Graph Documents loaded successfully.
Exporting data to /Users/ohyoung/Downloads/Markdown ...
In get-all-public-and-private-pages
Page Map:
([{:db/id 3521, :block/created-at 1676994906961, :block/journal? false, :block/name 茶叶, :block/original-name 茶叶, :block/updated-at 1676994906961, :block/uuid #uuid "63f4e95a-775c-4020-8b1b-481e47d7b331"}]
node:internal/process/esm_loader:42
internalBinding('errors').triggerUncaughtException(
^
el [Error]: ENOENT: no such file or directory, copyfile '{}/assets/image_1670159535176_0.png' -> '/Users/ohyoung/Downloads/Markdown/assets/image_1670159535176_0.png'
at new el (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:179:94)
at $APP.Sm.j (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:1267:319)
at file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:332:310
at Jq (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:332:319)
at file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:562:451
at Q (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:308:469)
at file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:1697:424
at Q (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:308:469)
at file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:504:470
at Q (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:308:469) {
data: {
K: null,
O: 6,
H: [
{
Nc: null,
name: 'type',
S: 'type',
Vc: 1174270348,
I: 2153775105,
M: 4096
},
{
Nc: 'sci',
name: 'error',
S: 'sci/error',
Vc: -979082803,
I: 2153775105,
M: 4096
},
{
Nc: null,
name: 'line',
S: 'line',
Vc: 212345235,
I: 2153775105,
M: 4096
},
101,
{
Nc: null,
name: 'column',
S: 'column',
Vc: 2078222095,
I: 2153775105,
M: 4096
},
13,
{
Nc: null,
name: 'message',
S: 'message',
Vc: -406056002,
I: 2153775105,
M: 4096
},
"ENOENT: no such file or directory, copyfile '{}/assets/image_1670159535176_0.png' -> '/Users/ohyoung/Downloads/Markdown/assets/image_1670159535176_0.png'",
{
Nc: 'sci.impl',
name: 'callstack',
S: 'sci.impl/callstack',
Vc: -1621010557,
I: 2153775105,
M: 4096
},
Hh {
state: {
K: null,
first: {
K: null,
O: 5,
H: [Array],
D: null,
I: 16647951,
M: 139268
},
'$b': {
K: null,
first: [Object],
'$b': [Object],
count: 29,
D: null,
I: 65937646,
M: 8192
},
count: 30,
D: null,
I: 65937646,
M: 8192
},
I: 32768,
M: 0
},
{
Nc: null,
name: 'file',
S: 'file',
Vc: -1269645878,
I: 2153775105,
M: 4096
},
'/Users/ohyoung/Desktop/test/logseq-to-markdown/src/logseq_to_markdown/parser.cljs'
],
D: null,
I: 16647951,
M: 139268
},
cause: Error: ENOENT: no such file or directory, copyfile '{}/assets/image_1670159535176_0.png' -> '/Users/ohyoung/Downloads/Markdown/assets/image_1670159535176_0.png'
at Module.copyFileSync (node:fs:2951:3)
at Zfa (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:337:230)
at file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:600:447
at Q (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:308:469)
at file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:421:267
at file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:562:394
at Q (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:308:469)
at file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:1697:424
at Q (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:308:469)
at file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:504:470 {
errno: -2,
syscall: 'copyfile',
code: 'ENOENT',
path: '{}/assets/image_1670159535176_0.png',
dest: '/Users/ohyoung/Downloads/Markdown/assets/image_1670159535176_0.png'
},
description: undefined,
number: undefined,
fileName: undefined,
lineNumber: undefined,
columnNumber: undefined
}
Node.js v20.1.0
Thank you so much for your generous and patient support. I look forward to hearing back from you.
No problem and thank you for the coffee! It seems like the removed the full path from the :file/path property in the graph. I fixed it, so you can try again and see if it works now.
npm run dev -- -a -o /Users/ohyoung/Downloads/Markdown Documents
Thank you so much for your help. I've followed the steps as follows, but I still ended up with 706 note files, not the 967 files in the folder.
ohyoungdeMacBook-Pro:logseq-to-markdown ohyoung$ cd /Users/ohyoung/Desktop/test
ohyoungdeMacBook-Pro:test ohyoung$ git clone https://github.com/dom8509/logseq-to-markdown.git
Cloning into 'logseq-to-markdown'...
remote: Enumerating objects: 261, done.
remote: Counting objects: 100% (96/96), done.
remote: Compressing objects: 100% (65/65), done.
remote: Total 261 (delta 34), reused 51 (delta 26), pack-reused 165
Receiving objects: 100% (261/261), 96.63 KiB | 354.00 KiB/s, done.
Resolving deltas: 100% (120/120), done.
ohyoungdeMacBook-Pro:test ohyoung$ cd logseq-to-markdown
ohyoungdeMacBook-Pro:logseq-to-markdown ohyoung$ git checkout bugfix-index-out-of-bound
Branch 'bugfix-index-out-of-bound' set up to track remote branch 'bugfix-index-out-of-bound' from 'origin'.
Switched to a new branch 'bugfix-index-out-of-bound'
ohyoungdeMacBook-Pro:logseq-to-markdown ohyoung$ npm install
added 77 packages, and audited 78 packages in 17s
10 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
ohyoungdeMacBook-Pro:logseq-to-markdown ohyoung$ npm run dev -- -a -o /Users/ohyoung/Downloads/Markdown Documents
> @dom8509/logseq-to-markdown@0.4.0 dev
> node index.mjs -a -o /Users/ohyoung/Downloads/Markdown Documents
Running logseq-to-markdown version 0.4.1-build202306011430
args: [-a -o /Users/ohyoung/Downloads/Markdown Documents]
Loading graph.
Graph Documents loaded successfully.
Exporting data to /Users/ohyoung/Downloads/Markdown ...
In get-all-public-and-private-pages
graph: Documents
logseq-graph-file: /Users/ohyoung/.logseq/graphs/logseq_local_++Users++ohyoung++Library++Mobile Documents++iCloud~com~logseq~logseq++Documents.transit
logseq-graph-path: /Users/ohyoung/Library/Mobile Documents/iCloud~com~logseq~logseq/Documents
node:internal/process/esm_loader:42
internalBinding('errors').triggerUncaughtException(
^
el [Error]: ENOENT: no such file or directory, copyfile '/Users/ohyoung/Library/Mobile Documents/iCloud~com~logseq~logseq/Documents/assets/image_1670159535176_0.png' -> '/Users/ohyoung/Downloads/Markdown/assets/image_1670159535176_0.png'
at new el (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:179:94)
at $APP.Sm.j (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:1267:319)
at file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:332:310
at Jq (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:332:319)
at file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:562:451
at Q (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:308:469)
at file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:1697:424
at Q (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:308:469)
at file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:504:470
at Q (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:308:469) {
data: {
K: null,
O: 6,
H: [
{
Nc: null,
name: 'type',
S: 'type',
Vc: 1174270348,
I: 2153775105,
M: 4096
},
{
Nc: 'sci',
name: 'error',
S: 'sci/error',
Vc: -979082803,
I: 2153775105,
M: 4096
},
{
Nc: null,
name: 'line',
S: 'line',
Vc: 212345235,
I: 2153775105,
M: 4096
},
101,
{
Nc: null,
name: 'column',
S: 'column',
Vc: 2078222095,
I: 2153775105,
M: 4096
},
13,
{
Nc: null,
name: 'message',
S: 'message',
Vc: -406056002,
I: 2153775105,
M: 4096
},
"ENOENT: no such file or directory, copyfile '/Users/ohyoung/Library/Mobile Documents/iCloud~com~logseq~logseq/Documents/assets/image_1670159535176_0.png' -> '/Users/ohyoung/Downloads/Markdown/assets/image_1670159535176_0.png'",
{
Nc: 'sci.impl',
name: 'callstack',
S: 'sci.impl/callstack',
Vc: -1621010557,
I: 2153775105,
M: 4096
},
Hh {
state: {
K: null,
first: {
K: null,
O: 5,
H: [Array],
D: null,
I: 16647951,
M: 139268
},
'$b': {
K: null,
first: [Object],
'$b': [Object],
count: 29,
D: null,
I: 65937646,
M: 8192
},
count: 30,
D: null,
I: 65937646,
M: 8192
},
I: 32768,
M: 0
},
{
Nc: null,
name: 'file',
S: 'file',
Vc: -1269645878,
I: 2153775105,
M: 4096
},
'/Users/ohyoung/Desktop/test/logseq-to-markdown/src/logseq_to_markdown/parser.cljs'
],
D: null,
I: 16647951,
M: 139268
},
cause: Error: ENOENT: no such file or directory, copyfile '/Users/ohyoung/Library/Mobile Documents/iCloud~com~logseq~logseq/Documents/assets/image_1670159535176_0.png' -> '/Users/ohyoung/Downloads/Markdown/assets/image_1670159535176_0.png'
at Module.copyFileSync (node:fs:2951:3)
at Zfa (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:337:230)
at file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:600:447
at Q (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:308:469)
at file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:421:267
at file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:562:394
at Q (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:308:469)
at file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:1697:424
at Q (file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:308:469)
at file:///Users/ohyoung/Desktop/test/logseq-to-markdown/node_modules/@logseq/nbb-logseq/lib/nbb_core.js:504:470 {
errno: -2,
syscall: 'copyfile',
code: 'ENOENT',
path: '/Users/ohyoung/Library/Mobile Documents/iCloud~com~logseq~logseq/Documents/assets/image_1670159535176_0.png',
dest: '/Users/ohyoung/Downloads/Markdown/assets/image_1670159535176_0.png'
},
description: undefined,
number: undefined,
fileName: undefined,
lineNumber: undefined,
columnNumber: undefined
}
Node.js v20.1.0
Moreover, I would like to ask you about the Page Map
information from the previous terminal run logs. It includes information about the creation and modification times of the notes (for example: :block/created-at 1676994906961,in https://github.com/dom8509/logseq-to-markdown/issues/4#issuecomment-1570294548 ), and I want to obtain them. However, I'm not sure why this information is missing from the latest terminal run logs.
I would like to inquire if there's any way to get the creation time of each note. Thank you!
I removed the page map log because I just needed it to find your error. The created-at time is exported to your markdown file as date meta data property the updated-at time as lastMod property.
- First, I moved 105 files from the 'journals' subfolder in 'Documents' to the 'pages' subfolder, so there were 967 note files in the 'pages' folder.
You don't have to to that, just leave the files where they are, the script will find them and export everything (pages + journals) to the pages folder
el [Error]: ENOENT: no such file or directory, copyfile '/Users/ohyoung/Library/Mobile Documents/iCloud~com~logseq~logseq/Documents/assets/image_1670159535176_0.png' -> '/Users/ohyoung/Downloads/Markdown/assets/image_1670159535176_0.png'
Does the image assets/image_1670159535176_0.png exist on your hard drive?
Yes, it is no longer on my hard drive. It must have been deleted by me before. I found the note containing this picture in my notes.
I removed the page map log because I just needed it to find your error. The created-at time is exported to your markdown file as date meta data property the updated-at time as lastMod property.
Thank you for your guidance. May I ask if it is possible to add a uuid(universally unique identification) here, based on the time point of creation, the format is yyyyMMddhhmm, and an attribute is: uuid: yyyyMMddhhmm, Then I can rename the notes with uuid in a script.
Ok I added an extra cmd arg "time-pattern" to define the pattern of the time string. You can use it with: npm run dev -- -a --time-pattern=yyyyMMddhhmm -o /Users/ohyoung/Downloads/Markdown Documents
Hope that helps for your use case. I also wrapped the copy file function so it doesn't terminate the script and just outputs a warning if the file doesn't exist.
Ok I added an extra cmd arg "time-pattern" to define the pattern of the time string. You can use it with: npm run dev -- -a --time-pattern=yyyyMMddhhmm -o /Users/ohyoung/Downloads/Markdown Documents
Hope that helps for your use case. I also wrapped the copy file function so it doesn't terminate the script and just outputs a warning if the file doesn't exist.
Thank you for your generous help, which solved my big problem
nice then I will close this Issue and create a new npm release 0.4.1
Hi,
there, Thank you for the tool logseq to markdown.
I followed the instructions and performed the operation in the terminal. It appeared to be running normally and showed that each document was successfully converted. It also successfully generated the "pages" and "assets" folders. However, both of these folders are empty.
Can you give me some advice.
pic1: the information in terminal
pic2:the empty folders