Repository navigation
help please #823
Unanswered
cmjmmrp-byte
asked this question in
Q&A
help please
#823
Replies: 1 comment
|
There's no "export everything as .md" button. Two options:
To turn that import json, os, re
nodes = {n["id"]: n for n in json.load(open("documents.json"))}
def safe(name):
return re.sub(r'[\\/:*?"<>|]', "_", name).strip() or "untitled"
def folder(n):
parts = []
while n.get("parent_id") in nodes:
n = nodes[n["parent_id"]]
parts.append(safe(n["name"]))
return os.path.join("notes", *reversed(parts))
for n in nodes.values():
if n["role"] == 3: # 3 = document
d = folder(n)
os.makedirs(d, exist_ok=True)
with open(os.path.join(d, f"{safe(n['name'])}-{n['id']}.md"), "w", encoding="utf-8") as f:
f.write(n.get("content") or "")It writes a |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
hi, How i can export all notes in markdown files at time, thanks
All reactions