Export to Markdown or text, and import text as nodes (stage 9c)
:export md writes the document as Markdown headings in the clipboard's format (the user's pick): # for the root and each loose node, ## for their children, down to ######, the tags between --- lines, then the body. :export txt writes an indented outline, tags after each title and the body under it after "| " (the user's pick), from the new storage::plain_text. The file goes next to the document, named after it, or where it's told; as vim's :w to another file does, an existing file needs :export! (the user's pick). Typed in visual mode, :export writes just the selection, named after its first branch (the user's pick). :import file reads Markdown headings, a list or indented lines with the clipboard's reader, now also taking #tags at the end of a line and "| " body lines, so a text export reads back whole. The nodes go under the cursor's node, laid out as a mind map, as one undo step (the user's pick). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
5888d143fd
commit
9d15a054f2
14 files changed
+407
-33
No files matched your search
@@ -296,6 +296,27 @@ lines.
|
||||
The root can't branch out (it's the whole document), and neither can a
|
||||
portal (its document is one of its own already).
|
||||
|
||||
**Export and import** (settled in part 9c)
|
||||
- `:export md` writes the document as Markdown headings, in the clipboard's
|
||||
format (the user's pick): `#` for the root and each loose node, `##` for
|
||||
their children, and so on down to `######`; the tags as a list between
|
||||
two `---` lines, then the body. `:export txt` writes an outline: a title
|
||||
per line, two spaces a level, its tags after it, and its body under it a
|
||||
level further in, each line after a `| ` (the user's pick).
|
||||
- The file goes next to the document and is named after it (`garden.md`),
|
||||
or where `:export md file` says (`.md` or `.txt` is added). As vim's `:w`
|
||||
to another file does, it leaves a file that's there alone unless it's
|
||||
`:export!` (the user's pick).
|
||||
- Typed in visual mode, `:export` writes just the selection (the user's
|
||||
pick), named after its first branch (`raised-beds.md`): with `v` exactly
|
||||
the nodes chosen, with `V` their branches.
|
||||
- `:import file` reads Markdown headings, a bulleted list or indented lines
|
||||
(what both exports write, and what the clipboard reads), and the nodes go
|
||||
under the cursor's node as its last children, laid out as a mind map, as
|
||||
one undo step (the user's pick). `#tags` at the end of a line are its
|
||||
tags, and lines after a `| ` are the body of the node above. Looks and
|
||||
cross-links stay out of both exports.
|
||||
|
||||
**Views, panes and popups** (settled in stage 7)
|
||||
- The Note view is made of parts: the title, the tags, the body, each link
|
||||
(out, then in) and each child. `j` and `k` step through them, with a bar
|
||||
@@ -718,7 +739,8 @@ cumulus/
|
||||
│ (keys.toml's template), theme_file (themes laid over the built-in one)
|
||||
├─ storage/ document_file (RON), write_atomically, names (file names from titles), link_paths
|
||||
│ (portal paths: relative, with /), backup, lock, stamp (noticing changes made
|
||||
│ outside), memory (memory.ron), markdown (nodes as Markdown, for the clipboard)
|
||||
│ outside), memory (memory.ron), markdown (nodes as Markdown, for the clipboard
|
||||
│ and :export; text read back as nodes), plain_text (:export txt)
|
||||
└─ app/ mod.rs (App), input (keys and the mouse, routed), update (carrying actions out),
|
||||
render, terminal (the main loop, setup, teardown, panic hook), startup (what
|
||||
`cumulus` opens), documents (the open documents and their files), files
|
||||
@@ -730,12 +752,13 @@ cumulus/
|
||||
search (`/`), jumps (each pane's jump list), marks (capital marks, `:marks`),
|
||||
connect (connect mode), portals (what portals show, going through them,
|
||||
`:portal`, backlinks, renames), branch_out (`:branchout`), panes (the split
|
||||
tree), popup (help, menu, pickers, card, questions)
|
||||
tree), export (:export, :import), popup (help, menu, pickers, card, questions)
|
||||
```
|
||||
|
||||
The end-to-end tests are in `app/tests.rs` (with `app/tests/files.rs`,
|
||||
`app/tests/config.rs`, `app/tests/vim.rs`, `app/tests/connect.rs`,
|
||||
`app/tests/portals.rs`, `app/tests/arrange.rs` and `app/tests/branch_out.rs`):
|
||||
`app/tests/portals.rs`, `app/tests/arrange.rs`, `app/tests/branch_out.rs` and
|
||||
`app/tests/export.rs`):
|
||||
they copy the sample
|
||||
documents to a temporary folder, type keys and click on a test terminal, and
|
||||
check the screen, the documents and the files.
|
||||
|
||||
Reference in new issue
Block a user