Two-way bridge between Lark/Feishu docs and Org files.
Fetches Markdown via lark-cli, normalizes Lark-specific custom blocks (tables, quotes, callouts, grids, …), and converts into an Org file. See the full sample export: example/exported.org
From MELPA:
M-x package-install RET org-lark RETOr manually:
(add-to-list 'load-path "/path/to/org-lark")
(require 'org-lark);; Interactive
M-x org-lark-export
;; From Lisp
(org-lark-export "https://your-lark-doc" "~/notes/export.org")
;; Export URL at point
M-x org-lark-export-url-at-pointThe minibuffer shows short status messages during export:
org-lark: fetching... org-lark: converting... org-lark: downloading media 3/12... org-lark: running pandoc... org-lark: done → export.org
Image and whiteboard tokens are downloaded automatically when
org-lark-download-media is non-nil. The exporter calls
lark-cli docs +media-download --token TOKEN from the Org file’s
directory, passes a relative --output path such as assets/TOKEN,
saves the result under the configured assets directory, and emits an
Org image link such as:
#+attr_org: :width 640 :align center
[[file:assets/example.png]]
Push an Org file back up to Lark. If the file’s #+lark_doc_id:
header is set, the existing remote doc is overwritten; otherwise a
new doc is created and the doc id / URL are written back into the
local file’s header.
;; Interactive
M-x org-lark-publish
;; From Lisp (async; callback gets (ERR URL))
(org-lark-publish-async "~/notes/export.org"
(lambda (err url)
(message "→ %s" (or url err))))The pipeline reverses the export:
- Strip Org keyword headers; remember
#+title,#+lark_doc_id,#+lark_source, and an optional#+lark_parent:(e.g.folder:TOKENorwiki:SPACE/NODE). - Reverse-map
#+begin_lark_grid/_column/_chat_card/_addon/_source_synced/_reference_synced/_view,#+begin_quotewith#+attr_org, and#+begin_examplewith:emojiback into Lark custom tags. - Reverse-map
[[lark-doc:..]],[[lark-user:..]],[[lark-task:..]],[[lark-sheet:..]]into the corresponding inline tags. - Run Pandoc once (
org → gfm --wrap=none). - For each
[[file:..]]image/attachment: reuse the cached Lark token when the file’s SHA-256 is unchanged; otherwise upload vialark-cli docs +media-uploadand cache the returned token inorg-lark-media-cache-file. - Call
lark-cli docs +create(new doc) ordocs +update --mode overwrite(existing). When creating, the new doc id and URL are written back into the local file’s header.
M-x org-lark-toggle-debug opens a read-only *org-lark-log* buffer
with timestamped details: full shell commands, exit codes, byte counts,
tag match counts, and per-step timing.
| Variable | Default | Description |
|---|---|---|
org-lark-cli-program | "lark-cli" | Path to lark-cli |
org-lark-pandoc-program | "pandoc" | Path to pandoc |
org-lark-identity | "user" | --as identity for lark-cli |
org-lark-download-media | t | Download images/files/whiteboards |
org-lark-assets-directory | "assets" | Asset sub-directory |
org-lark-timeout | 30 | Seconds before killing a subprocess |
org-lark-open-after-export | t | Visit converted file after export |
org-lark-debug | nil | Log to *org-lark-log* buffer |
org-lark-publish-default-parent | nil | Fallback parent for created docs (folder:T or wiki:S/N) |
org-lark-publish-update-mode | "overwrite" | Mode for docs +update on re-publish |
org-lark-confirm-overwrite-remote | t | Prompt before overwriting an existing remote doc |
org-lark-media-cache-file | org-lark-media.eld | Persistent media-upload cache (per-user) |
emacs -Q --batch -L . -l test/org-lark-test.el -f ert-run-tests-batch-and-exit