JWen's Blog

Personal website of JWen 丁文亮的个人网站

Write Hugo Posts with OrgMode and ox-hugo

2024-07-17


Table of Contents

Why I want to write a blog?

Writing a blog is not the thing that most people would do. I have never thought of it, even though I get lots of valuable information from blogs written by other people. Such information cover various aspects, including courage if you encounter career crisis, curiosity when you find somebody else have tried something cool making live easier, or just simple happiness related to your life.

At the beginning, I wrote the blog for myself. It’s more accurate to call it “note” instead of “blog”. The notes contain the knowledge I learned from high-quality blogs, classic books and courses. The notes are well-(organized, categorized, and tagged), stored in folders, and can only be viewed in “folder” version if I havn’t used tools to generate a “website” version of them. Even though I generate a “website” version of these notes, I can treat them only for personal use and choose not to publish them.

My mind changed when I learned about GNU.

“As we enjoy great advantages from the inventions of others, we should be glad of an opportunity to serve others by any invention of ours, and this we should do freely and generously.” — Benjamin Franklin

I rethink the bad education experience I have been given by most of the teachers. Such education is cheap (has a price) and of low quality. I recall the few teachers who once told me the true knowledge (a priceless treasure) and helped me without hesitation when I felt down. They did so utterly out of their goodness and kindness, and this had nothing to do with the salary they got paid or something else. I start to use Emacs to:

I start to publish the notes on the blog. Two main reasons are as follows:

  1. “How much you are willing to pay for the knowledge?”, “What’s the just and reasonable price for the knowledge?”, I have asked myself these kind of questions several times. My current answer is: it depends on what kind of knowledge we are discussed.

    • If the knowledge is fundamental, it’s discovered several decades ago, and highly related to human’s normal happiness. It should be free.
    • If the knowledge is at the forefront of academic, it’s should be priced justly and reasonablely by rational society.
    • If the knowledge is in the middle of the above situation, I don’t know. But if we discover the knowledge, we should be humble and kind, as we are standing on the shoulders of giants.

    What I post on blog is the fundamental knowledge I learned for free from other great blogs or websites. I try my best tidying them and expressing my own understanding. I hope somebody could find my post helpful when he meet the same problem I met before.

  2. Writing blog is my way of participating in public life and breaking down the barriers of knowledge. Compared with writing posts on WeChat or ZhiHu, building personal blog has the highest flexibility and customization, thus is time-consuming at the beginning. To me, I already get a huge payoff of being able to write these posts.

For those who read the above content carefully, please forgive my poor writing. If you want to say something to me, feel free send an email to jwenfight@163.com.

OrgMode + ox-hugo

Other references unrelated to “OrgMode + ox-hugo”

  1. ox-hugo or go-org?

    go-org kind of translates Org to HTML. Install it as follows: (my ~/bin is in the PATH, Ref)

    git clone https://github.com/niklasfasching/go-org
    cd go-org
    go build .
    mv go-org ~/bin
    
  2. The Asian Language issue also occurs in go-org and the solution is (Ref):

    #+options: ealb:t
    

    Line breaks between multi-byte characters are omitted when the ealb option is set.

    The example is also insightful, east_asian_line_breaks in pandoc:

    jwen@MacBook-Pro content-org % cat test.org
    
    你好
    
    Hello
    World
    jwen@MacBook-Pro content-org % pandoc -t html -o test.html test.org; cat test.html
    <p>你 好</p>
    <p>你好</p>
    <p>Hello World</p>
    jwen@MacBook-Pro content-org % pandoc -f org+east_asian_line_breaks -t html -o test.html test.org; cat test.html
    <p>你好</p>
    <p>你好</p>
    <p>Hello World</p>
    jwen@MacBook-Pro content-org % go-org render test.org html
    <p>你
    好</p>
    <p>
    你好</p>
    <p>
    Hello
    World</p>
    jwen@MacBook-Pro content-org % cat test.org
    #+options: ealb:t
    
    你好
    
    Hello
    World
    jwen@MacBook-Pro content-org % go-org render test.org html
    <p>
    你好</p>
    <p>
    你好</p>
    <p>
    Hello
    World</p>
    
  3. What’s the relation between go-org (translates org to html) and C-c C-e h h? (todo)

  4. Build blog with “Emacs + OrgMode + ox-publish”, an excellent video, another choice.


  1. I hate RStudio. Let me quote two paragraphs from the great book Learn Python 3 the Hard Way, which I think is suitable for the beginner of any language:

    • “Anyone trying to hide knowledge from you, or worse, make you get it from them instead of through your own efforts, is trying to make you depend on them for your skills. Don’t listen to them, and do the exercises anyway so that you learn how to educate yourself.”

    • “Relying on an IDE means that you can’t work with new programming languages until some company decides to sell you an IDE for that language. This means you can’t use that new language until the language is large enough to justify a lucrative customer base. If you are confident you can work with only a programmer’s text editor (like Vim, Emacs, Atom, etc.) then you don’t have to wait for a third party. IDEs are nice in some situations (such as working with a giant existing code base) but being addicted to them will limit your future.”

     ↩︎