https://github.com/toyboot4e/zenn
https://github.com/toyboot4e/zenn
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/toyboot4e/zenn
- Owner: toyboot4e
- Created: 2020-10-15T09:01:13.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-01-13T04:51:19.000Z (over 1 year ago)
- Last Synced: 2025-03-15T23:28:33.421Z (over 1 year ago)
- Homepage: https://zenn.dev/toyboot4e
- Size: 8.62 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
README
#+TITLE: Zenn
** One org file as one book
New book is composed as one org file, using [[https://zenn.dev/conao3/articles/ox-zenn-usage][ox-zenn]].
*** Export function
#+BEGIN_SRC elisp
(defun org-zenn-export-buffer-to-book (&optional org-dir)
"Runs subtree export to each level 1 headings. Respects `#+BOOK_DIR'."
(interactive)
(org-babel-tangle)
;; export all
(let* ((default-dir default-directory)
(pub-dir (car (cdr (car (org-collect-keywords '("BOOK_DIR")))))))
;; cd into the target directory
(when pub-dir (cd pub-dir))
;; export all
(unwind-protect
(org-map-entries
(lambda ()
(let* ((is-draft (org-entry-get nil "DRAFT")))
(unless is-draft
(org-zenn-export-to-markdown nil t))))
"LEVEL=1")
;; be sure to come back to the default directory
(when pub-dir (cd default-dir)))))
#+END_SRC
*** File structure
The repository structure:
#+BEGIN_SRC txt
/zenn
├── books/
├── img/
└── org/
#+END_SRC
The org book structure is shown in [[./org/kyopro-bonsai-hs.org]].