1. DOOM Emacs installation on Windows

1.1. install Emacs

1.1.1. org code <s TAB does not work

The <s TAB expansion is part of the org-tempo package.

;; Set up package archives (MELPA and others)
(require 'package)
(setq package-archives '(("melpa" . "https://melpa.org/packages/")))
(package-initialize)

(require 'package)
(setq package-archives '(("melpa" . "https://melpa.org/packages/")))

;; Install use-package if it's not already installed
(unless (package-installed-p 'use-package)
  (package-refresh-contents) ;; refresh package list
  (package-install 'use-package))

;; Always ensure that use-package is available
(eval-when-compile
  (require 'use-package))

(use-package org
  :ensure t
  :config
  (require 'org-tempo))

1.2. install Git

1.3. install ripgrep

ripgrep

ripgrep-14.1.1-x86_64-pc-windows-gnu.zip

1.4. install find

fd

fd-v10.2.0-x86_64-pc-windows-gnu.zip

1.5. set up user environment variable

$ echo $PATH
/e/Emacs/ql143/bin:/e/Emacs/ql143/bin::/e/Emacs/emacs-28.1/bin:/e/Emacs/fd:/e/Emacs/ripgrep

$ pwd
/e/Emacs

$ ls -l
total 136
-rwxr-xr-x 1 SouthernPark 197121 124642 Dec 22  2022 Uninstall.exe*
drwxr-xr-x 1 SouthernPark 197121      0 Dec 22  2022 emacs-28.1/
drwxr-xr-x 1 SouthernPark 197121      0 Apr 19 17:41 fd/
drwxr-xr-x 1 SouthernPark 197121      0 Apr 19 17:52 ql143/
drwxr-xr-x 1 SouthernPark 197121      0 Apr 19 17:38 ripgrep/

$ echo $HOME
/e/Emacs/ql143

1.6. install Doom

doom emacs

(setq doom-font (font-spec :size 25 ))

1.7. doom noted

But before you doom yourself, here are some things you should know:

1. Don't forget to run 'doom sync' and restart Emacs after modifying init.el or
   packages.el in ~/.config/doom. This is never necessary for config.el.

2. If something goes wrong, run `doom doctor` to diagnose common issues with
   your environment, setup, and config.

3. Use 'doom upgrade' to update Doom. Doing it any other way will require
   additional steps (see 'doom help upgrade').

4. Access Doom's documentation from within Emacs via 'SPC h d h' or 'C-h d h'
   (or 'M-x doom/help').

Have fun!

2. Jekyll install on WSL2

Windows is not an officially-supported platform. Therefore use WSL2 and Ubuntu to hold Jekyll. WSL2 Install Jekyll on Ubuntu

root@LAPTOP-FOPVC68I:/mnt/e/Emacs/ql143/blog_project# jekyll new docs
root@LAPTOP-FOPVC68I:/mnt/e/Emacs/ql143/blog_project# ls
docs org

root@LAPTOP-FOPVC68I:/mnt/e/Emacs/ql143/blog_project/docs# bundle exec jekyll serve

3. Export org to Jkeyll

Using org to Blog with Jekyll

SouthernPark.github.io/
├── README.md
├── docs
│   ├── 404.html
│   ├── Gemfile
│   ├── Gemfile.lock
│   ├── _config.yml
│   ├── _posts
│   │   └── 2021-04-07-monte_carlo.markdown
│   ├── _site
│   ├── about.markdown
│   ├── assets
│   │   ├── css
│   │   │   ├── jsxgraph.css
│   │   │   └── result_display.css
│   │   └── js
│   │       ├── OrbitControls.js
│   │       ├── jsxgraphcore.js
│   │       └── three.js
│   ├── index.html
│   ├── index.markdown.bak
│   └── pages                                            <<< org export the pages here
│       └── how-to-blog-with-Emacs-Jeklly.html
└── org
    ├── _posts                                          
    ├── index.org                                       <<< index article
    ├── index.org.bak
    └── pages                                           <<< self created, to page org articles here
        └── how-to-blog-with-Emacs-Jeklly.org
(setq org-publish-project-alist
      '(

  ("org-ianbarton"
          ;; Path to your org files.
          :base-directory "~/SouthernPark.github.io/org/"
          :base-extension "org"

          ;; Path to your Jekyll project.
          :publishing-directory "~/SouthernPark.github.io/docs/"
          :recursive t
          :publishing-function org-html-publish-to-html
          :headline-levels 4
          :html-extension "html"
          :body-only t ;; Only export section between <body> </body>
    )


    ("org-static-ian"
          :base-directory "~/SouthernPark.github.io/org/"
          :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|php"
          :publishing-directory "~/SouthernPark.github.io/"
          :recursive t
          :publishing-function org-publish-attachment)

    ("ian" :components ("org-ianbarton" "org-static-ian"))

))

4. TODO Org File Format to Fit Jeklly

Jekyll requires the YAML — to be at the top of the generated HTML The current solution is diable the TOC exporting. Need to find a way to customize the location of TOC

#+STARTUP: showall indent
#+STARTUP: hidestars
#+TOC: nil  ;; Disable table of contents by default
#+OPTIONS: toc:nil  ;; Disable TOC in HTML export

#+BEGIN_EXPORT html
---
layout: default
title: How To Blog With Emacs Jeklly
---
#+END_EXPORT

5. Jeklly on Github

6. Jeklly tricks

6.1. fix the navigation bar

when you add more dir in the site at the same level like _post, _site The nav bar will also include the pages in those dir. To make things clean, you can set the following to fix nav bar in _config.yml

header_pages:
  - about.markdown

7. Corner cases

7.1. \{\{ or not \}\} better not appear because of they are special char

Jekyll (via Liquid), is used to output variables, so using them directly in your HTML (especially for things like math expressions, code snippets, or data) will cause errors unless you escape or suppress them.

one way is to add space amongthem

Another way is to use the following: {{1, 2, 3}} is a set of values

7.2. Org export will only generate html files once the org file is modified

To avoid this, you can delete the org export timestamp in the following file:

~/.emacs.d/.local/cache/org/timestamps/

(setq org-publish-cache (make-hash-table :test 'equal :weakness nil :size 100))
(puthash ":project:" "org-ianbarton" org-publish-cache)
(puthash ":cache-file:" "./.emacs.d/.local/cache/org/timestamps/org-ianbarton.cache" org-publish-cache)

<<< delete from here
(puthash "./SouthernPark.github.io/org/index.org" '(:crossrefs (((other "OTHER") . 241588112) ((headline "OTHER") . 241588112) ((other "[[FILE:PAGES/HOW-TO-BLOG-WITH-EMACS-JEKLLY.ORG][BLOGS" "WITH" "EMACS" "ORG" "MODE," "JEKLLY" "AND" "GITHUB" "PAGES]]") . 133800015) ((headline "[[FILE:PAGES/HOW-TO-BLOG-WITH-EMACS-JEKLLY.ORG][BLOGS" "WITH" "EMACS" "ORG" "MODE," "JEKLLY" "AND" "GITHUB" "PAGES]]") . 133800015) ((other "[[FILE:~/ORG_PRIVATE_REPO/APPLICATIONS.ORG][APPLICATION]]") . 66852479) ((headline "[[FILE:~/ORG_PRIVATE_REPO/APPLICATIONS.ORG][APPLICATION]]") . 66852479) ((other "[[FILE:~/ORG_PRIVATE_REPO/VISA.ORG][US" "VISA" "INFO" "(CPT/OPT/H1B)]]") . 15348691) ((headline "[[FILE:~/ORG_PRIVATE_REPO/VISA.ORG][US" "VISA" "INFO" "(CPT/OPT/H1B)]]") . 15348691) ((other "PROGRAMMING" "LANGUAGE") . 7219876) ((headline "PROGRAMMING" "LANGUAGE") . 7219876) ((other "[[FILE:PAGES/PROGRAMMING_LANGUAGE/C++.ORG][C++]]") . 252688390) ((headline "[[FILE:PAGES/PROGRAMMING_LANGUAGE/C++.ORG][C++]]") . 252688390) ((other "OPERATING" "SYSTEM") . 98189774) ((headline "OPERATING" "SYSTEM") . 98189774) ((other "[[FILE:PAGES/OS/XV6/XV6.ORG][MIT" "6.S081" "XV6" "OS" "WITH" "RISCV" "CPU]]") . 149546473) ((headline "[[FILE:PAGES/OS/XV6/XV6.ORG][MIT" "6.S081" "XV6" "OS" "WITH" "RISCV" "CPU]]") . 149546473) ((other "[[FILE:~/ORG_PRIVATE_REPO/BEHAVIOR_QUESTION.ORG][BEHAVIOR" "QUESTION]]") . 170993380) ((headline "[[FILE:~/ORG_PRIVATE_REPO/BEHAVIOR_QUESTION.ORG][BEHAVIOR" "QUESTION]]") . 170993380) ((other "[[FILE:PAGES/ALGORITHM/ALGORITHM.ORG][ALGORITHM]]") . 163051564) ((headline "[[FILE:PAGES/ALGORITHM/ALGORITHM.ORG][ALGORITHM]]") . 163051564))) org-publish-cache)
(puthash "X7463dbcc975a05c0934dfa69a0654651a15c97b7" '(26687 52976 0 0) org-publish-cache)

8. Image

8.1. org-ros

org-ros github link in ~/.doom.d/packages.el include the following

(package! org-ros)

run ./doom sync, the scripts will be downloaded from melpa

8.1.1. corner cases (for Windows powershell.exe run failed because of permission)

~/.emacs.d/.local/straight/repos/ros/org-ros.el contains the lisp code to call the screenshot tool for Windows, add “-ExecutionPolicy” “Bypass” to the following to by pass policy

83
84                 ((executable-find org-ros-windows-screencapture)
85                  (start-process "powershell" "*PowerShell*" "powershell.exe" "-ExecutionPolicy" "Bypass" "-File" (expand-file-name "./printsc.ps1" org-ros-dir) filepath)))

don’t forget to run ./doom sync

8.1.2. inline image

Only inline images can be displayed directly in org mode and exported to inline image in HTML. Inline image does not have description part, so replace the following code in ~/.emacs.d/.local/straight/repos/ros/org-ros.el

(insert "[[" filepath "]" "[" display-name "]]")

to the following

;; the ros stores the img in the same dir as current org, so it's ok to use relative path
;; use relative path also helps for org to HTML export
(insert (format "[[file:%s]]\n" default-filename))

Also change the following

(display-name (read-string
                              (format "Name the screenshot (default: \"%s\"): " default-filename)
                              nil nil default-filename))

to

(default-filename (read-string
                              (format "Name the screenshot (default: \"%s\"): " default-filename)
                              nil nil default-filename))

don’t forget to run ./doom sync