An open API service indexing awesome lists of open source software.

https://github.com/toyboot4e/zenn


https://github.com/toyboot4e/zenn

Last synced: about 2 months ago
JSON representation

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]].